mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 22:51:03 +02:00
fix(core_upload_update): Add to au-generator.zip, move some operations.
Add core_upload_update to au-generator.zip which requires some extra logic to make it runnable anywhere it may be. To organize the code a little better all the delta_generator calls have been moved to cros_generate_update_payload. core_upload_update is now just a wrapper around cros_generate_update_payload and core-admin.
This commit is contained in:
parent
12935743b6
commit
c9a6956f6f
@ -22,6 +22,7 @@ STATIC_FILES = ['/usr/bin/old_bins/cgpt',
|
|||||||
'~/trunk/.repo/manifests/version.txt',
|
'~/trunk/.repo/manifests/version.txt',
|
||||||
'~/trunk/src/scripts/chromeos-common.sh',
|
'~/trunk/src/scripts/chromeos-common.sh',
|
||||||
'~/trunk/src/scripts/common.sh',
|
'~/trunk/src/scripts/common.sh',
|
||||||
|
'~/trunk/src/scripts/core_upload_update',
|
||||||
]
|
]
|
||||||
|
|
||||||
DYNAMIC_EXECUTABLES = ['/usr/bin/delta_generator',
|
DYNAMIC_EXECUTABLES = ['/usr/bin/delta_generator',
|
||||||
|
@ -5,6 +5,9 @@
|
|||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
|
|
||||||
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
||||||
|
# We have to simple-mindedly set GCLIENT_ROOT in case we're running from
|
||||||
|
# au-generator.zip because common.sh will fail while auto-detect it.
|
||||||
|
export GCLIENT_ROOT=$(readlink -f "${SCRIPT_ROOT}/../../")
|
||||||
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
||||||
|
|
||||||
DEFINE_string image "${SRC_ROOT}/build/images/amd64-generic/latest/${COREOS_BASE_IMAGE_NAME}" \
|
DEFINE_string image "${SRC_ROOT}/build/images/amd64-generic/latest/${COREOS_BASE_IMAGE_NAME}" \
|
||||||
@ -42,24 +45,24 @@ switch_to_strict_mode
|
|||||||
[[ -z "${FLAGS_private_key}" ]] && die "--private_key is required"
|
[[ -z "${FLAGS_private_key}" ]] && die "--private_key is required"
|
||||||
[[ -z "${FLAGS_public_key}" ]] && die "--public_key is required"
|
[[ -z "${FLAGS_public_key}" ]] && die "--public_key is required"
|
||||||
|
|
||||||
# Put our public key in a place that update_engine can find it
|
OUTPUT_DIR=$(mktemp -d)
|
||||||
${SRC_ROOT}/platform/vboot_reference/scripts/image_signing/insert_au_publickey.sh ${FLAGS_image} ${FLAGS_public_key}
|
trap "rm -rf ${OUTPUT_DIR}" INT TERM EXIT
|
||||||
|
|
||||||
# Generate a payload and sign it with our private key
|
# Generate a payload and sign it with our private key
|
||||||
cros_generate_update_payload --image ${FLAGS_image} --output /tmp/update.gz \
|
cros_generate_update_payload \
|
||||||
--private_key ${FLAGS_private_key}
|
--image "${FLAGS_image}" \
|
||||||
|
--output "${OUTPUT_DIR}/update.gz" \
|
||||||
# Verify that the payload signature is OK
|
--metadata_output "${OUTPUT_DIR}/update.metadata" \
|
||||||
delta_generator -in_file /tmp/update.gz -public_key ${FLAGS_public_key}
|
--private_key "${FLAGS_private_key}" \
|
||||||
|
--public_key "${FLAGS_public_key}" \
|
||||||
# Generate the metadata payload
|
--outside_chroot
|
||||||
delta_generator -out_metadata /tmp/update.metadata -private_key ${FLAGS_private_key} \
|
|
||||||
-in_file /tmp/update.gz
|
|
||||||
|
|
||||||
MD5SUM=$(md5sum ${FLAGS_image} | cut -f1 -d" ")
|
MD5SUM=$(md5sum ${FLAGS_image} | cut -f1 -d" ")
|
||||||
gsutil cp /tmp/update.gz gs://update-storage.core-os.net/${FLAGS_track}/$MD5SUM/update.gz
|
gsutil cp "${OUTPUT_DIR}/update.gz" \
|
||||||
|
gs://update-storage.core-os.net/${FLAGS_track}/$MD5SUM/update.gz
|
||||||
CORE_UPDATE_URL="https://core-api.appspot.com" core-admin new-version \
|
CORE_UPDATE_URL="https://core-api.appspot.com" core-admin new-version \
|
||||||
-k ${FLAGS_api_key} -v ${FLAGS_version} \
|
-k ${FLAGS_api_key} \
|
||||||
-a ${FLAGS_app_id} \
|
-a ${FLAGS_app_id} \
|
||||||
-m /tmp/update.metadata \
|
-v ${FLAGS_version} \
|
||||||
-t ${FLAGS_track} -p $MD5SUM /tmp/update.gz
|
-m "${OUTPUT_DIR}/update.metadata" \
|
||||||
|
-t ${FLAGS_track} -p $MD5SUM "${OUTPUT_DIR}/update.gz"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user