wait for power off sysrq to take effect (bnc#595916)
authorLudwig Nussel <ludwig.nussel@suse.de>
Wed, 14 Apr 2010 07:41:26 +0000 (09:41 +0200)
committerLudwig Nussel <ludwig.nussel@suse.de>
Wed, 14 Apr 2010 07:43:27 +0000 (09:43 +0200)
build

diff --git a/build b/build
index f4e3a45..d492eb8 100755 (executable)
--- a/build
+++ b/build
@@ -257,13 +257,19 @@ cleanup_and_exit () {
        if test "$VM_TYPE" != lxc; then
            kill -9 -1        # goodbye cruel world
            if ! test -x /sbin/halt ; then
-               mount -n -tproc none /proc
+               test -e /proc/sysrq-trigger || mount -n -tproc none /proc
                sync
                sleep 2 # like halt does
-               test -e /proc/sysrq-trigger && echo o > /proc/sysrq-trigger
+               if test -e /proc/sysrq-trigger; then
+                   echo o > /proc/sysrq-trigger
+                   sleep 5 # wait for sysrq to take effect
+               else
+                   echo "Warning: VM doesn't support sysrq and /sbin/halt not installed"
+               fi
+           else
+               halt -f -p
            fi
-           halt -f -p
-           echo "wtf? I'm still alive. File a bug as I wanted to die!"
+           echo "Warning: clean shut down of the VM didn't work"
        fi
     else
        umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true