X-Git-Url: https://git.grml.org/?a=blobdiff_plain;ds=sidebyside;f=autoconfig.functions;h=7af51eb6b0a0edfbce9180b5b386ffb1550691e4;hb=cd5f482d90486c624d2dcf33fcf413dd1697fc51;hp=7af72a231900ecd392b440cc8ff682b3a8fb2b70;hpb=b934d28953c11d52b45a6d4165dd9dfa565920af;p=grml-autoconfig.git diff --git a/autoconfig.functions b/autoconfig.functions index 7af72a2..7af51eb 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -49,7 +49,7 @@ stringinstring(){ # Reread boot command line; echo last parameter's argument or return false. getbootparam(){ stringinstring " $1=" "$CMDLINE" || return 1 - result="${CMDLINE##*$1=}" + result="${CMDLINE##* $1=}" result="${result%%[ ]*}" echo "$result" return 0 @@ -204,12 +204,16 @@ config_language(){ # set default to 'en' in live-cd mode if $LANGUAGE is not yet set: if [ -z "$INSTALLED" ] ; then - [ -n "$LANGUAGE" ] || LANGUAGE='en-utf8' + [ -n "$LANGUAGE" ] || LANGUAGE='us' fi # if bootoption lang is used update /etc/default/locale, otherwise *not*! - if [ -n "$BOOT_LANGUAGE" ] ; then - [ -x /usr/sbin/grml-setlang ] && /usr/sbin/grml-setlang "$LANGUAGE" + if [ -n "$BOOT_LANGUAGE" -a -x /usr/sbin/grml-setlang ] ; then + if checkgrmlsmall ; then + /usr/sbin/grml-setlang "POSIX" + else + /usr/sbin/grml-setlang "$LANGUAGE" + fi fi # set console font @@ -356,26 +360,29 @@ config_userfstab(){ config_time(){ # don't touch the files if running from harddisk: if [ -z "$INSTALLED" ]; then - UTC="" + # The default hardware clock timezone is stated as representing local time. + UTC="--localtime" checkbootparam utc >>$DEBUG 2>&1 && UTC="-u" checkbootparam gmt >>$DEBUG 2>&1 && UTC="-u" # hwclock uses the TZ variable - [ -r /etc/timezone ] && TZ=$(cat /etc/timezone) - [ -n "$TZ" ] || TZ=Europe/Vienna + KTZ="$(getbootparam tz 2>>$DEBUG)" + [ -z "$KTZ" ] && [ -r /etc/timezone ] && KTZ=$(cat /etc/timezone) + [ -z "$KTZ" ] && KTZ=Europe/Vienna if ! [ -r /dev/rtc ] ; then - ewarn "Realtime clock not available, skipping execution of hwclock therefore." ; eend 0 - else - ERROR=$(TZ="$TZ" hwclock $UTC -s 2>&1 | head -1) ; RC=$? - if [ -n "$ERROR" ] ; then - eindent - ERROR=$(TZ="$TZ" hwclock $UTC -s --directisa 2>&1 | head -1) - if [ -n "$ERROR" ] ; then - eerror "Problem running hwclock: $ERROR" ; eend 1 - fi - eoutdent - fi + ewarn "Warning: realtime clock not available, trying to execute hwclock anyway." ; eend 0 fi + + ERROR=$(TZ="$TZ" hwclock $UTC -s 2>&1 | head -1) ; RC=$? + if [ -n "$ERROR" ] ; then + eindent + ERROR=$(TZ="$TZ" hwclock $UTC -s --directisa 2>&1 | head -1) + if [ -n "$ERROR" ] ; then + eerror "Problem running hwclock: $ERROR" ; eend 1 + fi + eoutdent + fi + fi } # }}} @@ -826,7 +833,7 @@ config_swspeak(){ if checkbootparam swspeak ; then einfo "Bootoption swspeak found." - if [ ! -d /proc/speakup/ ] && ! grep -q speakup /proc/modules ; then + if [ ! -d /proc/speakup/ ] && ! grep -q speakup_soft /proc/modules ; then ewarn "Kernel does not support software speakup - trying to load kernel module:" ; eend 0 eindent einfo "Loading speakup_soft" @@ -840,27 +847,11 @@ config_swspeak(){ eoutdent fi - if [ -d /proc/speakup/ ] || grep -q speakup /proc/modules ; then + if [ -d /proc/speakup/ ] || grep -q speakup_soft /proc/modules ; then einfo "Kernel supports speakup." ; eend 0 eindent - if [ -x /etc/init.d/speech-dispatcher ] ; then - einfo "Starting speech-dispatcher." - /etc/init.d/speech-dispatcher start 1>>DEBUG ; eend $? - if [ -r /proc/speakup/synth_name ] ; then - einfo "Activating sftsyn via /proc in Kernel." - echo sftsyn > /proc/speakup/synth_name ; eend $? - elif [ -r /sys/modules/speakup/parameters/synth ] ; then - einfo "Activating sftsyn via /sys in Kernel." - echo sftsyn > /sys/modules/speakup/parameters/synth ; eend $? - else - eerror "Error when configuring sftsyn via /proc or /sys." ; eend 1 - fi einfo "Just run swspeak if you want to use software synthesizer via speakup." flitewrapper "Finished activating software speakup. Just run swspeak when booting finished." - else - eerror "speech-dispatcher not available. swspeak will not work without it." ; eend 1 - flitewrapper "speech-dispatcher not available. speakup will not work without it." - fi eoutdent else eerror "Kernel does not seem to support speakup. Skipping swspeak." ; eend 1 @@ -2331,6 +2322,47 @@ fi } # }}} +# {{{ tohd= bootoption +config_tohd() +{ + if checkbootparam "tohd" ; then + local TARGET="$(getbootparam 'tohd' 2>>$DEBUG)" + if [ -z "$TARGET" ] ; then + eerror "Error: tohd specified without any partition, can not continue." ; eend 1 + eerror "Please use something like tohd=/dev/sda9." ; eend 1 + return 1 + fi + + if ! [ -b "$TARGET" ] ; then + eerror "Error: $TARGET is not a valid block device, sorry." ; eend 1 + return 1 + fi + + if grep -q $TARGET /proc/mounts ; then + eerror "$TARGET already mounted, skipping execution of tohd therefore." + eend 1 + return 1 + fi + + local MOUNTDIR=$(mktemp -d) + + if mount -o rw "$TARGET" "$MOUNTDIR" ; then + einfo "Copyring live system to $TARGET - this might take a while" + rsync -a --progress /live/image/live $MOUNTDIR + sync + umount "$MOUNTDIR" + eend $? + einfo "Booting with \"grml bootfrom=$TARGET\" should work now." ; eend 0 + else + eerror "Error when trying to mount $TARGET, sorry."; eend 1 + return 1 + fi + + rmdir "$MOUNTDIR" + fi +} +# }}} + # {{{ grml2hd: automatic installation config_grml2hd(){