[arch-projects] [initscripts] [PATCH 05/11] functions/rc.sysinit: Use $1 for determining hooks in fsck_all/mount_all
Kurt J. Bosch
kjb-temp-2009 at alpenjodel.de
Sat Jul 2 14:44:23 EDT 2011
We can't assume to be called from sysinit because we actually introduced the functions for customization. So just do it the same way as in kill_everything() and udevd_modprobe().
---
functions | 13 +++++++++----
rc.sysinit | 4 ++--
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/functions b/functions
index 853a6ae..96df7d0 100644
--- a/functions
+++ b/functions
@@ -365,13 +365,15 @@ NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuse
# Check local filesystems
fsck_all() {
+ # $1 = where we are being called from.
+ # This is used to determine which hooks to run.
FSCK_OUT=/dev/stdout
FSCK_ERR=/dev/stdout
FSCK_FD=
FORCEFSCK=
[[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-- -f"
- run_hook sysinit_prefsck
+ run_hook "$1_prefsck"
if [[ -x $(type -P fsck) ]]; then
stat_busy "Checking Filesystems"
@@ -382,7 +384,7 @@ fsck_all() {
local -r fsckret=0
fi
- run_hook sysinit_postfsck
+ run_hook "$1_postfsck"
return $fsckret
}
@@ -423,12 +425,15 @@ fsck_reboot() {
}
mount_all() {
- run_hook sysinit_premount
+ # $1 = where we are being called from.
+ # This is used to determine which hooks to run.
+
+ run_hook "$1_premount"
status "Mounting Local Filesystems" \
mount -a -t $NETFS -O no_netdev
- run_hook sysinit_postmount
+ run_hook "$1_postmount"
}
bootlogd_stop() {
diff --git a/rc.sysinit b/rc.sysinit
index 7b086fa..b6612ff 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -174,7 +174,7 @@ if [[ -f /etc/crypttab && $CS ]] && grep -q ^[^#] /etc/crypttab; then
fi
# Check filesystems
-fsck_all
+fsck_all sysinit
# Single-user login and/or automatic reboot if needed
fsck_reboot $?
@@ -193,7 +193,7 @@ if [[ ! -L /etc/mtab ]]; then
fi
# now mount all the local filesystems
-mount_all
+mount_all sysinit
# enable monitoring of lvm2 groups, now that the filesystems are mounted rw
[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) && -d /sys/block ]] &&
--
1.7.1
More information about the arch-projects
mailing list