config_time(): check for existing /dev/rtc, display only first line of error message... 0.6.22
authorMichael Prokop <mika@grml.org>
Sun, 25 Mar 2007 10:33:21 +0000 (12:33 +0200)
committerMichael Prokop <mika@grml.org>
Sun, 25 Mar 2007 10:33:21 +0000 (12:33 +0200)
autoconfig.functions
debian/changelog

index 1e6798a..cb9b1df 100755 (executable)
@@ -4,7 +4,7 @@
 # Authors:       grml-team (grml.org), (c) Klaus Knopper <knopper@knopper.net>, (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Sam Mär 17 23:52:56 CET 2007 [mika]
+# Latest change: Son Mär 25 12:32:37 CEST 2007 [mika]
 ################################################################################
 
 # {{{ path, variables, signals, umask, zsh
@@ -338,24 +338,26 @@ config_userfstab(){
 config_time(){
  # don't touch the files if running from harddisk:
  if [ -z "$INSTALLED" ]; then
-  UTC=""
-  checkbootparam utc >>$DEBUG 2>&1 && UTC="-u"
-  checkbootparam gmt >>$DEBUG 2>&1 && UTC="-u"
-  # hwclock uses the TZ variable
-  if [ -r /etc/default/locale ] ; then
-     . /etc/default/locale
-  else
-     TZ=Europe/Vienna
-  fi
-  ERROR=$(TZ="$TZ" hwclock $UTC -s 2>&1) ; RC=$?
-  if [ -n "$ERROR" ] ; then
-     eindent
-     ERROR=$(TZ="$TZ" hwclock $UTC -s --directisa 2>&1)
-     if [ -n "$ERROR" ] ; then
-        eerror "Problem running hwclock: $ERROR" ; eend 1
-     fi
-     eoutdent
-  fi
+    UTC=""
+    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
+  
+    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
+    fi
  fi
 }
 # }}}
index 96e0f1e..17265e0 100644 (file)
@@ -1,3 +1,10 @@
+grml-autoconfig (0.6.22) unstable; urgency=low
+
+  * config_time(): check for existing /dev/rtc, display only
+    first line of error message if running hwclock fails.
+
+ -- Michael Prokop <mika@grml.org>  Sun, 25 Mar 2007 12:32:45 +0200
+
 grml-autoconfig (0.6.21) unstable; urgency=low
 
   * Add locales to Recommends.