Checks if extensions are correct (gz and iso)

This commit is contained in:
Filippo Bedendo Bordon 2012-02-18 15:35:19 +01:00
parent b403c7d040
commit 108989085b

View File

@ -149,6 +149,10 @@ if [ -f "$2" ]; then # Check if is a file
else else
errorAndExit "Error(Arg 2): \"$2\" isn't a regular file" 1 errorAndExit "Error(Arg 2): \"$2\" isn't a regular file" 1
fi 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 # Check if Arg 3 is valid
if [ -f "$3" ]; then # Check if is a file if [ -f "$3" ]; then # Check if is a file
@ -160,6 +164,10 @@ if [ -f "$3" ]; then # Check if is a file
else else
errorAndExit "Error(Arg 3): \"$3\" isn't a regular file" 1 errorAndExit "Error(Arg 3): \"$3\" isn't a regular file" 1
fi 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)##################################### #################################(INITIAL-CHECK)#####################################
@ -184,7 +192,7 @@ set_pbar 2
set_status "Formattazione della chiavetta in corso..." set_status "Formattazione della chiavetta in corso..."
sudo fdisk $SELECT_USB < ./fdisk_template sudo fdisk $SELECT_USB < ./fdisk_template
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
errorAndExit "Error: fdisk ended with error" errorAndExit "Error: fdisk exit with error"
fi fi
set_pbar 5 set_pbar 5