Harald Hoyer 2265b4
From 43bac63e33a31f4d86ca8f16b439dd33336a374b Mon Sep 17 00:00:00 2001
Harald Hoyer 2265b4
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 2265b4
Date: Mon, 9 Jul 2012 20:44:48 +0200
Harald Hoyer 2265b4
Subject: [PATCH] TEST-99-RPM test trap
Harald Hoyer 2265b4
Harald Hoyer 2265b4
---
Harald Hoyer 2265b4
 test/TEST-99-RPM/test.sh |    3 +++
Harald Hoyer 2265b4
 1 file changed, 3 insertions(+)
Harald Hoyer 2265b4
Harald Hoyer 2265b4
diff --git a/test/TEST-99-RPM/test.sh b/test/TEST-99-RPM/test.sh
Harald Hoyer 2265b4
index 25c1895..66f0beb 100755
Harald Hoyer 2265b4
--- a/test/TEST-99-RPM/test.sh
Harald Hoyer 2265b4
+++ b/test/TEST-99-RPM/test.sh
Harald Hoyer 2265b4
@@ -14,6 +14,9 @@ test_run() {
Harald Hoyer 2265b4
     mkdir -p "$rootdir/sys"
Harald Hoyer 2265b4
     mkdir -p "$rootdir/dev"
Harald Hoyer 2265b4
 
Harald Hoyer 2265b4
+trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit $ret;' EXIT
Harald Hoyer 2265b4
+trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit 1;' SIGINT
Harald Hoyer 2265b4
+
Harald Hoyer 2265b4
     mount --bind /proc "$rootdir/proc"
Harald Hoyer 2265b4
     mount --bind /sys "$rootdir/sys"
Harald Hoyer 2265b4
     mount -t devtmpfs devtmpfs "$rootdir/dev"