From 4bafb49e0a0ce8c8f3a1b8340a0558cf9f2842f9 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Mon, 21 Feb 2022 02:04:23 +0000 Subject: [PATCH] Refactor get_tails() --- quickget | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/quickget b/quickget index b448af9..f47ac92 100755 --- a/quickget +++ b/quickget @@ -1333,11 +1333,17 @@ function get_regolith() { } function get_tails() { + local ISO="" + local HASH="" + local RELEASE_JSON_URL="" + local RELEASE_JSON="" + local URL="" + validate_release "releases_tails" RELEASE_JSON_URL="https://tails.boum.org/install/v2/Tails/amd64/${RELEASE}/latest.json" - RELEASE_JSON="$(wget -q -O- "$RELEASE_JSON_URL")" - URL=$(echo "$RELEASE_JSON" | jq -r '.installations[0]."installation-paths"[]|select(.type=="iso")|."target-files"[0].url') - HASH=$(echo "$RELEASE_JSON" | jq -r '.installations[0]."installation-paths"[]|select(.type=="iso")|."target-files"[0].sha256') + RELEASE_JSON="$(wget -q -O- "${RELEASE_JSON_URL}")" + URL=$(echo "${RELEASE_JSON}" | jq -r '.installations[0]."installation-paths"[]|select(.type=="iso")|."target-files"[0].url') + HASH=$(echo "${RELEASE_JSON}" | jq -r '.installations[0]."installation-paths"[]|select(.type=="iso")|."target-files"[0].sha256') ISO=$(echo "${URL}" | sed -e "s/.*\/\([^\/]*\)$/\1/") web_get "${URL}" "${VM_PATH}" check_hash "${ISO}" "${HASH}"