blob: 6db5bc98a08fd0277f68c05db423a411ca117177 [file] [log] [blame]
# Copyright 2023 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Updates reference VM data dependencies in tast-tests.
set -eu
trap 'rm -rf "${tmpfile}"' EXIT
repodir="$(repo list -pf chromiumos/platform/tast-tests)"
echo "Finding latest refvm image..."
dir="$(gsutil ls -d 'gs://refvm-images/????-??' | tail -n 1)"
obj="$(gsutil ls "${dir}" | tail -n 1)"
echo "Downloading ${obj} to temporary file..."
gsutil -q cp "${obj}" "${tmpfile}"
echo "Updating refvm.qcow2.external..."
sum="$(sha256sum "${tmpfile}" | cut -d ' ' -f 1)"
size="$(stat -c %s "${tmpfile}")"
cat > "${datadir}/refvm.qcow2.external" << EOF
"sha256sum": "${sum}",
"size": ${size},
"url": "${obj}"
echo "Updating refvm.qcow2.SHA256..."
brotli -d -c "${tmpfile}" | sha256sum | cut -d ' ' -f 1 > \