Add cheesy hostname set script
This commit is contained in:
parent
182324e146
commit
3170955894
1 changed files with 17 additions and 0 deletions
17
acatcher/set_hostname.sh
Executable file
17
acatcher/set_hostname.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
if grep -q raspberrypi /etc/hostname; then
|
||||
echo "You still have the default hostname set. We recommend changing the"
|
||||
echo "hostname so that your Pi can be uniquely identified."
|
||||
echo "If you wish to change it, enter a new hostname now, otherwise"
|
||||
echo -n "just press Return: "
|
||||
read NEW_HOSTNAME
|
||||
if [ ! -z "$NEW_HOSTNAME" ]; then
|
||||
echo "$NEW_HOSTNAME" > /tmp/HOSTNAME.$$
|
||||
sudo rm -f /etc/hostname
|
||||
sudo mv /tmp/HOSTNAME.$$ /etc/hostname
|
||||
sudo chown root:root /etc/hostname
|
||||
sudo chmod 644 /etc/hostname
|
||||
sudo /etc/init.d/hostname.sh
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue