Parse command line arguments in common.sh
[ext/instance-debootstrap.git] / create.in
index 8426d92..2212286 100755 (executable)
--- a/create.in
+++ b/create.in
@@ -46,30 +46,7 @@ fi
 DPKG_ARCH=${ARCH:-`dpkg --print-architecture`}
 CACHE_FILE="$CACHE_DIR/cache-${SUITE}-${DPKG_ARCH}.tar"
 
-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