diff --git a/bin/disk-image-create b/bin/disk-image-create index 793431b8..5b463e7a 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -42,13 +42,15 @@ if [ "$SCRIPTNAME" == "ramdisk-image-create" ]; then fi function show_options () { + echo "Usage: ${SCRIPTNAME} [OPTION]... [ELEMENT]..." + echo echo "Options:" - echo " -a i386|amd64|armhf -- set the architecture of the image" - echo " -o filename -- set the name of the output file" + echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)" + echo " -o imagename -- set the imagename of the output image file(default image)" echo " -x -- turn on tracing" echo " -u -- uncompressed; do not compress the image - larger but faster" echo " -c -- clear environment before starting work" - echo " --image-cache directory -- location for cached images (~/.cache/image-create)" + echo " --image-cache directory -- location for cached images(default ~/.cache/image-create)" echo " --min-tmpfs size -- minimum size in GB needed in tmpfs to build the image" echo " --no-tmpfs -- do not use tmpfs to speed image build" echo " --offline -- do not update cached resources" @@ -56,15 +58,20 @@ function show_options () { echo " -n skip the default inclusion of the 'base' element" echo " -p package[,package,package] -- list of packages to install in the image" fi + echo " -h|--help -- display this help and exit" echo echo "ELEMENTS_PATH will allow you to specify multiple locations for the elements." - exit 0 + echo + echo "Examples:" + echo " ${SCRIPTNAME} -a amd64 -o ubuntu-amd64 vm ubuntu" + echo " export ELEMENTS_PATH=~/source/tripleo-image-elements/elements" + echo " ${SCRIPTNAME} -a amd64 -o fedora-amd64-heat-cfntools vm fedora heat-cfntools" } INSTALL_PACKAGES="" COMPRESS_IMAGE="true" -TEMP=`getopt -o a:ho:xucnp: -l no-tmpfs,offline,min-tmpfs: -n $SCRIPTNAME -- "$@"` -if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi +TEMP=`getopt -o a:ho:xucnp: -l no-tmpfs,offline,help,min-tmpfs: -n $SCRIPTNAME -- "$@"` +if [ $? -ne 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" @@ -73,7 +80,7 @@ while true ; do case "$1" in -a) export ARCH=$2; shift 2 ;; -o) export IMAGE_NAME=$2; shift 2 ;; - -h) show_options;; + -h|--help) show_options; exit 0;; -x) shift; set -x;; -u) shift; export COMPRESS_IMAGE="";; -c) shift ; export CLEAR_ENV=1;;