summaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit63
1 files changed, 30 insertions, 33 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 178d334..92f7787 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -17,7 +17,10 @@ run_hook sysinit_start
# export standard PATH (will be overridden later when /etc/profile is sourced, but is usefull for UDev)
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-# mount /dev, /proc, /sys, /run (the api filesystems)
+# mount /proc, /sys, /run, /dev, /run/lock, /dev/pts, /dev/shm (the api filesystems)
+/bin/mountpoint -q /proc || /bin/mount -n -t proc proc /proc -o nosuid,noexec,nodev
+/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
/bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
@@ -25,15 +28,21 @@ if ! /bin/mountpoint -q /dev; then
/bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
fi
fi
-
-/bin/mkdir -p /dev/{pts,shm}
-
-/bin/mountpoint -q /proc || /bin/mount -n -t proc proc /proc -o nosuid,noexec,nodev
-/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
+/bin/mkdir -p /run/lock /dev/{pts,shm}
+/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/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
+# make sure nothing can open files rw on root which would block a remount
+/bin/findmnt / --options ro &>/dev/null || \
+status "Mounting Root Read-Only" /bin/mount -n -o remount,ro /
# start up our mini logger until syslog takes over
/sbin/minilogd
+/sbin/bootlogd -p /run/bootlogd.pid
# Set console verbosity
for cmdarg in $(< /proc/cmdline); do
@@ -75,15 +84,12 @@ if [[ $HWCLOCK_PARAMS ]]; then
fi
fi
-stat_busy "Starting UDev Daemon"
-echo "" > /sys/kernel/uevent_helper
-/sbin/udevd --daemon
-stat_done
+status "Starting UDev Daemon" /sbin/udevd --daemon
run_hook sysinit_udevlaunched
# Trigger udev uevents
-if /bin/pidof -o %PPID /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
@@ -93,14 +99,12 @@ fi
# Load modules from the MODULES array defined in rc.conf
mods=${MODULES[@]/!*/}
if [[ $load_modules != off && -f /proc/modules && $mods ]]; then
- stat_busy "Loading Modules"
- /sbin/modprobe --all $mods
- stat_done
+ status "Loading Modules" /sbin/modprobe --all $mods
fi
unset mods
# Wait for udev uevents
-if /bin/pidof -o %PPID /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
@@ -218,8 +222,6 @@ if [[ -f /etc/crypttab && -n $CS ]] && /bin/grep -q ^[^#] /etc/crypttab; then
fi
fi
-status "Mounting Root Read-only" /bin/mount -n -o remount,ro /
-
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs,nodavfs"
if [[ -x /sbin/fsck ]]; then
@@ -274,8 +276,6 @@ if [[ -x /sbin/fsck ]]; then
stat_done
fi
-/bin/mkdir -p /dev/{pts,shm}
-
stat_busy "Mounting Local Filesystems"
/bin/mount -n -o remount,rw /
@@ -295,12 +295,8 @@ stat_done
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw
if [[ $USELVM =~ yes|YES && -x /sbin/lvm && -d /sys/block ]]; then
- stat_busy "Activating monitoring of LVM2 groups"
- if /sbin/vgchange --monitor y >/dev/null; then
- stat_done
- else
- stat_fail
- fi
+ status "Activating monitoring of LVM2 groups" \
+ /sbin/vgchange --monitor y >/dev/null
fi
status "Activating Swap" /sbin/swapon -a
@@ -313,15 +309,15 @@ fi
RANDOM_SEED=/var/lib/misc/random-seed
if [[ -f $RANDOM_SEED ]]; then
- stat_busy "Initializing Random Seed"
- /bin/cat $RANDOM_SEED > /dev/urandom
- stat_done
+ status "Initializing Random Seed" \
+ /bin/cat $RANDOM_SEED > /dev/urandom
fi
stat_busy "Removing Leftover Files"
-/bin/rm -f /etc/{nologin,shutdownpid} /var/lock/* /forcefsck &>/dev/null
-/bin/rm -rf /tmp/* /tmp/.* &>/dev/null
-[[ -d /var/run ]] && /usr/bin/find /var/run/ \! -type d -delete
+/bin/rm -rf /etc/{nologin,shutdownpid} /forcefsck &>/dev/null
+/bin/mountpoint -q /tmp || /bin/rm -rf /tmp/* /tmp/.* &>/dev/null
+[[ ! -L /var/lock ]] && /bin/rm -rf /var/lock/*
+[[ ! -L /var/run && -d /var/run ]] && /usr/bin/find /var/run/ \! -type d -delete
: >| /var/run/utmp
/bin/chmod 0664 /var/run/utmp
/bin/chown root:utmp /var/run/utmp
@@ -338,7 +334,8 @@ fi
# Set the NIS domain name, if necessary
[[ -f /etc/conf.d/nisdomainname ]] && . /etc/conf.d/nisdomainname
if [[ $NISDOMAINNAME ]]; then
- status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname "$NISDOMAINNAME"
+ status "Setting NIS Domain Name: $NISDOMAINNAME" \
+ /bin/nisdomainname "$NISDOMAINNAME"
fi
stat_busy "Setting Locale: ${LOCALE:=en_US}"