From 41b8e8b66bfeb2a6bb851355ea141d7064eddb10 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Thu, 23 Aug 2012 11:22:53 +0200 Subject: add some deprecation warnings As we are moving to systemd, alert initscripts users in case they use the legacy configuration options. The legacy options will still work in initscripts, but eventually will not work with systemd. In other words, most users will want to switch to the new settings. Signed-off-by: Tom Gundersen --- rc.sysinit | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'rc.sysinit') diff --git a/rc.sysinit b/rc.sysinit index eb49e2b..b285cc7 100755 --- a/rc.sysinit +++ b/rc.sysinit @@ -35,12 +35,28 @@ bootlogd -p /run/bootlogd.pid run_hook sysinit_start HWCLOCK_PARAMS="--systz" -case $HARDWARECLOCK in - "") ;; - UTC) HWCLOCK_PARAMS+=" --utc --noadjfile";; - localtime) HWCLOCK_PARAMS+=" --localtime --noadjfile";; - *) HWCLOCK_PARAMS="";; -esac + +if [[ $HARDWARECLOCK ]]; then + print_depr "HARDWARECLOCK=" "rc.conf(5) and hwclock(8)" + + [[ -f /etc/adjtime ]] && { read ; read ; read ADJTIME; } < /etc/adjtime + + if [[ $ADJTIME == 'LOCAL' ]]; then + if [[ $HARDWARECLOCK == 'UTC' ]]; then + printf "${C_FAIL}/etc/rc.conf says the RTC is in UTC, but /etc/adjtime says it is in localtime.\n${C_OTHER}." + fi + else + if [[ $HARDWARECLOCK == 'LOCALTIME' ]]; then + printf "${C_FAIL}/etc/rc.conf says the RTC is in localtime, but hwclock (/etc/adjtime) thinks it is in UTC.\n${C_OTHER}." + fi + fi + + case $HARDWARECLOCK in + UTC) HWCLOCK_PARAMS+=" --utc --noadjfile";; + localtime) HWCLOCK_PARAMS+=" --localtime --noadjfile";; + *) HWCLOCK_PARAMS="";; + esac +fi if [[ $HWCLOCK_PARAMS ]]; then stat_busy "Adjusting system time and setting kernel time zone" @@ -48,11 +64,11 @@ if [[ $HWCLOCK_PARAMS ]]; then # Adjust the system time for time zone offset if rtc is not in UTC, as # filesystem checks can depend on system time. This also sets the kernel # time zone, used by e.g. vfat. - # If TIMEZONE is not set in rc.conf, the time zone stored in /etc/localtime - # is used. If HARDWARECLOCK is not set in rc.conf, the value in - # /etc/adjfile is used. - [[ $TIMEZONE ]] && export TZ=$TIMEZONE + if [[ $TIMEZONE ]]; then + print_depr "TIMEZONE=" "rc.conf(5)" + export TZ=$TIMEZONE + fi hwclock $HWCLOCK_PARAMS && stat_done || stat_fail @@ -121,6 +137,9 @@ status 'Initializing random seed' /usr/lib/systemd/systemd-random-seed load # Remove leftover files remove_leftover +if [[ $HOSTNAME ]]; then + print_depr "HOSTNAME=" "rc.conf(5) and hostname(5)" +fi if [[ -s /etc/hostname ]]; then HOSTNAME=$(< /etc/hostname) fi @@ -138,20 +157,6 @@ stat_busy "Saving dmesg log" fi (( $? == 0 )) && stat_done || stat_fail -if [[ -f /etc/adjtime ]]; then - { read ; read ; read ADJTIME; } < /etc/adjtime - - if [[ $ADJTIME == 'LOCAL' ]]; then - if [[ $HARDWARECLOCK == 'UTC' ]]; then - printf "${C_FAIL}/etc/rc.conf says the RTC is in UTC, but /etc/adjtime says it is in localtime.\n${C_OTHER}." - fi - else - if [[ $HARDWARECLOCK == 'LOCALTIME' ]]; then - printf "${C_FAIL}/etc/rc.conf says the RTC is in localtime, but hwclock (/etc/adjtime) thinks it is in UTC.\n${C_OTHER}." - fi - fi -fi - run_hook sysinit_end # End of file -- cgit v1.2.3