From: Scott James Remnant Date: Wed, 18 Feb 2009 14:38:46 +0000 (+0000) Subject: hwclock: pass --noadjfile if /etc/adjtime not writable X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a46a3adbbd2278a33eee74bba700795e0db6bc13;p=util-linux hwclock: pass --noadjfile if /etc/adjtime not writable 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. --- diff --git a/debian/hwclock.sh b/debian/hwclock.sh index 7f53ae0f..7c56fc71 100644 --- a/debian/hwclock.sh +++ b/debian/hwclock.sh @@ -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 ;; *)