about summary refs log tree commit diff
path: root/core-services
diff options
context:
space:
mode:
Diffstat (limited to 'core-services')
-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 11ce1e6..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
-    HOSTNAME=$(cat /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"