about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2015-03-21 23:29:19 +0100
committerSören Tempel <soeren+git@soeren-tempel.net>2015-03-21 23:29:19 +0100
commitcdf584873d74f1ca227dc259705463f29ecd5fae (patch)
tree728355da412d0d7309ac9e4d190925a64c5750f7
parent64553f5c8e9800201960aef099b43ac85ea1eaf1 (diff)
downloadrunit-void-cdf584873d74f1ca227dc259705463f29ecd5fae.tar.gz
runit-void-cdf584873d74f1ca227dc259705463f29ecd5fae.tar.xz
runit-void-cdf584873d74f1ca227dc259705463f29ecd5fae.zip
warn if hostname wasn't set
-rw-r--r--core-services/05-misc.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/core-services/05-misc.sh b/core-services/05-misc.sh
index 9beff2a..27cb235 100644
--- a/core-services/05-misc.sh
+++ b/core-services/05-misc.sh
@@ -7,13 +7,13 @@ cp /var/lib/random-seed /dev/urandom >/dev/null 2>&1 || true
 msg "Setting up loopback interface...\n"
 ip link set up dev lo
 
+[ -r /etc/hostname ] && read -r HOSTNAME < /etc/hostname
 if [ -n "$HOSTNAME" ]; then
+    msg "Setting up hostname to '${HOSTNAME}'...\n"
     echo "$HOSTNAME" > /proc/sys/kernel/hostname
-elif [ -r /etc/hostname ]; then
-    read -r HOSTNAME < /etc/hostname
-    echo "$HOSTNAME" > /proc/sys/kernel/hostname
+else
+    msg_warn "Didn't setup a hostname!\n"
 fi
-msg "Setting up hostname to '${HOSTNAME}'...\n"
 
 if [ -n "$TIMEZONE" ]; then
     msg "Setting up timezone to '${TIMEZONE}'...\n"