X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=debf31f368f3cf0682dcc56320e7a532b112ade4;hp=8197d4bd7c74ee4d50667e9c676a9d42b722e08d;hb=43634527f99d0f53449c3cb1b5d59b5bf195c74f;hpb=f0ddca030902a77aeb560dd32c3e92f6cfb50d79 diff --git a/autoconfig.functions b/autoconfig.functions index 8197d4b..debf31f 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Klaus Knopper , (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Mon Jun 09 17:05:42 CEST 2008 [mika] +# Latest change: Fre Aug 15 23:06:21 CEST 2008 [mika] ################################################################################ # {{{ path, variables, signals, umask, zsh @@ -1242,10 +1242,12 @@ if checkbootparam "nocpu"; then else # check module dependencies cpufreq_check() { - if [ -e /lib64 ] ; then - [ -e /lib/modules/${KERNEL}/kernel/arch/x86_64/kernel/cpufreq ] || return 1 - else - [ -e /lib/modules/${KERNEL}/kernel/arch/i386/kernel/cpu/cpufreq -o ! -e /lib/modules/${KERNEL}/kernel/drivers/cpufreq ] || return 1 + if ! [ -e /lib/modules/${KERNEL}/kernel/arch/x86/kernel/cpu/cpufreq ] ; then + if [ -e /lib64 ] ; then + [ -e /lib/modules/${KERNEL}/kernel/arch/x86_64/kernel/cpufreq ] || return 1 + else + [ -e /lib/modules/${KERNEL}/kernel/arch/i386/kernel/cpu/cpufreq -o ! -e /lib/modules/${KERNEL}/kernel/drivers/cpufreq ] || return 1 + fi fi } @@ -1339,20 +1341,42 @@ fi # checkbootparam nocpu # {{{ autostart of ssh config_ssh(){ if checkbootparam ssh ; then - SSH_PASSWD="$(getbootparam 'ssh' 2>>$DEBUG)" - einfo "Bootoption passwd found." - if [ -n "$SSH_PASSWD" ] ; then - echo "grml:$SSH_PASSWD" | chpasswd -m - einfo "Starting secure shell server in background." - /etc/init.d/rmnologin start 1>>$DEBUG 2>>$DEBUG - /etc/init.d/ssh start 1>>$DEBUG 2>>$DEBUG & - eend 0 - else - eerror "No given password for ssh found. Autostart of SSH will not work." ; eend 1 - fi - eindent - ewarn "Warning: please change the password for user grml set via bootparameter as soon as possible!" - eoutdent + SSH_PASSWD='' + SSH_PASSWD="$(getbootparam 'ssh' 2>>$DEBUG)" + einfo "Bootoption ssh found, trying to set password for user grml." + eindent + if [ -z "$SSH_PASSWD" ] ; then + if [ -x /usr/bin/pwgen ] ; then + SSH_PASSWD="$(pwgen -1 8)" + elif [ -x /usr/bin/hexdump ] ; then + SSH_PASSWD="$(dd if=/dev/urandom bs=14 count=1 2>/dev/null | hexdump | awk '{print $3 $4}')" + elif [ -n "$RANDOM" ] ; then + SSH_PASSWD="grml${RANDOM}" + else + SSH_PASSWD='' + eerror "Empty passphrase and neither pwgen nor hexdump nor \$RANDOM found. Skipping." + eend 1 + fi + + if [ -n "$SSH_PASSWD" ] ; then + ewarn "No given password for ssh found. Using random password: $SSH_PASSWD" ; eend 0 + fi + fi + eoutdent + + # finally check if we have a password we can use: + if [ -n "$SSH_PASSWD" ] ; then + echo "grml:$SSH_PASSWD" | chpasswd -m + fi + + einfo 'Starting secure shell server in background.' + /etc/init.d/rmnologin start 1>>$DEBUG 2>>$DEBUG + /etc/init.d/ssh start 1>>$DEBUG 2>>$DEBUG & + eend $? + + eindent + ewarn 'Warning: please change the password for user grml as soon as possible!' + eoutdent fi } # }}} @@ -1639,10 +1663,14 @@ config_gpm(){ if checkbootparam "nogpm"; then ewarn "Not starting GPM as requested on boot commandline." ; eend 0 else - einfo "Starting gpm in background." -# /etc/init.d/gpm start 1>>$DEBUG & - ( while [ ! -e /dev/psaux ]; do sleep 5; done; /etc/init.d/gpm start 1>>$DEBUG ) & - eend 0 + if ! [ -r /dev/input/mice ] ; then + eerror "No mouse found - not starting GPM." ; eend 1 + else + einfo "Starting gpm in background." + /etc/init.d/gpm start 1>>$DEBUG & + # ( while [ ! -e /dev/psaux ]; do sleep 5; done; /etc/init.d/gpm start 1>>$DEBUG ) & + eend 0 + fi fi } # }}} @@ -1784,13 +1812,13 @@ if checkbootparam noautoconfig || checkbootparam forensic ; then ewarn "Skipping running automount of device(s) labeled GRMLCFG as requested." ; eend 0 else if [ -z "$INSTALLED" ] ; then - einfo "Searching for device(s) labeled with GRMLCFG." ; eend 0 + einfo "Searching for device(s) labeled with GRMLCFG. (Disable this via boot option: noautoconfig)" ; eend 0 eindent [ -d /mnt/grml ] || mkdir /mnt/grml umount /mnt/grml 1>>$DEBUG 2>&1 # make sure it is not mounted # We do need the following fix so floppy disk is available to blkid in any case :-/ if [ -r /dev/fd0 ] ; then - einfo "Floppy device detected. Trying to access floppy disk. (Disable this via boot option: noautoconfig)" + einfo "Floppy device detected. Trying to access floppy disk." # dd if=/dev/fd0 of=/dev/null bs=512 count=1 1>>$DEBUG 2>&1 if timeout 4 dd if=/dev/fd0 of=/dev/null bs=512 count=1 1>>$DEBUG 2>&1 ; then blkid /dev/fd0 1>>$DEBUG 2>&1