[arch-projects] [initscripts] [PATCH 19/21] functions: Clean up positions of run_hook *_{pre, post}* where in pairs

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Tue Jun 28 09:27:43 EDT 2011


Make all pairs of run_hook *_{pre,post}* surround the object they refer to in their name which is one of:
* A series of One or more status blocks performing one specific action. (like killall)
* A single command like fsck/mount.

Long story:
Currently most run_hook calls are located out of any status blocks, but in some cases we need them to be inside.
Example: Having the sysinit_prefsck hook _after_ the stat_busy allows us to save the message string before redirecting the fsck progress status into a splash status line and then restore the original message whenever fsck stops to output progress status (which is currently supported for ext[234] only AFAIK). This is actually done in fbsplash-extras (AUR).
---
 functions |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/functions b/functions
index bcc97c1..2b513cc 100644
--- a/functions
+++ b/functions
@@ -285,8 +285,9 @@ kill_everything() {
 	done
 
 	# Terminate all processes
+	run_hook "$1_prekillall"
+
 	stat_busy "Sending SIGTERM To Processes"
-		run_hook "$1_prekillall"
 		/sbin/killall5 -15 ${omit_pids[@]/#/-o } &>/dev/null
 		/bin/sleep 5
 	stat_done
@@ -374,8 +375,8 @@ fsck_all() {
 		run_hook sysinit_prefsck
 		fsck -A -T -C$FSCK_FD -a -t "$NETFS,noopts=_netdev" $FORCEFSCK >|$FSCK_OUT 2>|$FSCK_ERR
 		local -r fsckret=$?
+		run_hook sysinit_postfsck
 	(( fsckret <= 1 )) && stat_done || stat_fail
-	run_hook sysinit_postfsck
 	return $fsckret
 }
 
-- 
1.7.1



More information about the arch-projects mailing list