aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-06-13 20:41:02 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-06-13 20:41:02 -0300
commita7af79ef6aa999481425a6ec58f8e75b55216760 (patch)
tree7c49b30778e93cb41779be2bb1f3392c70f59df9
parenta2f7f37d3e8eabc7fa55485762840e9745d66b60 (diff)
downloadkvmx-a7af79ef6aa999481425a6ec58f8e75b55216760.tar.gz
kvmx-a7af79ef6aa999481425a6ec58f8e75b55216760.tar.bz2
Trap for work dir umounting
-rwxr-xr-xkvmx-create3
1 files changed, 3 insertions, 0 deletions
diff --git a/kvmx-create b/kvmx-create
index ae42c39..0375cf6 100755
--- a/kvmx-create
+++ b/kvmx-create
@@ -259,6 +259,9 @@ function kvmx_create_custom {
kvmx_sudo_run mkfs.ext4 ${device}${partition_prefix}2
kvmx_sudo_run mount ${device}${partition_prefix}2 $WORK/
+ # Trap $WORK umount
+ trap 'umount $WORK && rmdir $WORK' INT TERM
+
# Non-interactive installation
APT_INSTALL="kvmx_sudo_run chroot $WORK/ apt-get install -y"