X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=a9aeca8f965216fc2cd1b9d093f10a5d1d43048a;hp=28b785449f7f01146c21b595e6f4f18012b83ed8;hb=557d36bf847cfdd7208cde5b577dcea8578a876c;hpb=37eee4a042ff38046cb7594420a03af5067efa8d diff --git a/autoconfig.functions b/autoconfig.functions index 28b7854..a9aeca8 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -360,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 } # }}}