From 844daff5261b65c1fb12c0f13489538db62de810 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Mon, 25 Nov 2013 13:00:01 -0500 Subject: [PATCH] Add option --image-size. Adds an option for --image-size, which sets the DIB_IMAGE_SIZE environment variable. Having the cli option makes disk-image-create more consistent in that parameters are able to be specified via a flag on the command line or an environment variable. Also, you may not be able to remember all the environment variables that you can tweak, yet --help will tell you about the cli parameters. Preserves the old behavior as well where if DIB_IMAGE_SIZE is set in your environment, it will be honored. Change-Id: I195c9144a80ce7b8bd5809b57f2bed71a2cbdf26 --- bin/disk-image-create | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/disk-image-create b/bin/disk-image-create index 5b463e7a..d184e670 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -50,6 +50,7 @@ function show_options () { 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-size size -- image size in GB for the created image" 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" @@ -70,7 +71,7 @@ function show_options () { INSTALL_PACKAGES="" COMPRESS_IMAGE="true" -TEMP=`getopt -o a:ho:xucnp: -l no-tmpfs,offline,help,min-tmpfs: -n $SCRIPTNAME -- "$@"` +TEMP=`getopt -o a:ho:xucnp: -l no-tmpfs,offline,help,min-tmpfs,image-size: -n $SCRIPTNAME -- "$@"` if [ $? -ne 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! @@ -86,6 +87,7 @@ while true ; do -c) shift ; export CLEAR_ENV=1;; -n) shift; export SKIP_BASE="1";; -p) IFS="," read -a INSTALL_PACKAGES <<< "$2"; export INSTALL_PACKAGES ; shift 2 ;; + --image-size) export DIB_IMAGE_SIZE=$2; shift 2;; --image-cache) export DIB_IMAGE_CACHE=$2; shift 2;; --min-tmpfs) export DIB_MIN_TMPFS=$2; shift 2;; --no-tmpfs) shift; export DIB_NO_TMPFS=1;;