From 47ab27a118a07d139b2bd379f48e5e066337700b Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Fri, 22 Jun 2012 22:32:00 +0200 Subject: [PATCH] No longer execute hostname command if hostname option is not present There's no need to execute the hostname command if the boot option hostname is not present as /etc/init.d/hostname.sh is executed on Grml during bootup. We keep the config_hostname() only because we support setting it to a random hostname if no argument was specified to the boot option and to keep using grml-hostname as main interface for changing hostnames on-the-fly. --- autoconfig.functions | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/autoconfig.functions b/autoconfig.functions index 8eba860..035803d 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -372,20 +372,21 @@ config_language(){ # {{{ Set hostname config_hostname(){ - if checkbootparam 'hostname' ; then + if ! checkbootparam 'hostname' ; then + return 0 + fi + HOSTNAME="$(getbootparam 'hostname' 2>>$DEBUG)" if [ -z "$HOSTNAME" ] && [ -x /usr/bin/random-hostname ] ; then - einfo "Generating random hostname as no hostname was specified." - HOSTNAME="$(/usr/bin/random-hostname)" - eend $? + einfo "Generating random hostname as no hostname was specified." + HOSTNAME="$(/usr/bin/random-hostname)" + eend $? fi + einfo "Setting hostname to $HOSTNAME as requested." - grml-hostname $HOSTNAME >>$DEBUG ; RC=$? - [ "$RC" = "0" ] && hostname $HOSTNAME + grml-hostname $HOSTNAME >>$DEBUG ; eend $RC eend $RC - else - hostname --file /etc/hostname - fi +fi } # }}} -- 2.1.4