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.
# {{{ Set hostname
config_hostname(){
# {{{ 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
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 $?
einfo "Setting hostname to $HOSTNAME as requested."
einfo "Setting hostname to $HOSTNAME as requested."
- grml-hostname $HOSTNAME >>$DEBUG ; RC=$?
- [ "$RC" = "0" ] && hostname $HOSTNAME
+ grml-hostname $HOSTNAME >>$DEBUG ; eend $RC
- else
- hostname --file /etc/hostname
- fi