Files
cpp-build-system/grab_packages.sh
Scott E. Graves ba5f4d1625
Some checks failed
sgraves/cpp-build-system_mac/pipeline/head There was a failure building this commit
sgraves/cpp-build-system/pipeline/head There was a failure building this commit
sgraves/cpp-build-system_msys2/pipeline/head There was a failure building this commit
Remove package sources and host only the expected SHA-256 (#3)
Reviewed-on: #3
Co-authored-by: Scott E. Graves <scott.e.graves@protonmail.com>
Co-committed-by: Scott E. Graves <scott.e.graves@protonmail.com>
2025-12-13 09:35:33 -06:00

40 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
CURRENT_DIR=$(realpath "$0")
CURRENT_DIR=$(dirname "${CURRENT_DIR}")
. "${CURRENT_DIR}/src/scripts/versions.sh"
. "${CURRENT_DIR}/src/scripts/libraries.sh"
function download_package() {
local NAME=$1
local ITEM_LIST=(${PROJECT_DOWNLOADS[${NAME}]//;/ })
if [ ! -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}" ]; then
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
if ! wget ${ITEM_LIST[0]} -O "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"; then
echo "failed $NAME"
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
exit 1
fi
pushd "${CURRENT_DIR}/support/${ITEM_LIST[2]}/"
if ! sha256sum -c "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}.sha256"; then
rm -f "${CURRENT_DIR}/support/${ITEM_LIST[2]}/${ITEM_LIST[1]}"
echo "failed sha256 validation: $NAME"
exit 1
fi
popd
fi
}
function download_packages() {
for NAME in "${!PROJECT_DOWNLOADS[@]}"; do
download_package $NAME
done
}
pushd "${CURRENT_DIR}"
download_packages
popd