summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrc10
-rwxr-xr-xrc.shutdown8
-rwxr-xr-xrc.single9
-rwxr-xr-xrc.sysinit10
4 files changed, 23 insertions, 14 deletions
diff --git a/rc b/rc
index 1e64119..743d86b 100755
--- a/rc
+++ b/rc
@@ -43,9 +43,15 @@ case $1 in
*)
action=$1
shift
+ # set same environment variables as init
+ runlevel=$(/sbin/runlevel)
+ ENV="PATH='/bin:/usr/bin:/sbin:/usr/sbin'"
+ ENV+=" PREVLEVEL='${runlevel:0:1}'"
+ ENV+=" RUNLEVEL='${runlevel:2:1}'"
+ ENV+=" CONSOLE='${CONSOLE:-/dev/console}'"
for i; do
- [[ -x "/etc/rc.d/$i" ]] && "/etc/rc.d/$i" $action
- (( ret += $? ))
+ [[ -x "/etc/rc.d/$i" ]] && cd / && eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action"
+ (( ret += !! $? )) # clamp exit value to 0/1
done
esac
diff --git a/rc.shutdown b/rc.shutdown
index f847ddf..a78bc4d 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -54,9 +54,10 @@ if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
fi
stat_busy "Unmounting Filesystems"
-if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
+if /bin/grep -q devtmpfs /proc/filesystems &>/dev/null; then
/bin/umount -a -r -t nosysfs,noproc,nodevtmpfs,nodevpts -O no_netdev
else
+ # if we don't have devtmpfs support, /dev is mounted as tmpfs, so don't unmount it
/bin/umount -a -r -t notmpfs,nosysfs,noproc,nodevpts -O no_netdev
fi
stat_done
@@ -64,6 +65,11 @@ stat_done
# Kill non-root encrypted partition mappings
if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
stat_busy "Deactivating encrypted volumes:"
+ # Maybe someone has LVM on an encrypted block device
+ # executing an extra vgchange is errorless
+ if [[ $USELVM =~ yes|YES ]]; then
+ /sbin/vgchange --sysinit -a n >/dev/null 2>&1
+ fi
do_lock() {
stat_append "${1}.."
if $CS remove "$1" >/dev/null 2>&1; then
diff --git a/rc.single b/rc.single
index b9701d5..06bd83c 100755
--- a/rc.single
+++ b/rc.single
@@ -19,18 +19,15 @@ if [[ $PREVLEVEL != N ]]; then
# Trigger udev uevents
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
stat_busy "Triggering UDev uevents"
- /sbin/udevadm control --property=STARTUP=1
- /sbin/udevadm trigger --action=add --type=devices
/sbin/udevadm trigger --action=add --type=subsystems
+ /sbin/udevadm trigger --action=add --type=devices
stat_done
fi
# Wait for udev uevents
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
- stat_busy "Waiting for UDev uevents to be processed"
- /sbin/udevadm settle
- /sbin/udevadm control --property=STARTUP=
- stat_done
+ status "Waiting for UDev uevents to be processed" \
+ /sbin/udevadm settle --quiet --timeout=${UDEV_TIMEOUT:-30}
fi
run_hook single_udevsettled
diff --git a/rc.sysinit b/rc.sysinit
index 92f7787..466b439 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -22,7 +22,7 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
/bin/mountpoint -q /sys || /bin/mount -n -t sysfs sysfs /sys -o nosuid,noexec,nodev
/bin/mountpoint -q /run || /bin/mount -n -t tmpfs tmpfs /run -o mode=755,size=10M,nosuid,noexec,nodev
if ! /bin/mountpoint -q /dev; then
- if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
+ if /bin/grep -q devtmpfs /proc/filesystems &>/dev/null; then
/bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
else
/bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
@@ -32,7 +32,7 @@ fi
/bin/chmod 1777 /run/lock
/bin/mountpoint -q /dev/pts || /bin/mount /dev/pts &> /dev/null \
|| /bin/mount -n -t devpts devpts /dev/pts -o mode=620,gid=5,nosuid,noexec
-/bin/mountpoint -q /dev/shm || /bin/mount /devshm &> /dev/null \
+/bin/mountpoint -q /dev/shm || /bin/mount /dev/shm &> /dev/null \
|| /bin/mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev
# remount root ro to allow for fsck later on, we remount now to
@@ -89,10 +89,10 @@ status "Starting UDev Daemon" /sbin/udevd --daemon
run_hook sysinit_udevlaunched
# Trigger udev uevents
-if /bin/pidof /sbin/udevd >/dev/null; then
+if /bin/pidof /sbin/udevd &>/dev/null; then
stat_busy "Triggering UDev uevents"
- /sbin/udevadm trigger --action=add --type=devices
/sbin/udevadm trigger --action=add --type=subsystems
+ /sbin/udevadm trigger --action=add --type=devices
stat_done
fi
@@ -104,7 +104,7 @@ fi
unset mods
# Wait for udev uevents
-if /bin/pidof /sbin/udevd >/dev/null; then
+if /bin/pidof /sbin/udevd &>/dev/null; then
status "Waiting for UDev uevents to be processed" \
/sbin/udevadm settle --quiet --timeout=${UDEV_TIMEOUT:-30}
fi