mirror of
https://github.com/0x1d/terraform-docker-packer.git
synced 2025-12-14 14:01:29 +01:00
7 lines
245 B
Bash
Executable File
7 lines
245 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Generate a unique hostname
|
|
NEW_HOSTNAME="rpi-$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2 | tail -c 5)"
|
|
echo "$NEW_HOSTNAME" > /etc/hostname
|
|
sed -i "s/raspberrypi/$NEW_HOSTNAME/g" /etc/hosts
|
|
hostname "$NEW_HOSTNAME" |