Parse command line arguments in common.sh
[ext/instance-debootstrap.git] / import
diff --git a/import b/import
index 90fd7ff..0207fa6 100755 (executable)
--- a/import
+++ b/import
 
 set -e
 
-TEMP=`getopt -o i:b:s: -n '$0' -- "$@"`
-
-if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
-
-# Note the quotes around `$TEMP': they are essential!
-eval set -- "$TEMP"
-
-while true; do 
-       case "$1" in
-               -i) instance=$2; shift 2;;
-
-               -b) blockdev=$2; shift 2;;
-
-               -s) swapdev=$2; shift 2;;
-
-               --) shift; break;;
-
-               *)  echo "Internal error!"; exit 1;;
-       esac
-done
-if [ -z "$instance" -o -z "$blockdev" -o -z "$swapdev" ]; then
-       echo "Missing -i or -b or -s argument!"
-       exit 1
-fi
+. common.sh
 
 mkswap $swapdev
 mke2fs -Fjq $blockdev