From 6a6b942dbdd0bfb5047dd9e590b529ae351e3669 Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Tue, 1 May 2018 13:16:46 +0300 Subject: [PATCH] Handle ctrl+c and errors better --- windows2usb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/windows2usb b/windows2usb index abd47c1..493b7e6 100755 --- a/windows2usb +++ b/windows2usb @@ -100,8 +100,11 @@ function extract_iso() { } function umount_rm_path() { - umount "$1" || true - rm -r "$1" + if [ -d "$1" ]; + then + umount "$1" || true + rm -r "$1" + fi } function sigint_handler() { @@ -132,7 +135,7 @@ then partpath="$(mktemp -d /run/winiso-write.XXXXXXXXXX)" check_requirements - trap sigint_handler INT + trap sigint_handler INT EXIT # MBR if [[ "$labeltype" == "mbr" ]];