From c053521e37a0e207f6eadb89a1e4e304852990a0 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Tue, 3 May 2016 14:06:14 -0700 Subject: [PATCH] build_image: Fix image type conditional PROD_IMAGE is a flag that indicates a production image should be built, and will be set for dev builds if the user specifies that both dev and prod images should be built. build_image was incorrectly using the PROD_IMAGE variable to conditionaly do some setup depending on the image type. Add a new variable IMAGE_BUILD_TYPE that can be tested for the type of image currently being built and replace the PROD_IMAGE usage. Signed-off-by: Geoff Levand --- build_image | 3 +++ build_library/build_image_util.sh | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build_image b/build_image index d2ce15e238..588da4512b 100755 --- a/build_image +++ b/build_image @@ -166,6 +166,7 @@ fi fix_mtab if [[ "${DEV_IMAGE}" -eq 1 ]]; then + IMAGE_BUILD_TYPE="dev" create_dev_image ${COREOS_DEVELOPER_IMAGE_NAME} ${DEV_DISK_LAYOUT} ${FLAGS_group} ${FLAGS_base_dev_pkg} if [[ ${FLAGS_extract_update} -eq ${FLAGS_TRUE} ]]; then extract_update "${COREOS_DEVELOPER_IMAGE_NAME}" "${DEV_DISK_LAYOUT}" @@ -173,10 +174,12 @@ if [[ "${DEV_IMAGE}" -eq 1 ]]; then fi if [[ "${CONTAINER}" -eq 1 ]]; then + IMAGE_BUILD_TYPE="container" create_dev_image "${COREOS_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_group}" ${FLAGS_base_dev_pkg} fi if [[ "${PROD_IMAGE}" -eq 1 ]]; then + IMAGE_BUILD_TYPE="prod" create_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group} ${FLAGS_base_pkg} if [[ ${FLAGS_generate_update} -eq ${FLAGS_TRUE} ]]; then generate_update "${COREOS_PRODUCTION_IMAGE_NAME}" ${DISK_LAYOUT} diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index 5c2cfb44d6..8754a41a04 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -335,7 +335,7 @@ finish_image() { fi # We only need to disable rw and apply dm-verity in prod with a /usr partition - if [ "${PROD_IMAGE}" -eq 1 ] && mountpoint -q "${root_fs_dir}/usr"; then + if [ "${IMAGE_BUILD_TYPE}" = "prod" ] && mountpoint -q "${root_fs_dir}/usr"; then local disable_read_write=${FLAGS_enable_rootfs_verification} # Unmount /usr partition @@ -377,7 +377,7 @@ finish_image() { target_list="arm64-efi" fi for target in ${target_list}; do - if [[ "${PROD_IMAGE}" -eq 1 && ${FLAGS_enable_verity} -eq ${FLAGS_TRUE} ]]; then + if [[ "${IMAGE_BUILD_TYPE}" = "prod" && ${FLAGS_enable_verity} -eq ${FLAGS_TRUE} ]]; then ${BUILD_LIBRARY_DIR}/grub_install.sh \ --target="${target}" --disk_image="${disk_img}" --verity else