From 4c94aac0103471c3156be2e2cfd88b2441fdcd2d Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Sun, 25 Mar 2007 12:33:21 +0200 Subject: [PATCH] config_time(): check for existing /dev/rtc, display only first line of error message if running hwclock fails --- autoconfig.functions | 40 +++++++++++++++++++++------------------- debian/changelog | 7 +++++++ 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/autoconfig.functions b/autoconfig.functions index 1e6798a..cb9b1df 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -4,7 +4,7 @@ # Authors: grml-team (grml.org), (c) Klaus Knopper , (c) Michael Prokop # 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 } # }}} diff --git a/debian/changelog b/debian/changelog index 96e0f1e..17265e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sun, 25 Mar 2007 12:32:45 +0200 + grml-autoconfig (0.6.21) unstable; urgency=low * Add locales to Recommends. -- 2.1.4