From bd1bae7c580fad65c6d73a6c104ccb8dd96ee04e Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 10 Apr 2013 12:42:00 +0100 Subject: [PATCH] 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 --- README.md | 7 +++++++ bin/disk-image-create | 4 ++-- lib/img-defaults | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 931fe2617..72e35b2ff 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,13 @@ of the element directory describing what it is for. 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 part of the process you need to customise: diff --git a/bin/disk-image-create b/bin/disk-image-create index 504565663..f45903e1c 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -94,9 +94,9 @@ echo "If prompted for sudo, install sudoers.d/img-build-sudoers into /etc/sudoer ensure_nbd 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 ? NBD_DEV=/dev/nbd0 diff --git a/lib/img-defaults b/lib/img-defaults index a1350f001..0f707cc57 100644 --- a/lib/img-defaults +++ b/lib/img-defaults @@ -19,7 +19,7 @@ FS_TYPE=${FS_TYPE:-ext4} # Used to set the file extension only at this stage. IMAGE_TYPE=${IMAGE_TYPE:-qcow2} 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. # IMAGE_ELEMENT= _BASE_ELEMENT_DIR=$(dirname $0)/../elements