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

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Sat Jun 25 18:32:32 EDT 2011


Dave Reisner, 2011-06-25 20:15:
> 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.

Yes i know, but there are more things (like quoting within double 
brackets) which aren't needed, but might look better at least for the 
less experienced people.
>
>>
>>   # 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.

$fsckret has to be exposed to the hook to allow a splash system to 
switch back to the text console for showing the reboot messages when 
fsck failed. I'll just define it read-only.
>
> Please try not to mix whitespace with code changes, as well.
>
> d

OK. I promises to do my very best.
-- 
Kurt


More information about the arch-projects mailing list