From 93a1461ba77603e51fe8fc9fa0c021e81b84917d Mon Sep 17 00:00:00 2001 From: Jannis Pohlmann Date: Mon, 26 Mar 2012 13:28:34 +0000 Subject: Clear traps before exiting, explicitly umount before reboot. The sync calls should not be needed, so I'm dropping them as well. --- tbdiff-switch/tbdiff-switch | 12 +++++++++--- tbdiff-update/tbdiff-update | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/tbdiff-switch/tbdiff-switch b/tbdiff-switch/tbdiff-switch index 12a00b3..b076354 100755 --- a/tbdiff-switch/tbdiff-switch +++ b/tbdiff-switch/tbdiff-switch @@ -34,7 +34,7 @@ fi # mount the root btrfs file system rootfs="$(busybox mktemp -d)" mount -t btrfs "$device" "$rootfs" -trap "cd /; umount $rootfs; busybox rm -rf $rootfs" EXIT SIGINT SIGTERM +trap "cd /; umount $rootfs && busybox rm -rf $rootfs" EXIT SIGINT SIGTERM # switch into the root file system cd "$rootfs" @@ -67,11 +67,17 @@ echo "Configuring extlinux to boot from \"$target_subvolume-run\"" busybox sed -i -e "s,factory-run,$target_subvolume-run,g" "extlinux.conf" +# clear the traps +trap EXIT SIGINT SIGTERM + # leave the root file system cd / -# perform a sync to make sure everything has been written -busybox sync +# unmount the root file system +umount "$rootfs" + +# remove the temporary directory +rm -rf "$rootfs" # reboot the system busybox reboot diff --git a/tbdiff-update/tbdiff-update b/tbdiff-update/tbdiff-update index 21373d8..1014a3c 100755 --- a/tbdiff-update/tbdiff-update +++ b/tbdiff-update/tbdiff-update @@ -43,7 +43,7 @@ fi # mount the root btrfs file system rootfs="$(busybox mktemp -d)" mount -t btrfs "$device" "$rootfs" -trap "cd /; umount $rootfs; busybox rm -rf $rootfs" EXIT SIGINT SIGTERM +trap "cd /; umount $rootfs && busybox rm -rf $rootfs" EXIT SIGINT SIGTERM # switch into the root file system cd "$rootfs" @@ -107,11 +107,17 @@ echo "Configuring extlinux to boot from \"$target_subvolume-run\"" busybox sed -i -e "s,factory-run,$target_subvolume-run,g" "extlinux.conf" +# clear the traps +trap EXIT SIGINT SIGTERM + # leave the root file system cd / -# perform a sync to make sure everything has been written -busybox sync +# unmount the root file system +umount "$rootfs" + +# remove the temporary directory +rm -rf "$rootfs" # reboot the system busybox reboot -- cgit v1.2.1