diff options
author | Thomas Bächler <thomas@archlinux.org> | 2009-08-25 12:57:02 +0200 |
---|---|---|
committer | Thomas Bächler <thomas@archlinux.org> | 2009-08-25 12:57:02 +0200 |
commit | cfabb85924f35c636550609b332d088aaae9941f (patch) | |
tree | db508828fde2166a8accfd3251da461642812057 /rc.single | |
parent | 76bb11cb8b5374ff2bba79afc80c408f61779f0c (diff) | |
download | initscripts-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.single')
-rwxr-xr-x | rc.single | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -6,6 +6,8 @@ . /etc/rc.conf . /etc/rc.d/functions +run_hook start rc.single + if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then # Find daemons NOT in the DAEMONS array. Shut these down first if [ -d /var/run/daemons ]; then @@ -26,6 +28,8 @@ if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then fi if [ "$PREVLEVEL" != "N" ]; then + run_hook prekillall rc.single + # Terminate all processes stat_busy "Sending SIGTERM To Processes" /sbin/killall5 -15 &> /dev/null @@ -37,10 +41,14 @@ if [ "$PREVLEVEL" != "N" ]; then /bin/sleep 1 stat_done + run_hook postkillall rc.single + stat_busy "Starting UDev Daemon" /sbin/udevd --daemon stat_done + run_hook udevlaunched rc.single + # Trigger udev uevents if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then stat_busy "Triggering UDev uevents" @@ -55,6 +63,8 @@ if [ "$PREVLEVEL" != "N" ]; then stat_done fi + run_hook udevsettled rc.single + # try syslog-NG first, then fall back to good ol' syslogd if [ -x /etc/rc.d/syslog-ng ]; then /etc/rc.d/syslog-ng start @@ -64,6 +74,8 @@ if [ "$PREVLEVEL" != "N" ]; then fi fi +run_hook end rc.single + if [ "$RUNLEVEL" = "1" ]; then printsep printhl "Entering single-user mode..." |