]> err.no Git - util-linux/commitdiff
hwclock.sh: only report hwclock updated if we did that. Closes: #436873
authorLaMont Jones <lamont@mmjgroup.com>
Thu, 9 Aug 2007 19:49:24 +0000 (13:49 -0600)
committerLaMont Jones <lamont@mmjgroup.com>
Thu, 9 Aug 2007 19:49:24 +0000 (13:49 -0600)
Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
debian/hwclock.sh
debian/hwclockfirst.sh [deleted file]

index 279f7185a346c17772cb00ed76e27b4d4fd30233..e390f229c5944d490faaeffe6bdfc421863226dd 100644 (file)
@@ -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 (file)
index 1923e2b..0000000
+++ /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
-