From: Harald Hoyer Date: Wed, 20 Jul 2011 19:11:36 +0000 (+0200) Subject: shutdown: fixed check_shutdown loop X-Git-Tag: 012~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f47e0234987e7e6cfb2439e90658cb5c3b8bdef8;p=thirdparty%2Fdracut.git shutdown: fixed check_shutdown loop --- diff --git a/modules.d/90dm/dm-shutdown.sh b/modules.d/90dm/dm-shutdown.sh index 3e668f8b1..80d80d0ef 100644 --- a/modules.d/90dm/dm-shutdown.sh +++ b/modules.d/90dm/dm-shutdown.sh @@ -3,13 +3,14 @@ # ex: ts=8 sw=4 sts=4 et filetype=sh _do_dm_shutdown() { local ret + local final=$1 info "Disassembling device-mapper devices" dmsetup -v remove_all ret=$? -#info "dmsetup ls --tree" -#dmsetup ls --tree 2>&1 | vinfo + if [ "x$final" != "x" ]; then + info "dmsetup ls --tree" + dmsetup ls --tree 2>&1 | vinfo + fi return $ret } - -_do_dm_shutdown - +_do_dm_shutdown $1 diff --git a/modules.d/90mdraid/md-shutdown.sh b/modules.d/90mdraid/md-shutdown.sh index aa89bf6e1..bc3616640 100644 --- a/modules.d/90mdraid/md-shutdown.sh +++ b/modules.d/90mdraid/md-shutdown.sh @@ -3,12 +3,15 @@ # ex: ts=8 sw=4 sts=4 et filetype=sh _do_md_shutdown() { local ret + local final=$1 info "Disassembling mdraid devices." mdadm -v --stop --scan ret=$? -#info "cat /proc/mdstat" -# cat /proc/mdstat | vinfo + if [ "x$final" != "x" ]; then + info "cat /proc/mdstat" + cat /proc/mdstat | vinfo + fi return $ret } -_do_md_shutdown +_do_md_shutdown $1 diff --git a/modules.d/99shutdown/shutdown b/modules.d/99shutdown/shutdown index bff29b9ef..a31a95d39 100755 --- a/modules.d/99shutdown/shutdown +++ b/modules.d/99shutdown/shutdown @@ -64,21 +64,25 @@ while [ $_cnt -le 40 ]; do done [ $_cnt -ge 40 ] && umount_a -check_finished() { - local f - for f in $hookdir/shutdown/*.sh; do - [ -e "$f" ] || continue - ( . "$f" ) || return 1 +_check_shutdown() { + local __f + local __s=1 + for __f in $hookdir/shutdown/*.sh; do + [ -e "$__f" ] || continue + ( . "$__f" $1 ) + if [ $? -eq 0 ]; then + rm -f $__f + __s=0 + fi done - return 0 + return $__s } _cnt=0 -while [ $_cnt -le 40 ]; do - check_finished 2>/dev/null && break - _cnt=$(($_cnt+1)) +while _check_shutdown; do +: done -[ $_cnt -ge 40 ] && check_finished +_check_shutdown final getarg 'rd.break=shutdown' && emergency_shell -n cmdline "Break before shutdown" [ "$1" = "reboot" ] && reboot -f -d -n --no-wall