diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rwxr-xr-x | arch-daemons | 6 | ||||
-rw-r--r-- | arch-daemons.8.txt | 5 | ||||
-rw-r--r-- | arch-daemons.target | 3 | ||||
-rw-r--r-- | arch-modules-load.service | 1 | ||||
-rw-r--r-- | functions | 34 | ||||
-rwxr-xr-x | network | 4 | ||||
-rw-r--r-- | rc-local-shutdown.service | 2 | ||||
-rw-r--r-- | rc-local.service | 2 | ||||
-rwxr-xr-x | rc.sysinit | 53 |
11 files changed, 76 insertions, 40 deletions
@@ -4,5 +4,8 @@ hostname.5 locale.conf.5 vconsole.conf.5 rc.conf.5 +archlinux.7 +arch-daemons.8 +arch-modules-load.8 rc.d.8 pkg/ @@ -31,12 +31,13 @@ install: installdirs doc 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 - install -m644 -t $(DESTDIR)/usr/lib/systemd/system arch-modules-load.service rc-local.service rc-local-shutdown.service + install -m644 -t $(DESTDIR)/usr/lib/systemd/system arch-modules-load.service rc-local.service rc-local-shutdown.service arch-daemons.target install -m644 tmpfiles.conf $(DESTDIR)/usr/lib/tmpfiles.d/initscripts.conf install -m644 -T bash-completion $(DESTDIR)/usr/share/bash-completion/completions/rc.d install -m644 -T zsh-completion $(DESTDIR)/usr/share/zsh/site-functions/_rc.d ln -s /dev/null ${DESTDIR}/usr/lib/systemd/system/netfs.service ln -s ../rc-local.service ${DESTDIR}/usr/lib/systemd/system/multi-user.target.wants/ + ln -s ../arch-daemons.target ${DESTDIR}/usr/lib/systemd/system/multi-user.target.wants/ ln -s ../rc-local-shutdown.service ${DESTDIR}/usr/lib/systemd/system/shutdown.target.wants/ ln -s ../arch-modules-load.service ${DESTDIR}/usr/lib/systemd/system/sysinit.target.wants/ diff --git a/arch-daemons b/arch-daemons index edb4dcb..b4398b4 100755 --- a/arch-daemons +++ b/arch-daemons @@ -47,18 +47,18 @@ for daemon in /etc/rc.d/*; do create_unit "${daemon##*/}".service done -[[ -d $dest/multi-user.target.wants ]] || /bin/mkdir -p "$dest/multi-user.target.wants" +[[ -d $dest/arch-daemons.target.wants ]] || /bin/mkdir -p "$dest/arch-daemons.target.wants" for daemon in "${DAEMONS[@]}"; do service="$daemon.service" case ${daemon:0:1} in '!') continue ;; '@') create_unit "${service:1}" "${deps[@]}" - ln -s "../${service:1}" "$dest/multi-user.target.wants" + ln -s "../${service:1}" "$dest/arch-daemons.target.wants" ;; *) create_unit "$service" "${deps[@]}" deps+=("$service") - ln -s "../$service" "$dest/multi-user.target.wants" + ln -s "../$service" "$dest/arch-daemons.target.wants" ;; esac done diff --git a/arch-daemons.8.txt b/arch-daemons.8.txt index 2c0071e..bad5c9c 100644 --- a/arch-daemons.8.txt +++ b/arch-daemons.8.txt @@ -6,7 +6,7 @@ arch-daemons(8) NAME ---- -arch-daemons - Compatibility layer for rc scripts and rc.conf's DAEMONS array +arch-daemons, arch-daemons.target - Compatibility layer for rc scripts and rc.conf's DAEMONS array SYNOPSIS -------- @@ -27,6 +27,9 @@ Note: this is meant as a compatibility layer only for the purposes of easing use from initscripts to systemd. You are strongly encouraged to not rely on this, but rather use native systemd services. +The generated services that are enabled in the DAEMONS array is pulled in via arch-daemons.target. +arch-daemons.target can be masked in order to ignore the DAEMONS array when booting with systemd. + SEE ALSO -------- diff --git a/arch-daemons.target b/arch-daemons.target new file mode 100644 index 0000000..578e8d7 --- /dev/null +++ b/arch-daemons.target @@ -0,0 +1,3 @@ +[Unit] +Description=Arch Daemons +Documentation=man:arch-daemons(8) diff --git a/arch-modules-load.service b/arch-modules-load.service index 269241f..829e37a 100644 --- a/arch-modules-load.service +++ b/arch-modules-load.service @@ -1,5 +1,4 @@ [Unit] -SourcePath=/etc/rc.conf Documentation=man:arch-modules-load(8) Description=Load modules defined in rc.conf DefaultDependencies=no @@ -65,9 +65,19 @@ if (( $? != 3 )); then fi unset TERM_COLORS +unquote() { + local -r quotes=$'[\'"]' + + if [[ ${1:0:1} = $quotes && ${1:(-1)} = "${1:0:1}" ]]; then + printf '%s' "${1:1:(-1)}" + else + printf '%s' "$1" + fi +} + parse_envfile() { local file=$1 validkeys=("${@:2}") ret=0 lineno=0 key= val= - local -r quotes=$'[\'"]' comments=$'[;#]*' + local -r comments=$'[;#]*' if [[ -z $file ]]; then printf "error: no environment file specified\n" @@ -94,8 +104,7 @@ parse_envfile() { [[ -z $key || ${key:0:1} = $comments ]] && continue # trim whitespace, strip matching quotes - val=$(echo "$val" | { read -r val; echo "$val"; }) - [[ ${val:0:1} = $quotes && ${val:(-1)} = "${val:0:1}" ]] && val=${val:1:(-1)} + val=$(echo "$val" | { read -r val; unquote "$val"; }) if [[ -z $val ]]; then printf "error: found key \`%s' without value on line %s of %s\n" \ @@ -121,6 +130,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" } @@ -351,6 +364,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 @@ -398,7 +412,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. @@ -468,6 +482,16 @@ do_unlock_legacy() { do_unlock_systemd() { local name=$1 device=$2 password=$3 options=$4 failed=0 + # lazily convert tags to udev symlinks + case $device in + UUID=*) + device=/dev/disk/by-uuid/$(unquote "${device#UUID=}") + ;; + PARTUUID=*) + device=/dev/disk/by-partuuid/$(unquote "${device#PARTUUID=}") + ;; + esac + if ! /usr/lib/systemd/systemd-cryptsetup attach "$name" "$device" "$password" $options; then failed=1 else @@ -510,7 +534,7 @@ do_unlock() { do_unlock_legacy "$name" "$device" "$password" "$options" fi ;; - /*|none|-) + /*|none|-|'') do_unlock_systemd "$name" "$device" "$password" "$options" ;; *) @@ -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-local-shutdown.service b/rc-local-shutdown.service index 5f672f7..2d0715c 100644 --- a/rc-local-shutdown.service +++ b/rc-local-shutdown.service @@ -1,6 +1,6 @@ [Unit] Description=/etc/rc.local.shutdown Compatibility -ConditionPathIsExecutable=/etc/rc.local.shutdown +ConditionFileIsExecutable=/etc/rc.local.shutdown DefaultDependencies=no After=rc-local.service basic.target Before=shutdown.target diff --git a/rc-local.service b/rc-local.service index 6c4c412..b17b091 100644 --- a/rc-local.service +++ b/rc-local.service @@ -1,6 +1,6 @@ [Unit] Description=/etc/rc.local Compatibility -ConditionPathIsExecutable=/etc/rc.local +ConditionFileIsExecutable=/etc/rc.local [Service] Type=oneshot @@ -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 |