From 31709558945f7110d036868bc385216d1abc1f6a Mon Sep 17 00:00:00 2001 From: Donald Burr Date: Tue, 17 Feb 2015 20:51:54 -0800 Subject: [PATCH] Add cheesy hostname set script --- acatcher/set_hostname.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 acatcher/set_hostname.sh diff --git a/acatcher/set_hostname.sh b/acatcher/set_hostname.sh new file mode 100755 index 0000000..893103a --- /dev/null +++ b/acatcher/set_hostname.sh @@ -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