Refactor get_manjaro()

This commit is contained in:
Martin Wimpress 2022-02-21 01:58:35 +00:00
parent b9eb58e95c
commit 0e6ad3d1f7
No known key found for this signature in database
GPG key ID: 61DF940515E06DA3

View file

@ -995,34 +995,38 @@ function get_linuxmint() {
function get_manjaro() { function get_manjaro() {
local FLAVOR="" local FLAVOR=""
local MANIFESTURL="" local MANIFESTURL=""
# local ISOKEY=""
local HASHKEY=""
local HASH="" local HASH=""
local ISO="" local ISO=""
local KEY_ISO=""
local KEY_HASH=""
local URL="" local URL=""
validate_release "releases_manjaro" validate_release "releases_manjaro"
FLAVOR=$(echo "${OS}" | cut -d'-' -f2) FLAVOR=$(echo "${OS}" | cut -d'-' -f2)
case ${FLAVOR} in case ${FLAVOR} in
xfce|kde|gnome) BRANCH="official";; gnome|kde|xfce) BRANCH="official";;
budgie|cinnamon|deepin|i3|mate) BRANCH="community";; budgie|cinnamon|deepin|i3|mate) BRANCH="community";;
esac esac
if [[ ${RELEASE} == "full" ]]; then case ${RELEASE} in
KEY="Download_x64 = " full)
HASHKEY="Download_x64_Checksum = " KEY_ISO="Download_x64 ="
elif [[ ${RELEASE} == "minimal" ]]; then KEY_HASH="Download_x64_Checksum ="
KEY="Download_Minimal_x64 = " ;;
HASHKEY="Download_Minimal_x64_Checksum = " minimal)
elif [[ ${RELEASE} == "minimal" ]]; then KEY_ISO="Download_Minimal_x64 ="
KEY="Download_Minimal_lts = " KEY_HASH="Download_Minimal_x64_Checksum ="
HASHKEY="Download_Minimal_x64_Checksum_lts = " ;;
fi minimal-lts)
KEY_ISO="Download_Minimal_lts ="
KEY_HASH="Download_Minimal_x64_Checksum_lts ="
;;
esac
MANIFESTURL="https://gitlab.manjaro.org/webpage/manjaro-homepage/-/raw/master/site/content/downloads/${BRANCH}/${FLAVOR}.md" MANIFESTURL="https://gitlab.manjaro.org/webpage/manjaro-homepage/-/raw/master/site/content/downloads/${BRANCH}/${FLAVOR}.md"
URL="$(wget -qO- ${MANIFESTURL} | grep "${KEY}" | awk '{print $3}' | tr -d '"')" URL="$(wget -qO- "${MANIFESTURL}" | grep "${KEY_ISO}" | cut -d'"' -f2)"
ISO="$(echo $URL | awk -F "/" '{print $6}')" ISO="${URL##*/}"
HASH=$(wget -qO- ${MANIFESTURL} | grep "${HASHKEY}" | awk '{print $3}' | tr -d '"') HASH=$(wget -qO- "${MANIFESTURL}" | grep "${KEY_HASH}" | cut -d'"' -f2)
web_get "${URL}" "${VM_PATH}" web_get "${URL}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}" check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}" make_vm_config "${ISO}"