From b403c7d0407727f2cc52b4bd0894c01785709005 Mon Sep 17 00:00:00 2001 From: Filippo Bedendo Bordon Date: Thu, 9 Feb 2012 19:12:11 +0100 Subject: [PATCH] Add check for the exit code of fdisk --- src/usbinstall.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/usbinstall.sh b/src/usbinstall.sh index 10ae151..99c97fb 100755 --- a/src/usbinstall.sh +++ b/src/usbinstall.sh @@ -175,8 +175,7 @@ org.freedesktop.UDisks.Device DeviceIsMounted` if [ "$DEVICEISMOUNTED" = "true" ]; then LANG=C udisks --unmount ${SELECT_USB}1 | grep failed && { - echo "Error: fail to umount the usb key (${SELECT_USB}1)" - exit 1 + errorAndExit "Error: fail to umount the usb key (${SELECT_USB}1)" } fi set_pbar 2 @@ -184,7 +183,11 @@ set_pbar 2 set_status "Formattazione della chiavetta in corso..." sudo fdisk $SELECT_USB < ./fdisk_template +if [ "$?" != "0" ]; then + errorAndExit "Error: fdisk ended with error" +fi set_pbar 5 + sudo mkfs.ext3 ${SELECT_USB}1 -L openmamba_live sleep 1 LANG=C udisks --mount ${SELECT_USB}1