Introduce the DIB_ namespace for build-time config.

Document the use of DIB_ as a prefix on environmental variables that can
be overridden at build time.

Introduce the first such variable by migrating IMAGE_SIZE to
DIB_IMAGE_SIZE.

Change-Id: Ie36b734991b913a23f37f2add47d470d7c1576e4
This commit is contained in:
Chris Jones 2013-04-10 12:42:00 +01:00
parent 169382246b
commit bd1bae7c58
3 changed files with 10 additions and 3 deletions

View File

@ -98,6 +98,13 @@ of the element directory describing what it is for.
Writing an element Writing an element
----------------- -----------------
Conform to the following conventions:
* Use the environment for overridable defaults, prefixing environment variable
names with "DIB\_". For example: DIB\_MYDEFAULT=${DIB\_MYDEFAULT:-default}
If you do not use the DIB\_ prefix you may find that your overrides are
discarded as the build environment is sanitised.
Make as many of the following subdirectories as you need, depending on what Make as many of the following subdirectories as you need, depending on what
part of the process you need to customise: part of the process you need to customise:

View File

@ -94,9 +94,9 @@ echo "If prompted for sudo, install sudoers.d/img-build-sudoers into /etc/sudoer
ensure_nbd ensure_nbd
mk_build_dir mk_build_dir
eval_run_d block-device-size "IMAGE_SIZE=" eval_run_d block-device-size "DIB_IMAGE_SIZE="
qemu-img create -f qcow2 -o preallocation=metadata $TMP_IMAGE_PATH ${IMAGE_SIZE}G qemu-img create -f qcow2 -o preallocation=metadata $TMP_IMAGE_PATH ${DIB_IMAGE_SIZE}G
# Should have a grab-next-dev helper ? # Should have a grab-next-dev helper ?
NBD_DEV=/dev/nbd0 NBD_DEV=/dev/nbd0

View File

@ -19,7 +19,7 @@ FS_TYPE=${FS_TYPE:-ext4}
# Used to set the file extension only at this stage. # Used to set the file extension only at this stage.
IMAGE_TYPE=${IMAGE_TYPE:-qcow2} IMAGE_TYPE=${IMAGE_TYPE:-qcow2}
IMAGE_NAME=${IMAGE_NAME:-image} IMAGE_NAME=${IMAGE_NAME:-image}
export IMAGE_SIZE=${IMAGE_SIZE:-2} # N.B. This size is in GB export DIB_IMAGE_SIZE=${DIB_IMAGE_SIZE:-2} # N.B. This size is in GB
# Set via the CLI normally. # Set via the CLI normally.
# IMAGE_ELEMENT= # IMAGE_ELEMENT=
_BASE_ELEMENT_DIR=$(dirname $0)/../elements _BASE_ELEMENT_DIR=$(dirname $0)/../elements