argo-cd/hack/installers/compare-chksum.sh
jannfis 66f36ff002
chore: Validate checksums of downloaded files in build chain (#6057)
* chore: Validate checksums of downloaded files in build chain

Signed-off-by: jannfis <jann@mistrust.net>

* Fix arm install of kustomize

Signed-off-by: jannfis <jann@mistrust.net>

* Add sudo package to Go builder image

Signed-off-by: jannfis <jann@mistrust.net>
2021-04-19 18:46:21 +02:00

26 lines
No EOL
533 B
Bash
Executable file

#!/bin/sh
set -ex
if test "${TARGET_FILE}" = ""; then
echo "Need to define \$TARGET_FILE" >&2
exit 1
fi
CHKSUM_FILE=$(cd "$(dirname "$0")" && pwd)/checksums/${TARGET_FILE}.sha256
cd "${DOWNLOADS}" || (
echo "Can't change directory to ${DOWNLOAD}" >&2
exit 1
)
if ! test -f "${TARGET_FILE}"; then
echo "Archive to be checked (${TARGET_FILE}) does not exist" >&2
exit 1
fi
if ! grep -q "${TARGET_FILE}" ${CHKSUM_FILE}; then
echo "No checksum for ${TARGET_FILE} in ${CHKSUM_FILE}" >&2
exit 1
fi
sha256sum -c ${CHKSUM_FILE}