From a46a3adbbd2278a33eee74bba700795e0db6bc13 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 18 Feb 2009 14:38:46 +0000 Subject: [PATCH] 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. --- debian/hwclock.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 ;; *) -- 2.39.5