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 <geoff@infradead.org>
This commit is contained in:
Geoff Levand 2016-05-03 14:06:14 -07:00
parent bfb5618261
commit c053521e37
2 changed files with 5 additions and 2 deletions

View File

@ -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}

View File

@ -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