aboutsummaryrefslogtreecommitdiff
path: root/rc.sysinit
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2009-08-25 12:57:02 +0200
committerThomas Bächler <thomas@archlinux.org>2009-08-25 12:57:02 +0200
commitcfabb85924f35c636550609b332d088aaae9941f (patch)
treedb508828fde2166a8accfd3251da461642812057 /rc.sysinit
parent76bb11cb8b5374ff2bba79afc80c408f61779f0c (diff)
downloadinitscripts-cfabb85924f35c636550609b332d088aaae9941f.tar.xz
Implement a hook-system that allows to add custom code to the initscripts at certain places
A function add_hook can be called from functions.d to register a hook function. The existing hooks are based on suggestions from Michael Towers (larch) and on the implementation of initscripts-extras-fbsplash which currently uses the strings passed to stat_busy and stat_done for this. More hooks can be added if requested. The implementation uses associative arrays and will thus only work with bash 4 or later
Diffstat (limited to 'rc.sysinit')
-rwxr-xr-xrc.sysinit9
1 files changed, 9 insertions, 0 deletions
diff --git a/rc.sysinit b/rc.sysinit
index f6463cc..60dcbef 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -14,6 +14,8 @@ printhl "Copyright 2007-2009 Aaron Griffin"
printhl "Distributed under the GNU General Public License (GPL)"
printsep
+run_hook start rc.sysinit
+
# mount /proc, /sys and our RAM /dev
/bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
/bin/mount -n -t proc none /proc
@@ -63,6 +65,8 @@ stat_busy "Starting UDev Daemon"
/sbin/udevd --daemon
stat_done
+run_hook udevlaunched rc.sysinit
+
# Trigger udev uevents
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
stat_busy "Triggering UDev uevents"
@@ -108,6 +112,8 @@ if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
stat_done
fi
+run_hook udevsettled rc.sysinit
+
# bring up the loopback interface
if [ -d /sys/class/net/lo ]; then
stat_busy "Bringing up loopback interface"
@@ -282,6 +288,7 @@ stat_busy "Mounting Local Filesystems"
if [ -e /proc/mounts ]; then
/bin/grep -e "/proc " -e "/sys " -e "/dev " /proc/mounts >> /etc/mtab
fi
+run_hook premount rc.sysinit
# now mount all the local filesystems
/bin/mount -a -t $NETFS -O no_netdev
stat_done
@@ -412,5 +419,7 @@ fi
/bin/dmesg >| /var/log/dmesg.log
+run_hook end rc.sysinit
+
# End of file
# vim: set ts=2 noet: