]> err.no Git - util-linux/commitdiff
hwclock: pass --noadjfile if /etc/adjtime not writable
authorScott James Remnant <scott@ubuntu.com>
Wed, 18 Feb 2009 14:38:46 +0000 (14:38 +0000)
committerLaMont Jones <lamont@debian.org>
Tue, 5 May 2009 00:19:29 +0000 (18:19 -0600)
This wasn't quite consistent; while --noadjfile would be passed on
setting the system clock, it wasn't passed when setting the hardware
clock or when showing the current value - so could result in it being
updated.

debian/hwclock.sh

index 7f53ae0f15ed4d701702055167289967e091e5f2..7c56fc71a3cae27bbbc07439be42a3a1ed1977d7 100644 (file)
@@ -122,12 +122,18 @@ hwclocksh()
            # WARNING: If you disable this, any changes to the system
            #          clock will not be carried across reboots.
            #
+           if [ ! -w /etc/adjtime ]; then
+               NOADJ="--noadjfile"
+           else
+               NOADJ=""
+           fi
+
            if [ "$HWCLOCKACCESS" != no ]; then
                log_action_msg "Saving the system clock"
                if [ "$GMT" = "-u" ]; then
                    GMT="--utc"
                fi
-               if /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR; then
+               if /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
                    verbose_log_action_msg "Hardware Clock updated to `date`"
                fi
            else
@@ -135,8 +141,14 @@ hwclocksh()
            fi
            ;;
        show)
+           if [ ! -w /etc/adjtime ]; then
+               NOADJ="--noadjfile"
+           else
+               NOADJ=""
+           fi
+
            if [ "$HWCLOCKACCESS" != no ]; then
-               /sbin/hwclock --show $GMT $HWCLOCKPARS $BADYEAR
+               /sbin/hwclock --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ
            fi
            ;;
        *)