Use cleanup function to trap errors
This commit is contained in:
parent
60c1d07538
commit
00bf130052
@ -46,7 +46,11 @@ fi
|
|||||||
# Cleanup function
|
# Cleanup function
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
umount_kill "$PWD/mnt" || :
|
errval=$?
|
||||||
|
trap - ERR
|
||||||
|
trap
|
||||||
|
umount_kill "$PWD/mnt" || true
|
||||||
|
exit $errval
|
||||||
}
|
}
|
||||||
trap cleanup ERR
|
trap cleanup ERR
|
||||||
|
|
||||||
@ -66,7 +70,7 @@ export INSTALLDIR=mnt
|
|||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Run qubeize script
|
# Run qubeize script
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
"$SCRIPTSDIR/04_install_qubes.sh" || { umount "$INSTALLDIR"; exit 1; }
|
"$SCRIPTSDIR/04_install_qubes.sh"
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# Create App Menus
|
# Create App Menus
|
||||||
@ -110,7 +114,7 @@ fi
|
|||||||
# Finsh - unmount image
|
# Finsh - unmount image
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
echo "--> Unmounting $IMG"
|
echo "--> Unmounting $IMG"
|
||||||
cleanup
|
umount_kill "$PWD/mnt" || true
|
||||||
|
|
||||||
echo "Qubeized image stored at: $IMG"
|
echo "Qubeized image stored at: $IMG"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user