From: LaMont Jones Date: Thu, 9 Aug 2007 19:49:24 +0000 (-0600) Subject: hwclock.sh: only report hwclock updated if we did that. Closes: #436873 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8870fd94f231845e6413eaf6b90402c3a086384c;p=util-linux hwclock.sh: only report hwclock updated if we did that. Closes: #436873 Signed-off-by: LaMont Jones --- diff --git a/debian/hwclock.sh b/debian/hwclock.sh index 279f7185..e390f229 100644 --- a/debian/hwclock.sh +++ b/debian/hwclock.sh @@ -109,8 +109,9 @@ hwclocksh() if [ "$GMT" = "-u" ]; then GMT="--utc" fi - /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR - verbose_log_action_msg "Hardware Clock updated to `date`" + if /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR; then + verbose_log_action_msg "Hardware Clock updated to `date`" + fi else verbose_log_action_msg "Not saving System Clock" fi diff --git a/debian/hwclockfirst.sh b/debian/hwclockfirst.sh deleted file mode 100644 index 1923e2b0..00000000 --- a/debian/hwclockfirst.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/bash -# hwclockfirst.sh Set system clock to hardware clock, according to the UTC -# setting in /etc/default/rcS (see also rcS(5)). -# -# -# WARNING: Runs without write permission on /etc, and before -# mounting all filesystems! If you need write permission -# to do something, do it in hwclock.sh. -# -# WARNING: If your hardware clock is not in UTC/GMT, this script -# must know the local time zone. This information is -# stored in /etc/localtime. This might be a problem if -# your /etc/localtime is a symlink to something in -# /usr/share/zoneinfo AND /usr isn't in the root -# partition! The workaround is to define TZ either -# in /etc/default/rcS, or in the proper place below. -# -# REMEMBER TO EDIT hwclock.sh AS WELL! - -# Set this to any options you might need to give to hwclock, such -# as machine hardware clock type for Alphas. -HWCLOCKPARS= - -[ ! -x /sbin/hwclock ] && exit 0 - -. /etc/default/rcS - -# Define TZ to the desired timezone here if you need it. -# see tzset(3) for how to define TZ. -# WARNING: TZ takes precedence over /etc/localtime ! -TZ= - - -case "$UTC" in - no|"") GMT="--localtime" - UTC="" - if [ ! -r /etc/localtime ] - then - if [ -z "$TZ" ] - then - echo "$0: System clock was not updated at this time." >&2 - exit 1 - fi - fi - ;; - yes) GMT="--utc" - UTC="--utc" - ;; - *) echo "$0: Unknown UTC setting: \"$UTC\"" >&2 - exit 1 - ;; -esac - - -case "$1" in - start) - # Copies Hardware Clock time to System Clock using the correct - # timezone for hardware clocks in local time, and sets kernel - # timezone. DO NOT REMOVE. - if [ "$HWCLOCKACCESS" != no ] - then - /sbin/hwclock --hctosys $GMT $BADYEAR - fi - if [ "$VERBOSE" != no ] - then - echo "System time was `date --utc`." - echo "Setting the System Clock using the Hardware Clock as reference..." - fi - - # Copies Hardware Clock time to System Clock using the correct - # timezone for hardware clocks in local time, and sets kernel - # timezone. DO NOT REMOVE. - if [ -z "$TZ" ] - then - /sbin/hwclock --noadjfile --hctosys $GMT $HWCLOCKPARS - else - TZ="$TZ" /sbin/hwclock --noadjfile --hctosys $GMT $HWCLOCKPARS - fi - - if /sbin/hwclock --show $GMT $HWCLOCKPARS 2>&1 > /dev/null | grep -q '^The Hardware Clock registers contain values that are either invalid'; then - echo "Invalid system date -- setting to 1/1/2002" - /sbin/hwclock --set --date '1/1/2002 00:00:00' $GMT $HWCLOCKPARS - fi - - if [ "$VERBOSE" != no ] - then - echo "System Clock set. System local time is now `date $UTC`." - fi - ;; - stop|restart|reload|force-reload) - # Does nothing - exit 0 - ;; - *) - echo "Usage: hwclockfirst.sh {start|stop|reload|restart}" >&2 - echo " start sets kernel (system) clock from hardware (RTC) clock" >&2 - echo " stop, restart, reload and force-reload do nothing." >&2 - echo " Refer to hwclock.sh as well." >&2 - exit 1 - ;; -esac -