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
This commit is contained in:
parent
4f97b087d5
commit
844daff526
@ -50,6 +50,7 @@ function show_options () {
|
|||||||
echo " -x -- turn on tracing"
|
echo " -x -- turn on tracing"
|
||||||
echo " -u -- uncompressed; do not compress the image - larger but faster"
|
echo " -u -- uncompressed; do not compress the image - larger but faster"
|
||||||
echo " -c -- clear environment before starting work"
|
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 " --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 " --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 " --no-tmpfs -- do not use tmpfs to speed image build"
|
||||||
@ -70,7 +71,7 @@ function show_options () {
|
|||||||
|
|
||||||
INSTALL_PACKAGES=""
|
INSTALL_PACKAGES=""
|
||||||
COMPRESS_IMAGE="true"
|
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
|
if [ $? -ne 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||||
|
|
||||||
# Note the quotes around `$TEMP': they are essential!
|
# Note the quotes around `$TEMP': they are essential!
|
||||||
@ -86,6 +87,7 @@ while true ; do
|
|||||||
-c) shift ; export CLEAR_ENV=1;;
|
-c) shift ; export CLEAR_ENV=1;;
|
||||||
-n) shift; export SKIP_BASE="1";;
|
-n) shift; export SKIP_BASE="1";;
|
||||||
-p) IFS="," read -a INSTALL_PACKAGES <<< "$2"; export INSTALL_PACKAGES ; shift 2 ;;
|
-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;;
|
--image-cache) export DIB_IMAGE_CACHE=$2; shift 2;;
|
||||||
--min-tmpfs) export DIB_MIN_TMPFS=$2; shift 2;;
|
--min-tmpfs) export DIB_MIN_TMPFS=$2; shift 2;;
|
||||||
--no-tmpfs) shift; export DIB_NO_TMPFS=1;;
|
--no-tmpfs) shift; export DIB_NO_TMPFS=1;;
|
||||||
|
Loading…
Reference in New Issue
Block a user