X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=035803d7dad9acd8f7b77a2ee384c9ede2b20a0a;hp=d9c04c8c3859ed6282a237072ab544d05a2975bf;hb=47ab27a118a07d139b2bd379f48e5e066337700b;hpb=836ed246742907a3c931260647d0c6ac5dcb081d diff --git a/autoconfig.functions b/autoconfig.functions index d9c04c8..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 } # }}} @@ -1101,6 +1102,7 @@ fi # {{{ autostart of x11vnc config_vnc(){ if checkbootparam 'vnc' ; then + config_userlocal VNC_PASSWD='' VNC_PASSWD="$(getbootparam 'vnc' 2>>$DEBUG)" einfo "Bootoption vnc found, trying to set password for user $localuser." @@ -1115,7 +1117,7 @@ if checkbootparam 'vnc' ; then elif [ -x /usr/bin/hexdump ] ; then VNC_PASSWD="$(dd if=/dev/urandom bs=14 count=1 2>/dev/null | hexdump | awk '{print $3 $4}')" elif [ -n "$RANDOM" ] ; then - VNC_PASSWD="${USER}${RANDOM}" + VNC_PASSWD="${localuser}${RANDOM}" else VNC_PASSWD='' eerror "Empty passphrase and neither pwgen nor hexdump nor \$RANDOM found. Skipping." @@ -1131,7 +1133,7 @@ if checkbootparam 'vnc' ; then # finally check if we have a password we can use: if [ -n "$VNC_PASSWD" ] ; then - VNCDIR="/home/${USER}/.vnc" + VNCDIR="/home/${localuser}/.vnc" [ -d "$VNCDIR" ] || mkdir "$VNCDIR" if [ ! -x /usr/bin/x11vnc ] ; then @@ -1147,7 +1149,7 @@ if checkbootparam 'vnc' ; then VNC_CONNECT="$(getbootparam 'vnc_connect' 2>>$DEBUG)" einfo "Bootoption vnc_connect found, will start vnc with connect to $VNC_CONNECT." #store the options in a file - VNCDIR="/home/${USER}/.vnc" + VNCDIR="/home/${localuser}/.vnc" [ -d "$VNCDIR" ] || mkdir "$VNCDIR" echo " --connect $VNC_CONNECT " >> $VNCDIR/options fi