Take --params from environment

DIB_BLOCK_DEVICE_PARAMS_YAML should be exported, and the
dib-block-device will take this as the value of --params.  Remove this
to simplify the command-line

Change-Id: I6764ed223ecd36f9d24e19f164b6a927380b410f
This commit is contained in:
Ian Wienand 2017-05-02 12:13:01 +10:00
parent ff5b30db8a
commit 0368052a2f
2 changed files with 10 additions and 18 deletions

View File

@ -299,8 +299,7 @@ mount-base: ${TMP_BUILD_DIR}/mnt
build-dir: ${TMP_BUILD_DIR}
EOF
dib-block-device --phase=init \
--params="${DIB_BLOCK_DEVICE_PARAMS_YAML}"
dib-block-device --phase=init
create_base
# This variable needs to be propagated into the chroot
@ -425,17 +424,14 @@ if [ -z ${IMAGE_BLOCK_DEVICE} ] ; then
# After changeing the parameters, there is the need to
# re-run dib-block-device init because some value might
# change based on the new set parameters.
dib-block-device --phase=init \
--params="${DIB_BLOCK_DEVICE_PARAMS_YAML}"
dib-block-device --phase=init
# values to dib-block-device: using the YAML config and
dib-block-device --phase=create \
--params="${DIB_BLOCK_DEVICE_PARAMS_YAML}"
dib-block-device --phase=create
# It's called 'DEVICE' but it's the partition.
IMAGE_BLOCK_DEVICE=$(dib-block-device \
--phase=getval --symbol=image-block-partition \
--params="${DIB_BLOCK_DEVICE_PARAMS_YAML}")
--phase=getval --symbol=image-block-partition)
fi
export IMAGE_BLOCK_DEVICE
LOOPDEV=${IMAGE_BLOCK_DEVICE}
@ -445,8 +441,7 @@ IMAGE_BLOCK_DEVICE_WITHOUT_PART=$(echo ${IMAGE_BLOCK_DEVICE} \
export IMAGE_BLOCK_DEVICE_WITHOUT_PART
export EXTRA_DETACH="detach_loopback ${IMAGE_BLOCK_DEVICE_WITHOUT_PART}"
export EXTRA_UNMOUNT="dib-block-device --phase=cleanup \
--params=\"${DIB_BLOCK_DEVICE_PARAMS_YAML}\""
export EXTRA_UNMOUNT="dib-block-device --phase=cleanup"
sudo mkfs -t $FS_TYPE $MKFS_OPTS -L ${DIB_ROOT_LABEL} ${IMAGE_BLOCK_DEVICE}
# Tuning the rootfs uuid works only for ext filesystems.
@ -509,15 +504,13 @@ fi
# space before converting the image to some other format.
export EXTRA_UNMOUNT=""
unmount_image
TMP_IMAGE_PATH=$(dib-block-device --phase=getval --symbol=image-path \
--params="${DIB_BLOCK_DEVICE_PARAMS_YAML}")
TMP_IMAGE_PATH=$(dib-block-device --phase=getval --symbol=image-path)
export TMP_IMAGE_PATH
dib-block-device --phase=umount \
--params="${DIB_BLOCK_DEVICE_PARAMS_YAML}"
dib-block-device --phase=umount
dib-block-device --phase=cleanup \
--params="${DIB_BLOCK_DEVICE_PARAMS_YAML}"
dib-block-device --phase=cleanup
cleanup_build_dir

View File

@ -50,8 +50,7 @@ function trap_cleanup() {
}
function cleanup () {
dib-block-device --phase=umount \
--params="${DIB_BLOCK_DEVICE_PARAMS_YAML}"
dib-block-device --phase=umount
unmount_image
cleanup_build_dir
cleanup_image_dir