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 --- functions | 7 ++++++- network | 4 +--- rc.sysinit | 53 +++++++++++++++++++++++++++++------------------------ 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/functions b/functions index 66e2242..ee7581b 100644 --- a/functions +++ b/functions @@ -137,6 +137,10 @@ deltext() { printf "${DEL_TEXT}" } +print_depr() { + printf "${C_FAIL} ${1} is deprecated. See ${2} for details.${C_CLEAR} \n" +} + printhl() { printf "${C_OTHER}${PREFIX_HL} ${C_H1}${1}${C_CLEAR} \n" } @@ -367,6 +371,7 @@ load_modules() { local rc=0 if [[ $MODULES ]]; then + print_depr "MODULES=" "rc.conf(5) and modules-load.d(5)" /usr/lib/systemd/arch-modules-load rc=$? fi @@ -414,7 +419,7 @@ do_unlock_legacy() { # $2 = source device # $3 = password # $4 = options - printf "${C_FAIL}Using legacy crypttab format. This will stop working in the future. See crypttab(5).${C_CLEAR}\n" + print_depr "The legacy crypttab format" "crypttab(5)" local open=create a=$1 b=$2 failed=0 # Ordering of options is different if you are using LUKS vs. not. # Use ugly swizzling to deal with it. diff --git a/network b/network index b8b6989..de6e9b4 100755 --- a/network +++ b/network @@ -18,9 +18,7 @@ need_legacy() { } deprecated() { - printf "${C_FAIL}Warning:${C_CLEAR} Your network settings are deprecated.\n" - printf " Please refer to 'man 5 rc.conf' on how to define a single wired\n" - printf " connection, or use a utility such as netcfg.\n" + print_depr "The legacy network settings format" "rc.conf(5)" } network_up() { 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