@@ -7,13 +7,14 @@ DIR="/home/ravioli/newdisk-automator"
PROGRAM_NAME="$0"
+parse_arguments $@
+
DEVICE=$1
SWAP_SIZE=$2
CONDOR_SIZE=$3
TEMP_SIZE=$4
VM_SIZE=$5
-fatal 2
# checking if the disk is used
if [ ! -e ${DEVICE} ] ; then
@@ -1,6 +1,19 @@
parse_arguments()
{
- if [ $# -lt 1 ] || [ $# -gt 5 ]; then
- fatal EUSAGE
+ while getopts ":fh" o; do
+ case $o in
+ f) FORCE=1;;
+ h) help && exit 0;;
+ \?) usage && exit;;
+ esac
+ done
+ shift `expr $OPTIND - 1`
+ if [ $# -eq 1 ]; then
+ default
+ elif [ $# -eq 5 ] && [ $FORCE -ne 1 ]; then
+ manual
+ else
+ usage && exit
fi
}