]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
shutdown: fixed check_shutdown loop
authorHarald Hoyer <harald@redhat.com>
Wed, 20 Jul 2011 19:11:36 +0000 (21:11 +0200)
committerHarald Hoyer <harald@redhat.com>
Wed, 20 Jul 2011 19:11:36 +0000 (21:11 +0200)
modules.d/90dm/dm-shutdown.sh
modules.d/90mdraid/md-shutdown.sh
modules.d/99shutdown/shutdown

index 3e668f8b1f85ddb3b8a9eef2d412e88d4eab8cd7..80d80d0efa189efa43c1c50e366f25cbf48de7e3 100644 (file)
@@ -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
index aa89bf6e14d69fd38be50067078a66b903497b49..bc36166403d047842e3e157397e99c134d5a0b5f 100644 (file)
@@ -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
index bff29b9ef90dd9c8ac87312e045bbd4fa1524665..a31a95d39d9ecb6cd52c2f9b53ccc1939e5b3fce 100755 (executable)
@@ -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