shutdown/shutdown.sh: loop over shutdown hooks until all succeed

Up until now, _check_shutdown() returns true if at least one of
the shutdown hooks succeeded. Change this to only return true if
*all* succeeded. To prevent an infinite loop, introduce an upper
bound of 40 iterations.
master
Lukas Wunner 2014-10-06 13:43:58 +02:00
parent 7e50abfdb8
commit b09faad877
1 changed files with 6 additions and 3 deletions

View File

@ -90,16 +90,19 @@ _check_shutdown() {
( . "$__f" $1 ) ( . "$__f" $1 )
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
rm -f -- $__f rm -f -- $__f
else
__s=0 __s=0
fi fi
done done
return $__s return $__s
} }


while _check_shutdown; do _cnt=0
: while [ $_cnt -le 40 ]; do
_check_shutdown || break
_cnt=$(($_cnt+1))
done done
_check_shutdown final [ $_cnt -ge 40 ] && _check_shutdown final


getarg 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before shutdown" getarg 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before shutdown"