From: Michael Prokop Date: Fri, 22 Jun 2012 20:32:00 +0000 (+0200) Subject: No longer execute hostname command if hostname option is not present X-Git-Tag: v0.9.53~2 X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=commitdiff_plain;h=47ab27a118a07d139b2bd379f48e5e066337700b 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. --- 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 } # }}}