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 From b603bf95b18c60fba4d6aa3ad2cb597c197ca6b5 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sat, 11 Aug 2012 04:29:29 +0200 Subject: move archlinux(7) and locale.sh to filesystem The new locale.sh makes DAEMON_LOCALE redundant, so we remove that functionality. A post-upgrade notice will be added. The new functionality will apply the settings to /etc/locale.conf system-wide, and allow each user to override it in $HOME/.config/locale.conf. Signed-off-by: Tom Gundersen --- Makefile | 11 ++------ archlinux.7.txt | 80 ------------------------------------------------------ functions | 22 +++------------ locale.sh | 83 --------------------------------------------------------- rc.conf.5.txt | 13 +++------ 5 files changed, 8 insertions(+), 201 deletions(-) delete mode 100644 archlinux.7.txt delete mode 100644 locale.sh diff --git a/Makefile b/Makefile index ac307e2..2ef9703 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ DIRS := \ /etc/rc.d \ /etc/rc.d/functions.d \ /etc/logrotate.d \ - /etc/profile.d \ /usr/lib/tmpfiles.d \ /usr/lib/systemd/system-generators \ /usr/lib/systemd/system/multi-user.target.wants \ @@ -14,7 +13,6 @@ DIRS := \ /usr/share/bash-completion/completions \ /usr/share/zsh/site-functions \ /usr/share/man/man5 \ - /usr/share/man/man7 \ /usr/share/man/man8 all: doc @@ -28,10 +26,8 @@ install: installdirs doc install -m644 -t $(DESTDIR)/etc/logrotate.d bootlog install -m644 -t $(DESTDIR)/etc/rc.d functions install -m755 -t $(DESTDIR)/etc/rc.d hwclock network netfs - install -m755 -t $(DESTDIR)/etc/profile.d locale.sh install -m755 -t $(DESTDIR)/usr/sbin rc.d install -m644 -t $(DESTDIR)/usr/share/man/man5 rc.conf.5 - install -m644 -t $(DESTDIR)/usr/share/man/man7 archlinux.7 install -m644 -t $(DESTDIR)/usr/share/man/man8 rc.d.8 arch-modules-load.8 arch-daemons.8 install -m755 -t $(DESTDIR)/usr/lib/systemd/system-generators arch-daemons install -m755 -t $(DESTDIR)/usr/lib/systemd arch-modules-load @@ -47,16 +43,13 @@ install: installdirs doc %.5: %.5.txt a2x -d manpage -f manpage $< -%.7: %.7.txt - a2x -d manpage -f manpage $< - %.8: %.8.txt a2x -d manpage -f manpage $< -doc: rc.conf.5 archlinux.7 rc.d.8 arch-modules-load.8 arch-daemons.8 +doc: rc.conf.5 rc.d.8 arch-modules-load.8 arch-daemons.8 clean: - rm -f rc.conf.5 archlinux.7 rc.d.8 arch-modules-load.8 arch-daemons.8 + rm -f rc.conf.5 rc.d.8 arch-modules-load.8 arch-daemons.8 tar: git archive HEAD --prefix=initscripts-$(VER)/ | xz > initscripts-$(VER).tar.xz diff --git a/archlinux.7.txt b/archlinux.7.txt deleted file mode 100644 index 32517fb..0000000 --- a/archlinux.7.txt +++ /dev/null @@ -1,80 +0,0 @@ -///// -vim:set ts=4 sw=4 syntax=asciidoc noet: -///// -archlinux(7) -============ - -NAME ----- -archlinux - basic configuration - -SYNOPSIS --------- -Overview of the basic configuration of Arch Linux. - -DESCRIPTION ------------ -Arch Linux exposes the user to the system without hiding any details. This manpage gives a -brief overview of the configuration files that should be set up on a fresh install. - -INITSCRIPTS[[I]] ----------------- -The initscripts are configured in rc.conf. Here you configure what daemons to start on boot, what storage -technologies should be enabled and, optionally, a basic network setup. - -HOSTNAME[[H]] -------------- -The hostname of the machine should be set in /etc/hostname. Additionally, either /etc/hosts should be -configured accordingly, or nss-myhostname should be used. This is needed so the hostname can always -be resolved to the current machine, which is required by some programs. - -LOCALIZATION[[L]] ------------------ -Various locales may be enabled in /etc/locale.gen, and generated by locale-gen. The system-wide locale to be used -can be configured in /etc/locale.conf - -VIRTUAL CONSOLE[[V]] --------------------- -The virtual console is configured in /etc/vconsole.conf. It allows you to set a font and a keyboard layout, among -other things. Note that these settings only apply to the console, and not if you use X. - -TIME[[T]] ---------- -The local timezone is configured by *symlinking* /etc/localtime to the correct zoneinfo file under -/usr/share/zoneinfo/. E.g., - - /etc/localtime -> /usr/share/zoneinfo/Europe/Paris - -The real-time clock, which keeps track of time when the computer is off, can be configured to either -be in UTC or in localtime in /etc/adjtime. The default is UTC. - -FILESYSTEMS[[F]] ----------------- -Filesystems are configured in /etc/fstab, and encryption mappings are configured in /etc/crypttab. - -INITRAMFS[[R]] --------------- -The initramfs is generated by mkinitcpio, and can be configured in /etc/mkinitcpio.conf. - -PACKAGE MANAGER[[P]] --------------------- -The package manager, pacman, is configured in /etc/pacman.conf. - -BOOTLOADER[[B]] ---------------- -GRUB's configuration is generated from /etc/default/grub by grub-mkconfig. Syslinux is configured in /boot/syslinux/syslinux.cfg - -MODULES[[M]] ------------- -Most modules should be loaded on-demand. Modules to be unconditionally loaded at boot can be specified in /etc/modules-load.d/, -and modules to be blacklisted from auto-loading can be configured in /etc/modprobe.d/. - -SEE ALSO --------- - -rc.conf(5), hostname(5), hosts(5), nsswitch.conf(5), locale.conf(5), vconsole.conf(5), timezone(3), hwclock(8), fstab(5), crypttab(5), -mkinitcpio(8), pacman(8), pacman.conf(5), grub-mkconfig(8), syslinux(1), modules-load.d(5), modprobe.d(5) - -AUTHORS -------- -Written by Tom Gundersen. diff --git a/functions b/functions index e8ff7b8..448d2d1 100644 --- a/functions +++ b/functions @@ -5,11 +5,10 @@ # sanitize PATH (will be overridden later when /etc/profile is sourced but is useful for udev) export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" -localevars=(LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY - LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE - LC_MEASUREMENT LC_IDENTIFICATION LC_ALL) +# clear the TZ envvar, so daemons always respect /etc/localtime +unset TZ -vconsolevars=(KEYMAP KEYMAP_TOGGLE FONT FONT_MAP FONT_UNIMAP) +. /etc/profile.d/locale.sh if [[ $1 == "start" ]]; then if [[ $STARTING ]]; then @@ -66,12 +65,6 @@ if (( $? != 3 )); then fi unset TERM_COLORS -# clear the TZ envvar, so daemons always respect /etc/localtime -unset TZ - -# sanitize the locale settings -unset "${localevars[@]}" - parse_envfile() { local file=$1 validkeys=("${@:2}") ret=0 lineno=0 key= val= local -r quotes=$'[\'"]' comments=$'[;#]*' @@ -723,15 +716,6 @@ if (( RC_FUNCTIONS_HOOK_FUNCS_DEFINED != 1 )); then declare -r RC_FUNCTIONS_HOOK_FUNCS_DEFINED=1 fi -if [[ $DAEMON_LOCALE != [nN][oO] ]]; then - export LANG=${LOCALE:-C} - if [[ -r /etc/locale.conf ]]; then - parse_envfile /etc/locale.conf "${localevars[@]}" - fi -else - export LANG=C -fi - # set colors if [[ $USECOLOR != [nN][oO] ]]; then if tput setaf 0 &>/dev/null; then diff --git a/locale.sh b/locale.sh deleted file mode 100644 index c465f6f..0000000 --- a/locale.sh +++ /dev/null @@ -1,83 +0,0 @@ -unset LANG - -if [ -s /etc/locale.conf ]; then - . /etc/locale.conf -fi - -if [ -z "$LANG" ] && [ -s /etc/rc.conf ]; then - LANG=$(. /etc/rc.conf 2>/dev/null; echo "$LOCALE") -fi - -export LANG=${LANG:-C} - -if [ -n "$LC_CTYPE" ]; then - export LC_CTYPE -else - unset LC_CTYPE -fi - -if [ -n "$LC_NUMERIC" ]; then - export LC_NUMERIC -else - unset LC_NUMERIC -fi - -if [ -n "$LC_TIME" ]; then - export LC_TIME -else - unset LC_TIME -fi - -if [ -n "$LC_COLLATE" ]; then - export LC_COLLATE -else - unset LC_COLLATE -fi - -if [ -n "$LC_MONETARY" ]; then - export LC_MONETARY -else - unset LC_MONETARY -fi - -if [ -n "$LC_MESSAGES" ]; then - export LC_MESSAGES -else - unset LC_MESSAGES -fi - -if [ -n "$LC_PAPER" ]; then - export LC_PAPER -else - unset LC_PAPER -fi - -if [ -n "$LC_NAME" ]; then - export LC_NAME -else - unset LC_NAME -fi - -if [ -n "$LC_ADDRESS" ]; then - export LC_ADDRESS -else - unset LC_ADDRESS -fi - -if [ -n "$LC_TELEPHONE" ]; then - export LC_TELEPHONE -else - unset LC_TELEPHONE -fi - -if [ -n "$LC_MEASUREMENT" ]; then - export LC_MEASUREMENT -else - unset LC_MEASUREMENT -fi - -if [ -n "$LC_IDENTIFICATION" ]; then - export LC_IDENTIFICATION -else - unset LC_IDENTIFICATION -fi diff --git a/rc.conf.5.txt b/rc.conf.5.txt index 73c2423..8983871 100644 --- a/rc.conf.5.txt +++ b/rc.conf.5.txt @@ -190,21 +190,14 @@ FONT_MAP in /etc/vconsole.conf takes precedence (see vconsole.conf(5)), and is r This sets your system language, which will be used by all i18n-friendly applications and utilities. See `locale -a` (or locale.gen) for available options. -LANG in /etc/locale.conf takes precedence (see locale.conf(5)), and is recommended. +LANG in /etc/locale.conf takes precedence (see locale.conf(5)), and is recommended. User-specific +locale settings which override both /etc/locale.conf and /etc/rc.conf are set in +$XDG_CONFIG_HOME/locale.conf using the same syntax as /etc/locale.conf. If unset, it falls back to the C locale. LOCALE="en_US.UTF-8" -*DAEMON_LOCALE=* - - - If set to 'no', export the C locale to daemons and during the boot process. - - Otherwise, export LANG (or LOCALE) as configured in /etc/locale.conf (or /etc/rc.conf). - -Leave this unset, unless you have a specific reason to set it to 'no'. - - DAEMON_LOCALE="yes" - *USECOLOR=* Use ANSI color sequences in start-up messages, unless set to 'no'. -- cgit v1.2.3