summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile43
-rw-r--r--PKGBUILD2
-rwxr-xr-xarch-binfmt45
-rwxr-xr-xarch-sysctl6
-rwxr-xr-xarch-tmpfiles20
-rw-r--r--binfmt.d.5.txt57
-rw-r--r--functions162
-rw-r--r--locale.sh12
-rwxr-xr-xnetfs4
-rwxr-xr-xnetwork8
-rw-r--r--rc.conf.5.txt13
-rwxr-xr-xrc.d9
-rwxr-xr-xrc.multi3
-rwxr-xr-xrc.shutdown4
-rwxr-xr-xrc.sysinit198
-rw-r--r--zsh-completion2
16 files changed, 332 insertions, 256 deletions
diff --git a/Makefile b/Makefile
index ba1a798..e57dfd2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
VER := $(shell git describe)
+
DIRS := \
/etc/rc.d \
/etc/conf.d \
@@ -8,14 +9,23 @@ DIRS := \
/usr/sbin \
/etc/tmpfiles.d \
/usr/lib/tmpfiles.d \
+ /etc/binfmt.d \
+ /usr/lib/binfmt.d \
/etc/sysctl.d \
/usr/lib/sysctl.d \
/usr/lib/initscripts \
- /etc/bash_completion.d \
+ /usr/share/bash-completion/completions \
/usr/share/zsh/site-functions \
/usr/share/man/man5 \
/usr/share/man/man8
+MAN_PAGES := \
+ rc.d.8 \
+ rc.conf.5 \
+ locale.conf.5 \
+ vconsole.conf.5 \
+ hostname.5
+
all: doc
installdirs:
@@ -29,35 +39,28 @@ install: installdirs doc
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/man8 rc.d.8
- install -m644 -t ${DESTDIR}/usr/share/man/man5 rc.conf.5 locale.conf.5 vconsole.conf.5 hostname.5
- install -m755 -t $(DESTDIR)/usr/lib/initscripts arch-tmpfiles arch-sysctl
+ install -m644 -t $(DESTDIR)/usr/share/man/man5 $(filter %.5, $(MAN_PAGES))
+ install -m644 -t $(DESTDIR)/usr/share/man/man8 $(filter %.8, $(MAN_PAGES))
+ install -m755 -t $(DESTDIR)/usr/lib/initscripts arch-tmpfiles arch-sysctl arch-binfmt
install -m644 tmpfiles.conf $(DESTDIR)/usr/lib/tmpfiles.d/arch.conf
- install -m644 -T bash-completion $(DESTDIR)/etc/bash_completion.d/rc.d
+ 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
-rc.d.8: rc.d.8.txt
- a2x -d manpage -f manpage rc.d.8.txt
-
-rc.conf.5: rc.conf.5.txt
- a2x -d manpage -f manpage rc.conf.5.txt
+%.5: %.5.txt
+ a2x -d manpage -f manpage $<
-locale.conf.5: locale.conf.5.txt
- a2x -d manpage -f manpage locale.conf.5.txt
+%.8: %.8.txt
+ a2x -d manpage -f manpage $<
-vconsole.conf.5: vconsole.conf.5.txt
- a2x -d manpage -f manpage vconsole.conf.5.txt
-
-hostname.5: hostname.5.txt
- a2x -d manpage -f manpage hostname.5.txt
-
-doc: rc.d.8 rc.conf.5 locale.conf.5 vconsole.conf.5 hostname.5
+doc: $(MAN_PAGES)
clean:
- rm -f rc.d.8 rc.conf.5 locale.conf.5 vconsole.conf.5 hostname.5
+ rm -f $(MAN_PAGES)
tar:
git archive HEAD --prefix=initscripts-$(VER)/ | xz > initscripts-$(VER).tar.xz
release: tar
scp initscripts-$(VER).tar.xz parabola:public/other/
+
+.PHONY: all installdirs install doc clean tar release
diff --git a/PKGBUILD b/PKGBUILD
index 950fc84..14ce69f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -10,7 +10,7 @@ conflicts=('initscripts')
provides=('initscripts=9999')
backup=(etc/inittab etc/rc.conf etc/rc.local etc/rc.local.shutdown)
makedepends=('asciidoc')
-depends=('glibc' 'bash' 'grep' 'coreutils' 'udev>=177' 'iproute2'
+depends=('glibc' 'bash' 'grep' 'coreutils' 'udev>=182' 'iproute2'
'ncurses' 'kbd' 'findutils' 'sysvinit')
optdepends=('net-tools: legacy networking support'
'bridge-utils: Network bridging support'
diff --git a/arch-binfmt b/arch-binfmt
new file mode 100755
index 0000000..91468ef
--- /dev/null
+++ b/arch-binfmt
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# /usr/lib/initscripts/arch-binfmt
+#
+# Configure additional binary formats at boot
+#
+
+shopt -s nullglob
+
+declare -a binfmt_d
+# files given has argv supersede config files
+if (( $# > 0 )); then
+ for arg; do [[ -r "$arg" ]] && binfmt_d+=("$arg"); done
+else
+ binfmt_d=(
+ /usr/lib/binfmt.d/*.conf
+ /etc/binfmt.d/*.conf
+ /run/binfmt.d/*.conf
+ )
+fi
+
+# check there is file to load
+(( ${#binfmt_d[@]} > 0 )) || exit 1
+
+# mount binfmt_misc if api filesystem is missing
+mountpoint -q /proc/sys/fs/binfmt_misc ||
+ mount -t binfmt_misc binfmt /proc/sys/fs/binfmt_misc
+
+# files declared later in the binfmt_d array will override earlier
+# Example: `/etc/binfmt.d/foo.conf' supersedes `/usr/lib/binfmt.d/foo.conf'.
+declare -A fragments
+for path in "${binfmt_d[@]}"; do
+ [[ -f $path ]] && fragments[${path##*/}]=$path
+done
+
+for path in "${fragments[@]}"; do
+ while read -r line; do
+ [[ ${line:0:1} == '#' ]] && continue
+ printf "%s" "$line" > /proc/sys/fs/binfmt_misc/register
+ done < "$path"
+done
+
+:
+
+# vim: set ts=2 sw=2 noet:
diff --git a/arch-sysctl b/arch-sysctl
index 4856df6..f73f1f0 100755
--- a/arch-sysctl
+++ b/arch-sysctl
@@ -18,12 +18,12 @@ declare -A fragments
# files declared later in the sysctl_d array will override earlier
# Example: `/etc/sysctl.d/foo.conf' supersedes `/usr/lib/sysctl.d/foo.conf'.
-for path in "${sysctl_d[@]}"; do
- [[ -f $path ]] && fragments[${path##*/}]=$path
+for path in "${@:-${sysctl_d[@]}}"; do
+ [[ -f $path ]] && fragments[${path##*/}]=$path
done
for path in "${fragments[@]}"; do
- sysctl -q -p "$path"
+ sysctl -q -p"$path"
done
# vim: set ts=2 sw=2 noet:
diff --git a/arch-tmpfiles b/arch-tmpfiles
index 3b94885..9355fdc 100755
--- a/arch-tmpfiles
+++ b/arch-tmpfiles
@@ -25,13 +25,19 @@ checkparams() {
fi
# uid must be numeric or a valid user name
- if [[ $uid ]] && ! getent passwd "$uid" >/dev/null; then
- return 1
+ # don't try to resolve numeric IDs in case they don't exist
+ if [[ $uid ]]; then
+ if [[ $uid != +([0-9]) ]] && ! getent passwd "$uid" >/dev/null; then
+ return 1
+ fi
fi
# gid must be numeric or a valid group name
- if [[ $gid ]] && ! getent group "$gid" >/dev/null; then
- return 1
+ # don't try to resolve numeric IDs in case they don't exist
+ if [[ $gid ]]; then
+ if [[ $gid != +([0-9]) ]] && ! getent group "$gid" >/dev/null; then
+ return 1
+ fi
fi
return 0
@@ -235,7 +241,7 @@ fi
# directories declared later in the tmpfiles_d array will override earlier
# directories, on a per file basis.
# Example: `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'.
-for path in "${tmpfiles_d[@]}"; do
+for path in "${@:-${tmpfiles_d[@]}}"; do
[[ -f $path ]] && fragments[${path##*/}]=${path%/*}
done
@@ -279,8 +285,8 @@ while read -d '' fragment; do
d|D) line[2]=0755 ;;
esac
fi
- [[ ${line[3]} = '-' ]] && line[3]=0
- [[ ${line[4]} = '-' ]] && line[4]=0
+ [[ ${line[3]} = '-' ]] && line[3]='root'
+ [[ ${line[4]} = '-' ]] && line[4]='root'
"_${line[@]}"
done <"$FILE"
diff --git a/binfmt.d.5.txt b/binfmt.d.5.txt
new file mode 100644
index 0000000..2925256
--- /dev/null
+++ b/binfmt.d.5.txt
@@ -0,0 +1,57 @@
+/////
+vim:set ts=4 sw=4 syntax=asciidoc noet:
+/////
+binfmt.d(5)
+===========
+
+NAME
+----
+binfmt.d - Configure additional binary formats at boot
+
+SYNOPSIS
+--------
+/usr/lib/binfmt.d/*.conf
+
+/etc/binfmt.d/*.conf
+
+/run/binfmt.d/*.conf
+
+DESCRIPTION
+-----------
+*initscripts* uses files from the above directories to configure additional
+binary formats to register during boot in the kernel.
+
+CONFIGURATION FORMAT
+--------------------
+Each file contains a list of binfmt_misc kernel binary format rules.
+Consult *binfmt_misc.txt*[1] for more information on registration of
+additional binary formats and how to write rules.
+
+Empty lines and lines beginning with ; and # are ignored. Note that this
+means you may not use ; and # as delimiter in binary format rules.
+
+Each configuration file is named in the style of <program>.conf. Files in
+/etc/ overwrite files with the same name in /usr/lib/. Files in /run
+overwrite files with the same name in /etc/ and /usr/lib/. Packages
+should install their configuration files in /usr/lib/, files in /etc/ are
+reserved for the local administration, which possibly decides to
+overwrite the configurations installed from packages. All files are
+sorted by filename in alphabetical order, regardless in which of the
+directories they reside, to ensure that a specific configuration file
+takes precedence over another file with an alphabetically later name.
+
+EXAMPLE
+-------
+*Example 1. /etc/binfmt.d/wine.conf example:*
+
+ # Start WINE on Windows executables
+ :DOSWin:M::MZ::/usr/bin/wine:
+
+NOTES
+-----
+*1. binfmt_misc.txt:*
+ http://www.kernel.org/doc/Documentation/binfmt_misc.txt
+
+AUTHORS
+-------
+Original by Lennart Poettering, adapted to Arch Linux by Sébastien Luttringer.
diff --git a/functions b/functions
index edeecac..7fa4ebe 100644
--- a/functions
+++ b/functions
@@ -348,7 +348,7 @@ kill_all() {
udevd_modprobe() {
# $1 = where we are being called from.
# This is used to determine which hooks to run.
- status "Starting UDev Daemon" /lib/udev/udevd --daemon
+ status "Starting UDev Daemon" /usr/lib/udev/udevd --daemon
run_hook "$1_udevlaunched"
@@ -372,23 +372,89 @@ udevd_modprobe() {
activate_vgs() {
[[ $USELVM = [yY][eE][sS] && -x $(type -P lvm) && -d /sys/block ]] || return 0
- # Kernel 2.6.x, LVM2 groups
stat_busy "Activating LVM2 groups"
- modprobe -q dm-mod 2>/dev/null
vgchange --sysinit -a y >/dev/null
(( $? == 0 )) && stat_done || stat_fail
}
-# Arch cryptsetup packages traditionally contained the binaries
-# /usr/sbin/cryptsetup
-# /sbin/cryptsetup.static
-# By default, initscripts used the /sbin/cryptsetup.static.
-# Newer packages will only have /sbin/cryptsetup and no static binary
-# This ensures maximal compatibility with the old and new layout
-for CS in /sbin/cryptsetup /usr/sbin/cryptsetup \
- /sbin/cryptsetup.static ''; do
- [[ -x $CS ]] && break
-done
+do_unlock() {
+ # $1 = requested name
+ # $2 = source device
+ # $3 = password
+ # $4 = options
+ stat_append "${1}.."
+ 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.
+ # isLuks only gives an exit code but no output to stdout or stderr.
+ if cryptsetup isLuks "$2" 2>/dev/null; then
+ open=luksOpen
+ a=$2
+ b=$1
+ fi
+ case $3 in
+ SWAP)
+ local _overwriteokay=0
+ if [[ -b $2 && -r $2 ]]; then
+ # This is DANGEROUS! If there is any known file system,
+ # partition table, RAID or LVM volume on the device
+ # we don't overwrite it.
+ #
+ # 'blkid' returns 2 if no valid signature has been found.
+ # Only in this case we should allow overwriting the device.
+ #
+ # This sanity check _should_ be sufficient, but it might not.
+ # This may cause dataloss if it is not used carefully.
+ blkid -p "$2" &>/dev/null
+ (( $? == 2 )) && _overwriteokay=1
+ fi
+ if (( _overwriteokay == 0 )); then
+ false
+ elif cryptsetup -d /dev/urandom $4 $open "$a" "$b" >/dev/null; then
+ stat_append "creating swapspace.."
+ mkswap -f -L $1 /dev/mapper/$1 >/dev/null
+ fi;;
+ ASK)
+ printf "\nOpening '$1' volume:\n"
+ cryptsetup $4 $open "$a" "$b" < /dev/console;;
+ /dev*)
+ local ckdev=${3%%:*}
+ local cka=${3#*:}
+ local ckb=${cka#*:}
+ local cka=${cka%:*}
+ local ckfile=/dev/ckfile
+ local ckdir=/dev/ckdir
+ case ${cka} in
+ *[!0-9]*)
+ # Use a file on the device
+ # cka is not numeric: cka=filesystem, ckb=path
+ mkdir ${ckdir}
+ mount -r -t ${cka} ${ckdev} ${ckdir}
+ dd if=${ckdir}/${ckb} of=${ckfile} >/dev/null 2>&1
+ umount ${ckdir}
+ rmdir ${ckdir};;
+ *)
+ # Read raw data from the block device
+ # cka is numeric: cka=offset, ckb=length
+ dd if=${ckdev} of=${ckfile} bs=1 skip=${cka} count=${ckb} >/dev/null 2>&1;;
+ esac
+ cryptsetup -d ${ckfile} $4 $open "$a" "$b" >/dev/null
+ dd if=/dev/urandom of=${ckfile} bs=1 count=$(stat -c %s ${ckfile}) conv=notrunc >/dev/null 2>&1
+ rm ${ckfile};;
+ /*)
+ cryptsetup -d "$3" $4 $open "$a" "$b" >/dev/null;;
+ *)
+ printf "${C_FAIL}crypttab contains a literal encryption key. This will stop working in the future.${C_OTHER}\n"
+ echo "$3" | cryptsetup $4 $open "$a" "$b" >/dev/null;;
+ esac
+ if (( $? )); then
+ failed=1
+ stat_append "failed "
+ else
+ stat_append "ok "
+ fi
+ return $failed
+}
read_crypttab() {
# $1 = function to call with the split out line from the crypttab
@@ -417,13 +483,8 @@ set_timezone() {
if [[ -L /etc/localtime && /etc/localtime -ef $zonefile ]]; then
return 0
- fi
-
- # respect the user's decision to symlink or copy
- if [[ -L /etc/localtime ]]; then
- ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime
else
- cp --remove-destination "/usr/share/zoneinfo/$tz" /etc/localtime
+ ln -sf "/usr/share/zoneinfo/$tz" /etc/localtime
fi
}
@@ -433,11 +494,17 @@ NETFS="nfs,nfs4,smbfs,cifs,codafs,ncpfs,shfs,fuse,fuseblk,glusterfs,davfs,fuse.g
# Check local filesystems
fsck_all() {
+ [[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-f"
+
+ if [[ ! -n $FORCEFSCK ]] && { [[ -f /fastboot ]] || in_array fastboot $(< /proc/cmdline); }; then
+ return 0
+ fi
+
if [[ -e /run/initramfs/root-fsck ]]; then
IGNORE_MOUNTED="-M"
fi
- fsck -A -T -C${FSCK_FD} -a -t no${NETFS//,/,no},noopts=_netdev ${FORCEFSCK} ${IGNORE_MOUNTED}
+ fsck -A -T -C${FSCK_FD} -a -t no${NETFS//,/,no},noopts=_netdev ${IGNORE_MOUNTED} -- ${FORCEFSCK}
}
# Single-user login and/or automatic reboot after fsck (if needed)
@@ -482,30 +549,31 @@ mount_all() {
umount_all() {
# $1: restrict to fstype
- local mounts
-
- while read -r target fstype options; do
-
- # match only targetted fstypes
- if [[ $1 && $1 != "$fstype" ]]; then
- continue
- fi
+ findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | {
+ while read -r target fstype options; do
+ # match only targetted fstypes
+ if [[ $1 && $1 != "$fstype" ]]; then
+ continue
+ fi
+
+ # don't unmount API filesystems
+ if [[ $target = /@(proc|sys|run|dev|dev/pts) ]]; then
+ continue
+ fi
+
+ # avoid networked devices
+ IFS=, read -ra opts <<< "$options"
+ if in_array _netdev "${opts[@]}"; then
+ continue
+ fi
+
+ mounts=("$target" "${mounts[@]}")
+ done
- # don't unmount API filesystems
- if [[ $target = /@(proc|sys|run|dev|dev/pts) ]]; then
- continue
+ if (( ${#mounts[*]} )); then
+ umount -r "${mounts[@]}"
fi
-
- # avoid networked devices
- IFS=, read -ra opts <<< "$options"
- if in_array _netdev "${opts[@]}"; then
- continue
- fi
-
- mounts=("$target" "${mounts[@]}")
- done < <(findmnt -mrunRo TARGET,FSTYPE,OPTIONS /)
-
- umount -r "${mounts[@]}"
+ }
}
@@ -654,15 +722,5 @@ for f in /etc/rc.d/functions.d/*; do
[[ -e $f ]] && . "$f"
done
-# Exit current shell if user is not root
-need_root() {
- (( EUID )) && printf 'You need to be root.\n' && exit 1
-}
-
-# Quit script if it's not running by root
-# This can be disabled in scripts sourcing functions by setting NEED_ROOT=0
-# A local call to need_root can be done to ensure part of script need root privilege
-(( ${NEED_ROOT:-0} == 1 )) && need_root
-
# End of file
# vim: set ts=2 sw=2 noet:
diff --git a/locale.sh b/locale.sh
index fe82378..c465f6f 100644
--- a/locale.sh
+++ b/locale.sh
@@ -4,16 +4,12 @@ if [ -s /etc/locale.conf ]; then
. /etc/locale.conf
fi
-if [ -n "$LANG" ]; then
- export LANG
-else
- if [ -s /etc/rc.conf ]; then
- export LANG=$(. /etc/rc.conf 2> /dev/null ; echo "$LOCALE")
- else
- export LANG="C"
- 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
diff --git a/netfs b/netfs
index ea7e4eb..bd459ef 100755
--- a/netfs
+++ b/netfs
@@ -16,9 +16,9 @@ case "$1" in
;;
stop)
stat_busy "Unmounting Network Filesystems"
- umount -a -O _netdev
+ umount -a -f -O _netdev
rc=$?
- umount -a -t "$NETFS"
+ umount -a -f -t "$NETFS"
(( rc || $? )) && stat_die
rm_daemon netfs
stat_done
diff --git a/network b/network
index d22b5dd..322082c 100755
--- a/network
+++ b/network
@@ -19,7 +19,7 @@ need_legacy() {
deprecated() {
printf "${C_FAIL}Warning:${C_CLEAR} Your network settings are deprecated.\n"
- printf " Please refer to /etc/rc.conf on how to define a single wired\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"
}
@@ -52,7 +52,7 @@ network_down() {
have_interface "$interface" || return 1
if [[ -f /run/dhcpcd-$interface.pid ]]; then
- dhcpcd -k $interface || return 1
+ dhcpcd -qk $interface || return 1
else
ip addr flush dev $interface || return 1
fi
@@ -260,7 +260,7 @@ case "$1" in
else
network_up
fi
- if ((error == 0)); then
+ if (( ! error )); then
add_daemon network
stat_done
else
@@ -296,7 +296,7 @@ case "$1" in
else
network_down
fi
- if ((error == 0)); then
+ if (( ! error )); then
stat_done
else
stat_fail
diff --git a/rc.conf.5.txt b/rc.conf.5.txt
index cf3c649..7352d6a 100644
--- a/rc.conf.5.txt
+++ b/rc.conf.5.txt
@@ -102,7 +102,7 @@ HARDWARE[[H]]
-------------
*MODULES=*
-Modules to load at boot-up. To blacklist modules, see "man modprobe.conf".
+Modules to load at boot-up. To blacklist modules, see "man modprobe.d".
Default: ().
@@ -200,16 +200,7 @@ Default: "no"
*NETWORKS=*
-Enable these netcfg profiles at boot-up. These replace the network
-configuration above and are useful if you happen to need more advanced
-network features than the simple network service supports,
-such as multiple network configurations (ie, laptop users).
- - set to 'menu' to present a menu during boot-up (dialog package required)
- - prefix an entry with a ! to disable it
-
-Network profiles are found in /etc/network.d
-There is a template file included there that can be used to create
-new profiles. This requires the netcfg package.
+This functionality is deprecated, please refer to the 'netcfg' documentation.
DAEMONS[[D]]
------------
diff --git a/rc.d b/rc.d
index aed2e42..0cfbdaf 100755
--- a/rc.d
+++ b/rc.d
@@ -1,6 +1,5 @@
#!/bin/bash
-NEED_ROOT=0 # this script can be run without be root
. /etc/rc.conf
. /etc/rc.d/functions
@@ -41,10 +40,10 @@ not exist or is not executable.${C_CLEAR}\n" >&2
exit 2
fi
# check filter
- ((${filter[started]} == 1)) && ck_daemon "$daemon" && continue
- ((${filter[stopped]} == 1)) && ! ck_daemon "$daemon" && continue
- ((${filter[auto]} == 1)) && ck_autostart "$daemon" && continue
- ((${filter[noauto]} == 1)) && ! ck_autostart "$daemon" && continue
+ (( ${filter[started]} )) && ck_daemon "$daemon" && continue
+ (( ${filter[stopped]} )) && ! ck_daemon "$daemon" && continue
+ (( ${filter[auto]} )) && ck_autostart "$daemon" && continue
+ (( ${filter[noauto]} )) && ! ck_autostart "$daemon" && continue
new_daemons+=("$daemon")
done
daemons=("${new_daemons[@]}")
diff --git a/rc.multi b/rc.multi
index 19623d8..20ed9bc 100755
--- a/rc.multi
+++ b/rc.multi
@@ -11,6 +11,9 @@ run_hook multi_start
# Load sysctl config files
[[ -x /usr/lib/initscripts/arch-sysctl ]] && /usr/lib/initscripts/arch-sysctl
+# Load additional binary formats
+[[ -x /usr/lib/initscripts/arch-binfmt ]] && /usr/lib/initscripts/arch-binfmt
+
# Start daemons
for daemon in "${DAEMONS[@]}"; do
case ${daemon:0:1} in
diff --git a/rc.shutdown b/rc.shutdown
index 54a1e9a..ec30d56 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -65,14 +65,14 @@ status "Unmounting Non-API Filesystems" umount_all
run_hook shutdown_postumount
# Kill non-root encrypted partition mappings
-if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
+if [[ -f /etc/crypttab ]] && type -p cryptsetup >/dev/null; then
stat_busy "Deactivating encrypted volumes:"
# Maybe someone has LVM on an encrypted block device
# executing an extra vgchange is errorless
[[ $USELVM = [Yy][Ee][Ss] ]] && vgchange --sysinit -a n &>/dev/null
do_lock() {
stat_append "${1}.."
- if $CS remove "$1" &>/dev/null; then
+ if cryptsetup remove "$1" &>/dev/null; then
stat_append "ok "
else
stat_append "failed "
diff --git a/rc.sysinit b/rc.sysinit
index 66cba96..854016f 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -12,7 +12,8 @@ printhl "${C_H2}http://parabolagnulinux.org"
printhl "You're booting into a /libre/ version of Archlinux"
printsep
-# mount /proc, /sys, /run, /dev, /run/lock, /dev/pts, /dev/shm (the api filesystems)
+# mount the api filesystems
+# /proc, /sys, /run, /dev, /run/lock, /dev/pts, /dev/shm
mountpoint -q /proc || mount -t proc proc /proc -o nosuid,noexec,nodev
mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev
mountpoint -q /run || mount -t tmpfs run /run -o mode=0755,nosuid,nodev
@@ -36,11 +37,48 @@ run_hook sysinit_start
# log all console messages
bootlogd -p /run/bootlogd.pid
+if [[ -s /etc/locale.conf ]]; then
+ parse_envfile /etc/locale.conf "LANG"
+ [[ $LANG ]] && LOCALE=$LANG
+fi
+if [[ ${LOCALE,,} =~ utf ]]; then
+ stat_busy "Setting Consoles to UTF-8 mode"
+ # UTF-8 consoles are default since 2.6.24 kernel
+ # this code is needed not only for older kernels,
+ # but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8.
+ for i in /dev/tty[0-9]*; do
+ kbd_mode -u < ${i}
+ printf "\e%%G" > ${i}
+ done
+ echo 1 >| /sys/module/vt/parameters/default_utf8
+ stat_done
+else
+ stat_busy "Setting Consoles to legacy mode"
+ # make non-UTF-8 consoles work on 2.6.24 and newer kernels
+ for i in /dev/tty[0-9]*; do
+ kbd_mode -a < ${i}
+ printf "\e%%@" > ${i}
+ done
+ echo 0 >| /sys/module/vt/parameters/default_utf8
+ stat_done
+fi
+
+if [[ -s /etc/vconsole.conf ]]; then
+ parse_envfile /etc/vconsole.conf "${vconsolevars[@]}"
+ [[ $FONT ]] && CONSOLEFONT=$FONT
+ [[ $FONT_MAP ]] && CONSOLEMAP=$FONT_MAP
+fi
+[[ $KEYMAP ]] &&
+ status "Loading Keyboard Map: $KEYMAP" loadkeys -q $KEYMAP
+
+# Set console font if required
+set_consolefont
+
if [[ ! -a /usr/lib ]] ; then
- printf "${C_FAIL}/usr is not mounted. This is not supported.${C_OTHER}\n"
+ printf "${C_FAIL}/usr is not mounted. This is not supported.${C_OTHER}\n"
fi
-if [[ ! $(grep devtmpfs /proc/filesystems) ]] ; then
+if ! grep -q devtmpfs /proc/filesystems; then
printf "${C_FAIL}Your kernel does not have devtmpfs support. This is not supported.${C_OTHER}\n"
fi
@@ -54,8 +92,6 @@ esac
if [[ $HWCLOCK_PARAMS ]]; then
stat_busy "Adjusting system time and setting kernel timezone"
- # enable rtc access
- modprobe -q -a rtc-cmos rtc genrtc
# Adjust the system time for timezone offset if rtc is not in UTC
# 1. Make creation time on device nodes sane (FS#8665)
@@ -65,7 +101,9 @@ if [[ $HWCLOCK_PARAMS ]]; then
# is used. If HARDWARECLOCK is not set in rc.conf, the value in
# /var/lib/hwclock/adjfile is used (in this case /var can not be a separate
# partition).
- TZ=$TIMEZONE hwclock $HWCLOCK_PARAMS && stat_done || stat_fail
+ [[ $TIMEZONE ]] && export TZ=$TIMEZONE
+ hwclock $HWCLOCK_PARAMS && stat_done || stat_fail
+ unset TZ
fi
# Start/trigger UDev, load MODULES and settle UDev
@@ -87,111 +125,28 @@ udevd_modprobe sysinit
activate_vgs
# Set up non-root encrypted partition mappings
-if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
+if [[ -f /etc/crypttab ]] && type -p cryptsetup >/dev/null; then
stat_busy "Unlocking encrypted volumes:"
- modprobe -q dm-crypt 2>/dev/null
- do_unlock() {
- # $1 = requested name
- # $2 = source device
- # $3 = password
- # $4 = options
- stat_append "${1}.."
- 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.
- # isLuks only gives an exit code but no output to stdout or stderr.
- if $CS isLuks "$2" 2>/dev/null; then
- open=luksOpen
- a=$2
- b=$1
- fi
- case $3 in
- SWAP)
- local _overwriteokay=0
- if [[ -b $2 && -r $2 ]]; then
- # This is DANGEROUS! If there is any known file system,
- # partition table, RAID or LVM volume on the device
- # we don't overwrite it.
- #
- # 'blkid' returns 2 if no valid signature has been found.
- # Only in this case we should allow overwriting the device.
- #
- # This sanity check _should_ be sufficient, but it might not.
- # This may cause dataloss if it is not used carefully.
- blkid -p "$2" &>/dev/null
- (( $? == 2 )) && _overwriteokay=1
- fi
- if (( _overwriteokay == 0 )); then
- false
- elif $CS -d /dev/urandom $4 $open "$a" "$b" >/dev/null; then
- stat_append "creating swapspace.."
- mkswap -f -L $1 /dev/mapper/$1 >/dev/null
- fi;;
- ASK)
- printf "\nOpening '$1' volume:\n"
- $CS $4 $open "$a" "$b" < /dev/console;;
- /dev*)
- local ckdev=${3%%:*}
- local cka=${3#*:}
- local ckb=${cka#*:}
- local cka=${cka%:*}
- local ckfile=/dev/ckfile
- local ckdir=/dev/ckdir
- case ${cka} in
- *[!0-9]*)
- # Use a file on the device
- # cka is not numeric: cka=filesystem, ckb=path
- mkdir ${ckdir}
- mount -r -t ${cka} ${ckdev} ${ckdir}
- dd if=${ckdir}/${ckb} of=${ckfile} >/dev/null 2>&1
- umount ${ckdir}
- rmdir ${ckdir};;
- *)
- # Read raw data from the block device
- # cka is numeric: cka=offset, ckb=length
- dd if=${ckdev} of=${ckfile} bs=1 skip=${cka} count=${ckb} >/dev/null 2>&1;;
- esac
- $CS -d ${ckfile} $4 $open "$a" "$b" >/dev/null
- dd if=/dev/urandom of=${ckfile} bs=1 count=$(stat -c %s ${ckfile}) conv=notrunc >/dev/null 2>&1
- rm ${ckfile};;
- /*)
- $CS -d "$3" $4 $open "$a" "$b" >/dev/null;;
- *)
- echo "$3" | $CS $4 $open "$a" "$b" >/dev/null;;
- esac
- if (( $? )); then
- failed=1
- stat_append "failed "
- else
- stat_append "ok "
- fi
- return $failed
- }
crypto_unlocked=0
read_crypttab do_unlock && stat_done || stat_fail
# Maybe someone has LVM on an encrypted block device
- (( crypto_unlocked == 1 )) && activate_vgs
+ (( crypto_unlocked )) && activate_vgs
fi
# Check filesystems
-[[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-- -f"
-declare -r FORCEFSCK
-
-if [[ -n $FORCEFSCK ]] || { [[ ! -f /fastboot ]] && ! in_array fastboot $(< /proc/cmdline); }; then
- run_hook sysinit_prefsck
- if [[ -x $(type -P fsck) ]]; then
- stat_busy "Checking Filesystems"
- fsck_all >|"${FSCK_OUT:-/dev/stdout}" 2>|"${FSCK_ERR:-/dev/stdout}"
- declare -r fsckret=$?
- (( fsckret <= 1 )) && stat_done || stat_fail
- else
- declare -r fsckret=0
- fi
- run_hook sysinit_postfsck
-
- # Single-user login and/or automatic reboot if needed
- fsck_reboot $fsckret
+run_hook sysinit_prefsck
+if [[ -x $(type -P fsck) ]]; then
+ stat_busy "Checking Filesystems"
+ fsck_all >|"${FSCK_OUT:-/dev/stdout}" 2>|"${FSCK_ERR:-/dev/stdout}"
+ declare -r fsckret=$?
+ (( fsckret <= 1 )) && stat_done || stat_fail
+else
+ declare -r fsckret=0
fi
+run_hook sysinit_postfsck
+
+# Single-user login and/or automatic reboot if needed
+fsck_reboot $fsckret
status "Remounting Root" \
mount -o remount /
@@ -227,43 +182,6 @@ if [[ $HOSTNAME ]]; then
echo "$HOSTNAME" >| /proc/sys/kernel/hostname && stat_done || stat_fail
fi
-if [[ -s /etc/locale.conf ]]; then
- parse_envfile /etc/locale.conf "LANG"
- [[ $LANG ]] && LOCALE=$LANG
-fi
-if [[ ${LOCALE,,} =~ utf ]]; then
- stat_busy "Setting Consoles to UTF-8 mode"
- # UTF-8 consoles are default since 2.6.24 kernel
- # this code is needed not only for older kernels,
- # but also when user has set vt.default_utf8=0 but LOCALE is *.UTF-8.
- for i in /dev/tty[0-9]*; do
- kbd_mode -u < ${i}
- printf "\e%%G" > ${i}
- done
- echo 1 >| /sys/module/vt/parameters/default_utf8
- stat_done
-else
- stat_busy "Setting Consoles to legacy mode"
- # make non-UTF-8 consoles work on 2.6.24 and newer kernels
- for i in /dev/tty[0-9]*; do
- kbd_mode -a < ${i}
- printf "\e%%@" > ${i}
- done
- echo 0 >| /sys/module/vt/parameters/default_utf8
- stat_done
-fi
-
-if [[ -s /etc/vconsole.conf ]]; then
- parse_envfile /etc/vconsole.conf "${vconsolevars[@]}"
- [[ $FONT ]] && CONSOLEFONT=$FONT
- [[ $FONT_MAP ]] && CONSOLEMAP=$FONT_MAP
-fi
-[[ $KEYMAP ]] &&
- status "Loading Keyboard Map: $KEYMAP" loadkeys -q $KEYMAP
-
-# Set console font if required
-set_consolefont
-
stat_busy "Saving dmesg Log"
if [[ -e /proc/sys/kernel/dmesg_restrict ]] &&
(( $(< /proc/sys/kernel/dmesg_restrict) == 1 )); then
diff --git a/zsh-completion b/zsh-completion
index 58fdfab..d860e51 100644
--- a/zsh-completion
+++ b/zsh-completion
@@ -28,7 +28,7 @@ _rc.d () {
;;
esac
;;
- esac
+ esac
}
_rc.d "$@"