updates: extract usr partition when building images

The current generate_update function is now less useful, the important
part that we need is just the partition image now. Also by defaulting to
extracting the partition the old cors_generate_update which is still in
use by devserver can be removed entirely, devserver will just expect the
extracted partition image instead.
This commit is contained in:
Michael Marineau 2014-06-23 12:07:19 -07:00
parent eb605751cd
commit 7231b95af1
2 changed files with 17 additions and 0 deletions

View File

@ -34,6 +34,8 @@ DEFINE_string group "${DEFAULT_GROUP}" \
"The update group." "The update group."
DEFINE_boolean generate_update "${FLAGS_FALSE}" \ DEFINE_boolean generate_update "${FLAGS_FALSE}" \
"Generate update payload. (prod only)" "Generate update payload. (prod only)"
DEFINE_boolean extract_update "${FLAGS_TRUE}" \
"Extract the /usr partition for generating updates."
DEFINE_string developer_data "" \ DEFINE_string developer_data "" \
"Insert a custom cloudinit file into the image." "Insert a custom cloudinit file into the image."
@ -151,6 +153,9 @@ fi
if [[ "${DEV_IMAGE}" -eq 1 ]]; then if [[ "${DEV_IMAGE}" -eq 1 ]]; then
create_dev_image ${COREOS_DEVELOPER_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group} create_dev_image ${COREOS_DEVELOPER_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group}
if [[ ${FLAGS_extract_update} -eq ${FLAGS_TRUE} ]]; then
extract_update "${COREOS_DEVELOPER_IMAGE_NAME}" "${DISK_LAYOUT}"
fi
fi fi
if [[ "${CONTAINER}" -eq 1 ]]; then if [[ "${CONTAINER}" -eq 1 ]]; then
@ -161,6 +166,8 @@ if [[ "${PROD_IMAGE}" -eq 1 ]]; then
create_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group} create_prod_image ${COREOS_PRODUCTION_IMAGE_NAME} ${DISK_LAYOUT} ${FLAGS_group}
if [[ ${FLAGS_generate_update} -eq ${FLAGS_TRUE} ]]; then if [[ ${FLAGS_generate_update} -eq ${FLAGS_TRUE} ]]; then
generate_update "${COREOS_PRODUCTION_IMAGE_NAME}" ${DISK_LAYOUT} generate_update "${COREOS_PRODUCTION_IMAGE_NAME}" ${DISK_LAYOUT}
elif [[ ${FLAGS_extract_update} -eq ${FLAGS_TRUE} ]]; then
extract_update "${COREOS_PRODUCTION_IMAGE_NAME}" "${DISK_LAYOUT}"
fi fi
fi fi

View File

@ -54,6 +54,16 @@ delete_prompt() {
fi fi
} }
extract_update() {
local image_name="$1"
local disk_layout="$2"
local update_path="${BUILD_DIR}/${image_name%_image.bin}_update.bin"
"${BUILD_LIBRARY_DIR}/disk_util" --disk_layout="${disk_layout}" \
extract "${BUILD_DIR}/${image_name}" "USR-A" "${update_path}"
upload_image "${update_path}"
}
generate_update() { generate_update() {
local image_name="$1" local image_name="$1"
local disk_layout="$2" local disk_layout="$2"