From: Michael Prokop Date: Tue, 18 Nov 2008 23:25:40 +0000 (+0100) Subject: Some updates in config_time() X-Git-Tag: v0.8.17~3 X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=commitdiff_plain;h=557d36bf847cfdd7208cde5b577dcea8578a876c Some updates in config_time() --- 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 } # }}} diff --git a/debian/changelog b/debian/changelog index 1c6d9d6..08d6bb2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +grml-autoconfig (0.8.17) unstable; urgency=low + + * Some updates in config_time(), thanks to Thomas Lehmann: + - use UTC="--localtime" by default + - evaluate tz bootoption in this function as well + - execute hwclock even if /dev/rtc isn't available, just display + warning regarding the lack of /dev/rtc + + -- Michael Prokop Wed, 19 Nov 2008 00:23:55 +0100 + grml-autoconfig (0.8.16) unstable; urgency=low * Support tohd=... bootoption.