summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/scripts/curl47
1 files changed, 27 insertions, 20 deletions
diff --git a/share/scripts/curl b/share/scripts/curl
index f7419e9..3d81807 100755
--- a/share/scripts/curl
+++ b/share/scripts/curl
@@ -172,32 +172,39 @@ then
CURL_OPTIONS="${CURL_OPTIONS} --http2"
fi
-curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \
- "${SERVER}/${IMAGE}" -o "${CACHE}/${IMAGE}"
+for FILE in "${SERVER}/${IMAGE}" "${SERVER}/${IMAGE}.sha512"
+do
+ if curl --fail --head --output /dev/null --silent "${FILE}"
+ then
+ curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \
+ "${FILE}" -o "${CACHE}/$(basename ${FILE})"
+ fi
+done
-curl --fail --location --progress-bar --user-agent container-tools/${VERSION} ${CURL_OPTIONS} \
- "${SERVER}/${IMAGE}.sha512" -o "${CACHE}/${IMAGE}.sha512"
+if [ -e "${CACHE}/${IMAGE}.sha512" ] && [ -e "${CACHE}/${IMAGE}" ]
+then
+ echo -n "Verifying ${IMAGE}.sha512"
-echo -n "Verifying ${IMAGE}.sha512"
-cd "${CACHE}"
-set +e
+ cd "${CACHE}"
+ set +e
-sha512sum --check "${IMAGE}.sha512" --status
-SHA512SUM="${?}"
+ sha512sum --check "${IMAGE}.sha512" --status
+ SHA512SUM="${?}"
-case "${SHA512SUM}" in
- 0)
- echo " ok."
- ;;
+ case "${SHA512SUM}" in
+ 0)
+ echo " ok."
+ ;;
- *)
- echo " failed."
- exit 1
- ;;
-esac
+ *)
+ echo " failed."
+ exit 1
+ ;;
+ esac
-set -e
-cd "${OLDPWD}"
+ set -e
+ cd "${OLDPWD}"
+fi
echo "Unpacking ${IMAGE}"
mkdir -p "${MACHINES}/${NAME}"