summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-11-15 13:43:40 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-11-22 14:29:30 +0000
commita77fb0e83930dc7671e67f302ceed04c7dd36b08 (patch)
tree4113706cf47dd4513f92ffa8cd068760f8caf2e0 /share
parentUsing https by default in container-images.sh example script. (diff)
downloadcompute-tools-a77fb0e83930dc7671e67f302ceed04c7dd36b08.tar.xz
compute-tools-a77fb0e83930dc7671e67f302ceed04c7dd36b08.zip
Adding sha512 verification to curl container create script.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share')
-rwxr-xr-xshare/scripts/curl25
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