Always enforce cleanup on exit

parent 263d6e92
......@@ -57,3 +57,9 @@ function clean_device() {
# Make sure the device is in a clean state
adb shell sync
}
function clean_exit() {
echo "I: Cleaning up because the script exited before it could finish"
unmount || true
clean || true
}
......@@ -102,6 +102,9 @@ export IMAGE_DIR=$(mktemp -d .halium-install-imgs.XXXXX)
source $LOCATION/functions/distributions.sh
source $LOCATION/functions/core.sh
# Always enforce cleanup on exit
trap clean_exit EXIT
# Start installer
echo "Debug: Chosen rootfs is $ROOTFS_TAR"
echo "Debug: Chosen android image is $AND_IMAGE"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment