From: Lukas Wunner Date: Mon, 6 Oct 2014 11:43:58 +0000 (+0200) Subject: shutdown/shutdown.sh: loop over shutdown hooks until all succeed X-Git-Tag: 041~97^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F28%2Fhead;p=thirdparty%2Fdracut.git 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. --- diff --git a/modules.d/99shutdown/shutdown.sh b/modules.d/99shutdown/shutdown.sh index 6e5e559f9..98eab1d88 100755 --- a/modules.d/99shutdown/shutdown.sh +++ b/modules.d/99shutdown/shutdown.sh @@ -90,16 +90,19 @@ _check_shutdown() { ( . "$__f" $1 ) if [ $? -eq 0 ]; then rm -f -- $__f + else __s=0 fi done return $__s } -while _check_shutdown; do -: +_cnt=0 +while [ $_cnt -le 40 ]; do + _check_shutdown || break + _cnt=$(($_cnt+1)) done -_check_shutdown final +[ $_cnt -ge 40 ] && _check_shutdown final getarg 'rd.break=shutdown' && emergency_shell --shutdown shutdown "Break before shutdown"