diff --git a/init.d/hostname.in b/init.d/hostname.in index 5d597ad5..3d70a2f3 100644 --- a/init.d/hostname.in +++ b/init.d/hostname.in @@ -19,20 +19,18 @@ depend() start() { - local h source x - if [ -s /etc/hostname ] && [ -r /etc/hostname ]; then - read h x /dev/null < @SYSCONFDIR@/hostname; then + source="@SYSCONFDIR@/hostname" + elif [ -n "${hostname}" ]; then + h=${hostname} + source="@SYSCONFDIR@/conf.d/${RC_SVCNAME}" fi if [ -z "$h" ]; then einfo "Using default system hostname" return 0 fi - ebegin "Setting hostname to $h $source" + ebegin "Setting hostname to $h from $source" hostname "$h" eend $? "Failed to set the hostname" }