Some updates in config_time()
authorMichael Prokop <mika@grml.org>
Tue, 18 Nov 2008 23:25:40 +0000 (00:25 +0100)
committerMichael Prokop <mika@grml.org>
Tue, 18 Nov 2008 23:25:40 +0000 (00:25 +0100)
autoconfig.functions
debian/changelog

index 28b7854..a9aeca8 100755 (executable)
@@ -360,26 +360,29 @@ config_userfstab(){
 config_time(){
  # don't touch the files if running from harddisk:
  if [ -z "$INSTALLED" ]; then
 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
     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
 
     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
     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
 }
 # }}}
  fi
 }
 # }}}
index 1c6d9d6..08d6bb2 100644 (file)
@@ -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 <mika@grml.org>  Wed, 19 Nov 2008 00:23:55 +0100
+
 grml-autoconfig (0.8.16) unstable; urgency=low
 
   * Support tohd=... bootoption.
 grml-autoconfig (0.8.16) unstable; urgency=low
 
   * Support tohd=... bootoption.