Switch UTC setting from /etc/default/rcS to /etc/adjtime
authorMichael Prokop <mika@grml.org>
Fri, 21 Oct 2016 11:39:31 +0000 (13:39 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 13 Jan 2017 14:04:29 +0000 (15:04 +0100)
/etc/default/rcS doesn't necessarily exist anymore in Debian
stretch or newer, So use the UTC/LOCAL setting in /etc/adjtime
rather than the UTC setting in /etc/default/rcS.

Thanks: Darshaka Pathirana

etc/grml/fai/config/scripts/GRMLBASE/18-timesetup

index 21b5084..da40243 100755 (executable)
@@ -10,10 +10,10 @@ set -u
 set -e
 
 # tell if hwclock is running in UTC or local time
-# by default it's set to UTC=yes, we usually want UTC=no
-if [ -n "$UTC" ] ; then
-   echo "Setting hwclock parameter UTC to $UTC"
-   sed -i "s|^UTC=.*$|UTC="$UTC"|" $target/etc/default/rcS
+# by default it's set to UTC=no
+if [ -n "$UTC" ] && [ "$UTC" = "yes" ] ; then
+   echo "UTC is set to 'yes', setting hwclock parameter UTC"
+   sed -i "s/^LOCAL/UTC/" "${target}/etc/adjtime"
 fi
 
 # default timezone settings