From 108989085b3cad22932596557d32fe9f7b91803b Mon Sep 17 00:00:00 2001 From: Filippo Bedendo Bordon Date: Sat, 18 Feb 2012 15:35:19 +0100 Subject: [PATCH] Checks if extensions are correct (gz and iso) --- src/usbinstall.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/usbinstall.sh b/src/usbinstall.sh index 99c97fb..040b14a 100755 --- a/src/usbinstall.sh +++ b/src/usbinstall.sh @@ -149,6 +149,10 @@ if [ -f "$2" ]; then # Check if is a file else errorAndExit "Error(Arg 2): \"$2\" isn't a regular file" 1 fi +# Check if Arg 2 is a gz file +if [ "${2##*.}" != "gz" ]; then + errorAndExit "Error(Arg 2): you must chose a cpio.gz file" 1 +fi # Check if Arg 3 is valid if [ -f "$3" ]; then # Check if is a file @@ -160,6 +164,10 @@ if [ -f "$3" ]; then # Check if is a file else errorAndExit "Error(Arg 3): \"$3\" isn't a regular file" 1 fi +# Check if Arg 3 is an iso file +if [ "${3##*.}" != "iso" ]; then + errorAndExit "Error(Arg 3): you must chose a iso file" 1 +fi #################################(INITIAL-CHECK)##################################### @@ -184,7 +192,7 @@ 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" + errorAndExit "Error: fdisk exit with error" fi set_pbar 5