X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=d518584d40fafe39f8aa97ad772e981d4f5c624f;hp=735ba001d68c553f6697f9fd1d82e5a154d22c8a;hb=62f3f8f4f218e18606edfd73bf3ddbfe1d8a43fb;hpb=21b7f0ed53a93938f0d5a474e3e82bbc8c2b1976 diff --git a/autoconfig.functions b/autoconfig.functions index 735ba00..d518584 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -454,11 +454,21 @@ config_time(){ if [ -z "$INSTALLED" ]; then # The default hardware clock timezone is stated as representing local time. UTC="--localtime" - grep -q "^UTC=" /etc/default/rcS || echo "UTC=no" >> /etc/default/rcS - checkbootparam 'utc' >>$DEBUG 2>&1 && sed -i "s|^UTC=.*$|UTC=yes|" /etc/default/rcS - checkbootparam 'gmt' >>$DEBUG 2>&1 && sed -i "s|^UTC=.*$|UTC=yes|" /etc/default/rcS - checkbootparam 'localtime' >>$DEBUG 2>&1 && sed -i "s|^UTC=.*$|UTC=no|" /etc/default/rcS - grep -q -i "^UTC=yes" /etc/default/rcS && UTC="-u" + + if [ -f /etc/default/rcS ] ; then + grep -q "^UTC=" /etc/default/rcS || echo "UTC=no" >> /etc/default/rcS + checkbootparam 'utc' >>$DEBUG 2>&1 && sed -i "s|^UTC=.*$|UTC=yes|" /etc/default/rcS + checkbootparam 'gmt' >>$DEBUG 2>&1 && sed -i "s|^UTC=.*$|UTC=yes|" /etc/default/rcS + checkbootparam 'localtime' >>$DEBUG 2>&1 && sed -i "s|^UTC=.*$|UTC=no|" /etc/default/rcS + grep -q -i "^UTC=yes" /etc/default/rcS && UTC="-u" + # recent initscripts package versions don't ship /etc/default/rcS anymore, instead rely on /etc/adjtime + elif [ -f /etc/adjtime ] ; then + checkbootparam 'utc' >>$DEBUG 2>&1 && sed -i "s/^LOCAL/UTC/" /etc/adjtime + checkbootparam 'gmt' >>$DEBUG 2>&1 && sed -i "s/^LOCAL/UTC/" /etc/adjtime + checkbootparam 'localtime' >>$DEBUG 2>&1 && sed -i "s/^UTC$/LOCAL/" /etc/adjtime + grep -q "^UTC$" /etc/adjtime && UTC="-u" + fi + # hwclock uses the TZ variable KTZ="$(getbootparam 'tz' 2>>$DEBUG)" [ -z "$KTZ" ] && [ -r /etc/timezone ] && KTZ=$(cat /etc/timezone)