summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-08-21 15:06:40 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-08-21 15:06:40 -0300
commit2fb1be996d4d8d459f4b4953a84af63f981b0bf0 (patch)
treef168040a0fc7e8e61c93197354938d95454e12a9
parentabbce1c6720dc3836c1df1337a49768158dff62b (diff)
parent7e019c49b21cf2e975ff7d8b2bedf3bb2477d1c6 (diff)
Merge branch 'master' of git://projects.archlinux.org/initscripts2012.08.21
Conflicts: Makefile
-rw-r--r--.gitignore3
-rw-r--r--Makefile10
-rwxr-xr-xarch-daemons8
-rw-r--r--arch-daemons.8.txt40
-rw-r--r--arch-daemons.target3
-rw-r--r--arch-modules-load.8.txt35
-rw-r--r--arch-modules-load.service3
-rw-r--r--functions39
-rwxr-xr-xnetwork2
-rw-r--r--parabola.7.txt4
-rw-r--r--rc-local-shutdown.service2
-rw-r--r--rc-local.service2
-rwxr-xr-xrc.sysinit4
13 files changed, 128 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index e365ecb..c068949 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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/
diff --git a/Makefile b/Makefile
index 8d90ad2..d2668db 100644
--- a/Makefile
+++ b/Makefile
@@ -32,14 +32,16 @@ install: installdirs doc
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 parabola.7
- install -m644 -t $(DESTDIR)/usr/share/man/man8 rc.d.8
+ 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/
@@ -52,10 +54,10 @@ install: installdirs doc
%.8: %.8.txt
a2x -d manpage -f manpage $<
-doc: rc.conf.5 parabola.7 rc.d.8
+doc: rc.conf.5 parabola.7 rc.d.8 arch-modules-load.8 arch-daemons.8
clean:
- rm -f rc.conf.5 parabola.7 rc.d.8
+ rm -f rc.conf.5 parabola.7 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/arch-daemons b/arch-daemons
index ffe4289..b4398b4 100755
--- a/arch-daemons
+++ b/arch-daemons
@@ -31,7 +31,7 @@ create_unit() {
printf \
'[Unit]
SourcePath=/etc/rc.conf
-Documentation=https://raw.github.com/falconindy/initscripts-systemd/master/README
+Documentation=man:arch-daemons(8)
Description=Legacy unit for %s
%s
[Service]
@@ -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
new file mode 100644
index 0000000..bad5c9c
--- /dev/null
+++ b/arch-daemons.8.txt
@@ -0,0 +1,40 @@
+/////
+vim:set ts=4 sw=4 syntax=asciidoc noet:
+/////
+arch-daemons(8)
+===============
+
+NAME
+----
+arch-daemons, arch-daemons.target - Compatibility layer for rc scripts and rc.conf's DAEMONS array
+
+SYNOPSIS
+--------
+/usr/lib/systemd/system-generators/arch-daemons
+
+DESCRIPTION
+-----------
+arch-daemons is executed by systemd at very early boot. It has two purposes:
+
+ * For every rc script in /etc/rc.d/ a wrapper service file is created which will start and stop
+ daemons by calling the corresponding rc script. In case a native systemd service file exists
+ with the same name, the legacy one is ignored and the native one is used instead.
+ * The DAEMONS array in rc.conf is parsed and every daemon that appears there is enabled at boot.
+ Furthermore, the ordering dependencies specified in the DAEMONS array is respected (including
+ backgrounding).
+
+Note: this is meant as a compatibility layer only for the purposes of easing users' transition
+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
+--------
+
+rc.conf(5), systemd(1)
+
+AUTHORS
+-------
+Written by Tom Gundersen.
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.8.txt b/arch-modules-load.8.txt
new file mode 100644
index 0000000..cffad32
--- /dev/null
+++ b/arch-modules-load.8.txt
@@ -0,0 +1,35 @@
+/////
+vim:set ts=4 sw=4 syntax=asciidoc noet:
+/////
+arch-modules-load(8)
+====================
+
+NAME
+----
+arch-modules-load, arch-modules-load.service - Compatibility layer for rc.conf's MODULES array
+
+SYNOPSIS
+--------
+/usr/lib/systemd/arch-modules-load
+
+arch-modules-load.service
+
+DESCRIPTION
+-----------
+Parses the MODULES array from rc.conf at early boot and passes on the list of modules to load to
+systemd-modules-load.
+
+arch-modules-load and systemd-modules-load are used the same by both initscripts and systemd.
+
+Note: this is meant as a compatibility layer only for the purposes of easing users' transition from
+the old rc.conf syntax to the new systemd syntax. You are strongly encouraged to not rely on this,
+but rather use the native modules-load.d configuration format.
+
+SEE ALSO
+--------
+
+rc.conf(5), systemd-modules-load(8), modules-load.d(5)
+
+AUTHORS
+-------
+Written by Tom Gundersen.
diff --git a/arch-modules-load.service b/arch-modules-load.service
index f400d48..829e37a 100644
--- a/arch-modules-load.service
+++ b/arch-modules-load.service
@@ -1,6 +1,5 @@
[Unit]
-SourcePath=/etc/rc.conf
-Documentation=https://raw.github.com/falconindy/initscripts-systemd/master/README
+Documentation=man:arch-modules-load(8)
Description=Load modules defined in rc.conf
DefaultDependencies=no
Before=systemd-modules-load.service
diff --git a/functions b/functions
index c74a1fa..506ce0f 100644
--- a/functions
+++ b/functions
@@ -72,9 +72,19 @@ unset TZ
# sanitize the locale settings
unset "${localevars[@]}"
+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"
@@ -101,8 +111,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" \
@@ -357,14 +366,14 @@ print_welcome() {
load_modules() {
local rc=0
- /usr/lib/systemd/systemd-modules-load &>/dev/null
- rc=$?
-
- if (( ${#MODULES[*]} )); then
- modprobe -ab "${MODULES[@]}"
- (( rc += $? ))
+ if [[ $MODULES ]]; then
+ /usr/lib/systemd/arch-modules-load
+ rc=$?
fi
+ /usr/lib/systemd/systemd-modules-load
+ (( rc+=$? ))
+
return $rc
}
@@ -475,6 +484,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
@@ -517,7 +536,7 @@ do_unlock() {
do_unlock_legacy "$name" "$device" "$password" "$options"
fi
;;
- /*|none|-)
+ /*|none|-|'')
do_unlock_systemd "$name" "$device" "$password" "$options"
;;
*)
diff --git a/network b/network
index b28c523..b8b6989 100755
--- a/network
+++ b/network
@@ -223,7 +223,7 @@ case "$1" in
# deprecation check
need_legacy && deprecated
if ! ck_daemon network; then
- echo "Network is already running. Try 'network restart'"
+ echo "Network is already running. Try 'rc.d restart network'"
exit
fi
stat_busy "Starting network"
diff --git a/parabola.7.txt b/parabola.7.txt
index 25c8f9a..7415101 100644
--- a/parabola.7.txt
+++ b/parabola.7.txt
@@ -40,7 +40,7 @@ other things. Note that these settings only apply to the console, and not if you
TIME[[T]]
---------
-The local timezone is configured by symlinking /etc/localtime to the correct zoneinfo file under
+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
@@ -62,7 +62,7 @@ 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.conf
+GRUB's configuration is generated from /etc/default/grub by grub-mkconfig. Syslinux is configured in /boot/syslinux/syslinux.cfg
MODULES[[M]]
------------
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
diff --git a/rc.sysinit b/rc.sysinit
index c8f6360..eb49e2b 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -80,7 +80,7 @@ activate_vgs
if [[ -f /etc/crypttab ]] && type -p cryptsetup >/dev/null; then
read_crypttab do_unlock
# Maybe someone has LVM on an encrypted block device
- (( $? )) && activate_vgs
+ activate_vgs
fi
# Check filesystems
@@ -139,7 +139,7 @@ stat_busy "Saving dmesg log"
(( $? == 0 )) && stat_done || stat_fail
if [[ -f /etc/adjtime ]]; then
- ( read ; read ; read ADJTIME) < /etc/adjtime
+ { read ; read ; read ADJTIME; } < /etc/adjtime
if [[ $ADJTIME == 'LOCAL' ]]; then
if [[ $HARDWARECLOCK == 'UTC' ]]; then