From c051c8c859cea2f10228e9c2845e25f98768ef64 Mon Sep 17 00:00:00 2001 From: Simon Ott Date: Wed, 7 Aug 2024 11:16:30 +0000 Subject: [PATCH] example-setup: update manifest generation script Signed-off-by: Simon Ott --- example-setup/update-container-manifest-live | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/example-setup/update-container-manifest-live b/example-setup/update-container-manifest-live index a9294082..b44310a6 100755 --- a/example-setup/update-container-manifest-live +++ b/example-setup/update-container-manifest-live @@ -48,6 +48,7 @@ input="${data}/metadata-raw" tmp="${data}/metadata-tmp" output="${data}/metadata-signed" runtime="${cmc}/tools/containerd-shim-cmc-v1/containerd-shim-cmc-v1" +runc_config="/etc/runc.json" target="${target%/}" @@ -57,6 +58,18 @@ echo "Using ${data} as directory for local data" # Delete temporary manifests rm -rf "${tmp}"/* +# Temporarily configure runc to generate reference values +if [ ! -f "${runc_config}" ]; then + exists=false + sudo printf "{\"generateRefVals\":\"true\"}" > "${runc_config}" +else + exists=true + json=$(cat "${runc_config}") + original_json=${json} + json=$(echo "$json" | jq '.generateRefVals = true') + echo "${json}" | sudo tee "${runc_config}" +fi + # Calculate the container reference values sudo rm -f /tmp/container-refs @@ -99,6 +112,17 @@ else exit fi +# Restore the original runc config +if [ "${exists}" = true ] ; then + echo "WRITING BACK ${original_json}" + echo "${original_json}" | sudo tee "${runc_config}" +else + sudo rm "${runc_config}" +fi + +echo "RESTORED" +jq . "${runc_config}" + refvals=$(cat /tmp/container-refs) # if containers not set, set it to the single container