[26519] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r25606 - trunk/debathena/config/reactivate/debian

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Jul 2 15:06:30 2012

Date: Mon, 2 Jul 2012 15:06:29 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201207021906.q62J6TBT010680@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2012-07-02 15:06:28 -0400 (Mon, 02 Jul 2012)
New Revision: 25606

Modified:
   trunk/debathena/config/reactivate/debian/changelog
   trunk/debathena/config/reactivate/debian/snapshot-run
Log:
In reactivate:
  * Recover from a 'set -e' failure in snapshot-run and don't leave
    chroots lying around if possible


Modified: trunk/debathena/config/reactivate/debian/changelog
===================================================================
--- trunk/debathena/config/reactivate/debian/changelog	2012-07-02 15:54:30 UTC (rev 25605)
+++ trunk/debathena/config/reactivate/debian/changelog	2012-07-02 19:06:28 UTC (rev 25606)
@@ -3,8 +3,10 @@
   * Update debian/copyright for 3-clause BSD and one GPL'd file
   * Ship 16killprocs-no-really to end sessions faster (Trac: #775)
   * Use new lightdm-config hooks to actually run session setup and cleanup
+  * Recover from a 'set -e' failure in snapshot-run and don't leave
+    chroots lying around if possible
 
- -- Jonathan Reed <jdreed@mit.edu>  Mon, 02 Jul 2012 10:59:02 -0400
+ -- Jonathan Reed <jdreed@mit.edu>  Mon, 02 Jul 2012 15:06:40 -0400
 
 debathena-reactivate (2.0.34) unstable; urgency=low
 

Modified: trunk/debathena/config/reactivate/debian/snapshot-run
===================================================================
--- trunk/debathena/config/reactivate/debian/snapshot-run	2012-07-02 15:54:30 UTC (rev 25605)
+++ trunk/debathena/config/reactivate/debian/snapshot-run	2012-07-02 19:06:28 UTC (rev 25606)
@@ -17,6 +17,20 @@
 # Setup
 
 session=$(schroot -c login -b)
+cleanup() {
+    # Teardown
+
+    # Remove file from above.
+    # (This also gets nuked in reactivate, but be paranoid)
+    rm -f /tmp/ticketenv
+
+    for daemon in $daemons; do
+	schr invoke-rc.d "$daemon" stop || [ $? = 100 ]
+    done
+
+    schroot -c "$session" -e
+}
+trap 'cleanup' EXIT
 sch() { schroot -r -c "$session" -- "$@"; }          # Run in the chroot
 schq() { schroot -q -r -c "$session" -- "$@"; }      # Run in the chroot quietly
 schr() { schroot -r -c "$session" -u root -- "$@"; } # Run in the chroot as root
@@ -61,14 +75,3 @@
 schroot -c "$session" -r -p -- sudo -E -u "$USER" -- "$@"
 cd /
 
-# Teardown
-
-# Remove file from above.
-# (This also gets nuked in reactivate, but be paranoid)
-rm -f /tmp/ticketenv
-
-for daemon in $daemons; do
-    schr invoke-rc.d "$daemon" stop || [ $? = 100 ]
-done
-
-schroot -c "$session" -e


home help back first fref pref prev next nref lref last post