]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Better trap at kvmx-create
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 14 Jun 2018 00:16:26 +0000 (21:16 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 14 Jun 2018 00:16:26 +0000 (21:16 -0300)
kvmx-create

index 59e411778e946e531a8a310157d02a42f723901c..eafd489e5692224d76198eca60ac2948173fca0d 100755 (executable)
@@ -260,7 +260,7 @@ function kvmx_create_custom {
   kvmx_sudo_run mount ${device}${partition_prefix}2 $WORK/
 
   # Trap $WORK umount
-  trap 'umount $WORK && rmdir $WORK' INT TERM
+  trap 'if [ -e "$WORK" ]; then umount $WORK && rmdir $WORK; fi' INT TERM
 
   # Non-interactive installation
   APT_INSTALL="kvmx_sudo_run chroot $WORK/ apt-get install -y"