summary refs log tree commit diff
diff options
context:
space:
mode:
authorJuan RP <xtraeme@gmail.com>2015-03-22 07:06:51 +0100
committerJuan RP <xtraeme@gmail.com>2015-03-22 07:06:51 +0100
commitcc241733778444a9b4bbef9606a4eb2bab743a00 (patch)
tree728355da412d0d7309ac9e4d190925a64c5750f7
parent64553f5c8e9800201960aef099b43ac85ea1eaf1 (diff)
parentcdf584873d74f1ca227dc259705463f29ecd5fae (diff)
downloadrunit-void-cc241733778444a9b4bbef9606a4eb2bab743a00.tar.gz
runit-void-cc241733778444a9b4bbef9606a4eb2bab743a00.tar.xz
runit-void-cc241733778444a9b4bbef9606a4eb2bab743a00.zip
Merge pull request #26 from nmeum/hostname
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"