]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
TEST-99-RPM test trap
authorHarald Hoyer <harald@redhat.com>
Mon, 9 Jul 2012 18:44:48 +0000 (20:44 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 9 Jul 2012 18:44:48 +0000 (20:44 +0200)
test/TEST-99-RPM/test.sh

index 25c18956195d6457a878ac1bbd239203407a6448..66f0bebd009f0cc48c5795fb66773707e96f5632 100755 (executable)
@@ -14,6 +14,9 @@ test_run() {
     mkdir -p "$rootdir/sys"
     mkdir -p "$rootdir/dev"
 
+trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit $ret;' EXIT
+trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf "$rootdir"; }; exit 1;' SIGINT
+
     mount --bind /proc "$rootdir/proc"
     mount --bind /sys "$rootdir/sys"
     mount -t devtmpfs devtmpfs "$rootdir/dev"