diff options
Diffstat (limited to 'share/scripts/curl')
-rwxr-xr-x | share/scripts/curl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/share/scripts/curl b/share/scripts/curl index b84869c..b67cbd4 100755 --- a/share/scripts/curl +++ b/share/scripts/curl @@ -155,6 +155,30 @@ fi curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \ "${SERVER}/${IMAGE}" -o "${CACHE}/${IMAGE}" +curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \ + "${SERVER}/${IMAGE}.sha512" -o "${CACHE}/${IMAGE}.sha512" + +echo -n "Verifying ${IMAGE}.sha512" +cd "${CACHE}" +set +e + +sha512sum --check "${IMAGE}.sha512" --status +SHA512SUM="${?}" + +case "${SHA512SUM}" in + 0) + echo " ok." + ;; + + *) + echo " failed." + exit 1 + ;; +esac + +set -e +cd "${OLDPWD}" + echo "Unpacking ${IMAGE}" mkdir -p "${MACHINES}/${NAME}" @@ -200,5 +224,6 @@ echo "${NAME}: root password set to '${PASSWORD}'." case "${CLEAN}" in true) rm -f "${CACHE}/${IMAGE}" + rm -f "${CACHE}/${IMAGE}.sha512" ;; esac |