[arch-projects] [initscripts] [PATCH 05/12] fsck_all, kill_everything: Clean up run_hook positions

Dave Reisner d at falconindy.com
Sat Jun 25 14:15:01 EDT 2011


On Sat, Jun 25, 2011 at 12:15:57PM +0200, Kurt J. Bosch wrote:
> * run postfsck hook within stat block as for prefsck
> * run prekillall hook out of stat blocks as for postkillall
>   (revert obsolete e39ec61b7d642b36368d84f240b96eeda3c43b2f)
> ---
>  functions |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/functions b/functions
> index 9c881c1..eab2074 100644
> --- a/functions
> +++ b/functions
> @@ -283,8 +283,9 @@ kill_everything() {
>  	done
>  
>  	# Terminate all processes
> +	run_hook "${1}_prekillall"
> +	
>  	stat_busy "Sending SIGTERM To Processes"
> -	run_hook "$1_prekillall"
>  		local pid k5args=""
>  		for pid in ${omit_pids[@]}; do
>  			k5args+=" -o $pid"
> @@ -298,7 +299,7 @@ kill_everything() {
>  		/bin/sleep 1
>  	stat_done
>  
> -	run_hook "$1_postkillall"
> +	run_hook "${1}_postkillall"
>  }

variables can't start with a number, so the extra bracing isn't
necessary.

>  
>  # Start/trigger UDev, load MODULES and settle UDev
> @@ -378,13 +379,13 @@ fsck_all() {
>  		[[ -f /forcefsck ]] || in_array forcefsck $(< /proc/cmdline) && FORCEFSCK="-- -f"
>  		run_hook sysinit_prefsck
>  		fsck -A -T -C$FSCK_FD -a -t "$NETFS,noopts=_netdev" $FORCEFSCK >$FSCK_OUT 2>$FSCK_ERR
> -	local fsckret=$?
> +		local fsckret=$?
> +		run_hook sysinit_postfsck
>  	if (( fsckret > 1 )); then
>  		stat_fail
>  	else
>  		stat_done
>  	fi
> -	run_hook sysinit_postfsck
>  	return $fsckret
>  }
>  
> -- 
> 1.7.1
> 

Not a fan of this. I'd rather let the pass/fail come through before user
hooks are run. There's potential for insanity, should a user decide to
muck with the $fsckret value.

Please try not to mix whitespace with code changes, as well.

d


More information about the arch-projects mailing list