chiark / gitweb /
buildd-reboot: Write 'delete-on-reboot' to no-daemon-please only when the buildd...
authorPeter Palfrader <peter@palfrader.org>
Mon, 26 Oct 2009 08:39:40 +0000 (09:39 +0100)
committerPeter Palfrader <peter@palfrader.org>
Mon, 26 Oct 2009 08:39:40 +0000 (09:39 +0100)
buildd-reboot
debian/changelog

index 237fb8b8b0e38304872e629501a532f121ae295a..dc45094b71ad242a4bca922882536f60d283e76f 100755 (executable)
@@ -79,6 +79,9 @@ buildd_wait_and_reboot() {
                echo
        fi
 
+       if grep 'waiting-for-clean-shutdown' ~buildd/NO-DAEMON-PLEASE > /dev/null; then
+               sudo -u buildd sh -c 'echo delete-on-boot > ~buildd/NO-DAEMON-PLEASE'
+       fi
        if [ "$halt" = 1 ]; then
                /sbin/shutdown -h 15 "$reason"
        else
@@ -103,13 +106,17 @@ if ! test -e ~buildd/NO-DAEMON-PLEASE; then
        if [ -e ~buildd/build/buildd.pid ] ; then
                echo "Touching ~buildd/NO-DAEMON-PLEASE ~buildd/EXIT-DAEMON-PLEASE"
                sudo -u buildd touch ~buildd/NO-DAEMON-PLEASE ~buildd/EXIT-DAEMON-PLEASE
-               sudo -u buildd sh -c 'echo delete-on-boot > ~buildd/NO-DAEMON-PLEASE'
+               sudo -u buildd sh -c 'echo waiting-for-clean-shutdown > ~buildd/NO-DAEMON-PLEASE'
                sudo chgrp -v adm ~buildd/NO-DAEMON-PLEASE
 
                echo "Sending HUP to buildd"
                sudo -u buildd kill -HUP `sudo cat ~buildd/build/buildd.pid`
        else
                echo "no-daemon-please does not exist, but there is no buildd.pid file either"
+               if pgrep -u buildd -x buildd ; then
+                       echo "But there is a buildd running.  Bad?"
+                       exit 3
+               fi
        fi
 else
        echo "no-daemon-please already exists"
index 461b973f233f06c558635dca4a2b14c04bac37db..8f50be8a63461bdab074558bbbc563223534ea30 100644 (file)
@@ -1,3 +1,11 @@
+debian.org (28) stable; urgency=low
+
+  * buildd-reboot: Write 'delete-on-reboot' to no-daemon-please only
+    when the buildd has stopped cleanly.  Write
+    waiting-for-clean-shutdown while we are waiting.
+
+ -- Peter Palfrader <weasel@debian.org>  Mon, 26 Oct 2009 09:38:46 +0100
+
 debian.org (27) stable; urgency=low
 
   * buildd-reboot: Only touch no-daemon-please if there is currently a