aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit31
1 files changed, 23 insertions, 8 deletions
diff --git a/rc.sysinit b/rc.sysinit
index 7b086fa..7357582 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -174,9 +174,21 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
fi
# Check filesystems
-fsck_all
+[[ -f /forcefsck ]] || is_in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-- -f"
+declare -r FORCEFSCK
+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 $?
+fsck_reboot $fsckret
status "Remounting Root Read/Write" \
mount -n -o remount,rw /
@@ -193,7 +205,10 @@ if [[ ! -L /etc/mtab ]]; then
fi
# now mount all the local filesystems
-mount_all
+run_hook sysinit_premount
+status "Mounting Local Filesystems" \
+ mount_all
+run_hook sysinit_postmount
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw
[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
@@ -212,12 +227,12 @@ RANDOM_SEED=/var/lib/misc/random-seed
cp $RANDOM_SEED /dev/urandom
stat_busy "Removing Leftover Files"
- rm -rf /etc/{nologin,shutdownpid} /forcefsck /tmp/* /tmp/.* &>/dev/null
+ rm -rf /etc/{nologin,shutdownpid} /forcefsck /tmp/* /tmp/.* /var/run/daemons &>/dev/null
[[ ! -L /var/lock ]] && rm -rf /var/lock/*
- [[ ! -L /var/run && -d /var/run ]] && find /var/run/ \! -type d -delete
- [[ ! -L /var/run && ! -L /var/run/daemons ]] &&
- rm -rf /var/run/daemons &&
+ if [[ ! -L /var/run && -d /var/run ]]; then
+ find /var/run/ \! -type d -delete
ln -s /run/daemons /var/run/daemons
+ fi
install -Tm 0664 -o root -g utmp <(:) /var/run/utmp
# Keep {x,k,g}dm happy with xorg
mkdir -m 1777 /tmp/.{X11,ICE}-unix
@@ -231,7 +246,7 @@ fi
# Flush old locale settings and set user defined locale
stat_busy "Setting Locale: ${LOCALE:=en_US}"
echo "export LANG=$LOCALE" > /etc/profile.d/locale.sh &&
- chmod 0755 /etc/profile.d/locale.sh && stat_done || stat_fail
+chmod 0755 /etc/profile.d/locale.sh && stat_done || stat_fail
if [[ ${LOCALE,,} =~ utf ]]; then
stat_busy "Setting Consoles to UTF-8 mode"