mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
Call validate_release() automatically
validate_release() is called automatically before get_(), this removes some bioler plate that every get_() function requires and makes quickget easier to maintain.
This commit is contained in:
parent
ba91b7965d
commit
04e65d953a
1 changed files with 8 additions and 38 deletions
46
quickget
46
quickget
|
@ -18,7 +18,6 @@
|
|||
# EDITION="${1}"
|
||||
# fi
|
||||
#
|
||||
# validate_release "releases_newos"
|
||||
# ISO="newos-${RELEASE}-amd64.iso"
|
||||
# URL="https://www.newos.org/download"
|
||||
# web_get "${URL}/${ISO}" "${VM_PATH}"
|
||||
|
@ -80,8 +79,8 @@ function validate_release() {
|
|||
DISPLAY_NAME="$(pretty_name "${OS}")"
|
||||
RELEASES=$(${RELEASE_GENERATOR})
|
||||
if [[ "${RELEASES}" != *"${RELEASE}"* ]]; then
|
||||
echo "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release."
|
||||
echo "${RELEASES}"
|
||||
echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release.\n"
|
||||
echo -n "${RELEASES}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
@ -726,7 +725,6 @@ function get_android() {
|
|||
local ISO=""
|
||||
local URL=""
|
||||
|
||||
validate_release "releases_android"
|
||||
fosshubVersionInfo=$(wget -O - -q "https://www.fosshub.com/Android-x86-old.html" | grep "var settings =")
|
||||
version="android-x86-${RELEASE}"
|
||||
releaseJson=$(echo "${fosshubVersionInfo:16}" | jq --arg ver "${version}" 'first(.pool.f[] | select((.n | startswith($ver)) and (.n | endswith(".iso"))))')
|
||||
|
@ -771,7 +769,6 @@ function get_alpine() {
|
|||
local VERSION=""
|
||||
local BRANCH=""
|
||||
|
||||
validate_release "releases_alpine"
|
||||
case ${RELEASE} in
|
||||
latest) BRANCH="latest-stable";;
|
||||
*) BRANCH="v${RELEASE}";;
|
||||
|
@ -793,7 +790,6 @@ function get_archlinux() {
|
|||
local URL=""
|
||||
local VERSION=""
|
||||
|
||||
validate_release "releases_archlinux"
|
||||
VERSION=$(wget -q -O- 'https://archlinux.org/releng/releases/json/' | jq '.latest_version' | cut -d "\"" -f 2)
|
||||
URL="https://mirror.rackspace.com/archlinux/iso/${VERSION}"
|
||||
ISO="archlinux-${VERSION}-x86_64.iso"
|
||||
|
@ -809,7 +805,6 @@ function get_arcolinux() {
|
|||
local URL=""
|
||||
local VERSION=""
|
||||
|
||||
validate_release "releases_arcolinux"
|
||||
URL="https://ant.seedhost.eu/arcolinux/.quick/"
|
||||
VERSION=$(wget -q -O- "${URL}/info" | cut -d' ' -f 2)
|
||||
ISO="arcolinuxl-${VERSION}-x86_64.iso"
|
||||
|
@ -824,7 +819,6 @@ function get_cachyos() {
|
|||
local ISO=""
|
||||
local URL="https://mirror.cachyos.org/ISO"
|
||||
|
||||
validate_release "releases_cachyos"
|
||||
ISO="cachyos-${RELEASE}-x86_64.iso"
|
||||
web_get "${URL}/${ISO}" "${VM_PATH}"
|
||||
make_vm_config "${ISO}"
|
||||
|
@ -840,7 +834,6 @@ function get_debian() {
|
|||
EDITION="${1}"
|
||||
fi
|
||||
|
||||
validate_release "releases_debian"
|
||||
ISO="debian-live-${RELEASE}-amd64-${EDITION}.iso"
|
||||
HASH=$(wget -q -O- "${URL}/SHA512SUMS" | grep "${ISO}" | cut -d' ' -f1)
|
||||
web_get "${URL}/${ISO}" "${VM_PATH}"
|
||||
|
@ -854,7 +847,6 @@ function get_devuan() {
|
|||
local URL=""
|
||||
local VERSION=""
|
||||
|
||||
validate_release "releases_devuan"
|
||||
case ${RELEASE} in
|
||||
beowulf) VERSION="3.1.1";;
|
||||
chimaera) VERSION="4.0.0";;
|
||||
|
@ -874,7 +866,6 @@ function get_elementary() {
|
|||
local URL=""
|
||||
local B66tim=""
|
||||
|
||||
validate_release "releases_elementary"
|
||||
B66tim=$(date +%s | base64)
|
||||
ISO="elementaryos-${RELEASE}-stable.${ISOTAG}.iso"
|
||||
# TODO: derive region from geoIP
|
||||
|
@ -888,7 +879,6 @@ function get_freebsd() {
|
|||
local ISO=""
|
||||
local URL=""
|
||||
|
||||
validate_release "releases_freebsd"
|
||||
ISO="FreeBSD-${RELEASE}-RELEASE-amd64-dvd1.iso"
|
||||
HASH=$(wget -q -O- "https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/${RELEASE}/CHECKSUM.SHA512-FreeBSD-${RELEASE}-RELEASE-amd64" | grep '('"${ISO}"')' | cut -d' ' -f4)
|
||||
URL="https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/${RELEASE}/${ISO}"
|
||||
|
@ -905,7 +895,6 @@ function get_fedora() {
|
|||
local URL=""
|
||||
local VERSION_NUM=""
|
||||
|
||||
validate_release "releases_fedora"
|
||||
FEDORA_VERSIONS=$(wget -q -O- "https://getfedora.org/releases.json" | jq '.[] | select((.variant=="Workstation" or .variant=="Spins") and .arch=="x86_64")')
|
||||
if [[ "${RELEASE}" == *"beta"* ]]; then
|
||||
VERSION_NUM=${RELEASE%"_beta"}
|
||||
|
@ -928,7 +917,6 @@ function get_gentoo() {
|
|||
local ISO=""
|
||||
local URL="https://mirror.bytemark.co.uk/gentoo/releases/amd64/autobuilds/"
|
||||
|
||||
validate_release "releases_gentoo"
|
||||
ISO=$(wget -q -O- "${URL}/${RELEASE}-iso.txt" | grep install | cut -d' ' -f1)
|
||||
HASH=$( wget -q -O- "${URL}/${ISO}.DIGESTS" | grep iso | grep -v CONTENTS | cut -d' ' -f1)
|
||||
web_get "${URL}/${ISO}" "${VM_PATH}"
|
||||
|
@ -942,7 +930,6 @@ function get_kali() {
|
|||
local URL=""
|
||||
local SUBDIR=""
|
||||
|
||||
validate_release "releases_kali"
|
||||
case ${RELEASE} in
|
||||
latest) SUBDIR="current";;
|
||||
*) SUBDIR="kali-weekly";;
|
||||
|
@ -961,7 +948,6 @@ function get_kdeneon() {
|
|||
local HASH=""
|
||||
local URL=""
|
||||
|
||||
validate_release "releases_kdeneon"
|
||||
URL="https://files.kde.org/neon/images/${RELEASE}/current"
|
||||
ISO=$(wget -q -O- "${URL}/neon-${RELEASE}-current.sha256sum" | cut -d' ' -f3-)
|
||||
HASH=$(wget -q -O- "${URL}/neon-${RELEASE}-current.sha256sum" | cut -d' ' -f1)
|
||||
|
@ -975,7 +961,6 @@ function get_kolibrios() {
|
|||
local ISO="kolibri.iso"
|
||||
local URL="https://builds.kolibrios.org/eng"
|
||||
|
||||
validate_release "releases_kolibrios"
|
||||
web_get "${URL}/${ISO}" "${VM_PATH}"
|
||||
make_vm_config "${ISO}"
|
||||
}
|
||||
|
@ -990,7 +975,6 @@ function get_linuxmint() {
|
|||
EDITION="${1}"
|
||||
fi
|
||||
|
||||
validate_release "releases_linuxmint"
|
||||
URL="https://mirror.bytemark.co.uk/linuxmint/stable/${RELEASE}"
|
||||
ISO="linuxmint-${RELEASE}-${EDITION}-64bit.iso"
|
||||
HASH=$(wget -q -O- "${URL}/${RELEASE}/sha256sum.txt" | grep "${ISO}" | cut -d' ' -f1)
|
||||
|
@ -1007,7 +991,6 @@ function get_manjaro() {
|
|||
local KEY_HASH="Download_x64_Checksum ="
|
||||
local URL=""
|
||||
|
||||
validate_release "releases_manjaro"
|
||||
case ${RELEASE} in
|
||||
gnome|kde|xfce) BRANCH="official";;
|
||||
budgie|cinnamon|deepin|i3|mate) BRANCH="community";;
|
||||
|
@ -1032,7 +1015,6 @@ function get_mxlinux() {
|
|||
EDITION="${1}"
|
||||
fi
|
||||
|
||||
validate_release "releases_mxlinux"
|
||||
case ${EDITION} in
|
||||
xfce)
|
||||
URL="https://sourceforge.net/projects/mx-linux/files/Final/Xfce"
|
||||
|
@ -1063,7 +1045,6 @@ function get_nixos() {
|
|||
EDITION="${1}"
|
||||
fi
|
||||
|
||||
validate_release "releases_nixos"
|
||||
URL="https://channels.nixos.org/nixos-${RELEASE}"
|
||||
ISO="latest-nixos-${EDITION}-x86_64-linux.iso"
|
||||
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1)
|
||||
|
@ -1077,7 +1058,6 @@ function get_openbsd() {
|
|||
local ISO=""
|
||||
local URL=""
|
||||
|
||||
validate_release "releases_openbsd"
|
||||
URL="https://cdn.openbsd.org/pub/OpenBSD/${RELEASE}/amd64"
|
||||
ISO="install${RELEASE//\./}.iso"
|
||||
HASH=$(wget -q -O- "${URL}/SHA256" | grep "${ISO}" | cut -d' ' -f4)
|
||||
|
@ -1091,7 +1071,6 @@ function get_void() {
|
|||
local ISO=""
|
||||
local URL="https://alpha.de.repo.voidlinux.org/live/current"
|
||||
|
||||
validate_release "releases_void"
|
||||
DATE=$(wget -q -O- "${URL}/sha256sum.txt" | head -n1 | cut -d'.' -f1 | cut -d'-' -f4)
|
||||
case ${RELEASE} in
|
||||
base) ISO="void-live-x86_64-${DATE}.iso";;
|
||||
|
@ -1109,7 +1088,6 @@ function get_zorin() {
|
|||
local ISO=""
|
||||
local URL=""
|
||||
|
||||
validate_release "releases_zorin"
|
||||
# Parse out the iso URL from the redirector
|
||||
URL=$(wget -q -S -O- --max-redirect=0 "https://zrn.co/${RELEASE}" 2>&1 | grep Location | cut -d' ' -f4)
|
||||
ISO="${URL##*/}"
|
||||
|
@ -1160,7 +1138,7 @@ function get_solus() {
|
|||
local ISO=""
|
||||
local URL=""
|
||||
|
||||
validate_release "releases_solus"
|
||||
if [ -n "${1}" ]; then
|
||||
EDITION="${1}"
|
||||
fi
|
||||
|
||||
|
@ -1184,7 +1162,6 @@ function get_opensuse() {
|
|||
local ISO=""
|
||||
local URL=""
|
||||
|
||||
validate_release "releases_opensuse"
|
||||
if [ "${RELEASE}" == "tumbleweed" ]; then
|
||||
ISO="openSUSE-Tumbleweed-DVD-x86_64-Current.iso"
|
||||
URL="https://download.opensuse.org/tumbleweed/iso/${ISO}"
|
||||
|
@ -1214,7 +1191,6 @@ function get_oraclelinux() {
|
|||
local VER_MAJ=""
|
||||
local VER_MIN=""
|
||||
|
||||
validate_release "releases_oraclelinux"
|
||||
VER_MAJ=${RELEASE::1}
|
||||
VER_MIN=${RELEASE:2:1}
|
||||
URL="https://yum.oracle.com/ISOS/OracleLinux/OL${VER_MAJ}/u${VER_MIN}/x86_64/"
|
||||
|
@ -1307,7 +1283,7 @@ function get_popos() {
|
|||
DRIVER="${1}"
|
||||
fi
|
||||
|
||||
validate_release "releases_popos"
|
||||
URL=$(wget -q -O- "https://api.pop-os.org/builds/${RELEASE}/${EDITION}" | jq ".url")
|
||||
URL=$(wget -q -O- "https://api.pop-os.org/builds/${RELEASE}/${DRIVER}" | jq ".url")
|
||||
URL="${URL//\"/}"
|
||||
ISO=$(echo "${URL}" | sed -e "s/.*\/\([^\/]*\)$/\1/")
|
||||
|
@ -1323,7 +1299,6 @@ function get_regolith() {
|
|||
local ISO=""
|
||||
local URL="https://github.com/regolith-linux/regolith-ubuntu-iso-builder/releases/download"
|
||||
|
||||
validate_release "releases_regolith"
|
||||
case ${RELEASE} in
|
||||
1.6.0_focal)
|
||||
URL="${URL}/release-release-focal-focal_standard-1.6.0"
|
||||
|
@ -1353,7 +1328,6 @@ function get_tails() {
|
|||
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')
|
||||
|
@ -1386,8 +1360,6 @@ function get_ubuntu() {
|
|||
if [ "${RELEASE}" == "canary" ] && [ "${OS}" != "ubuntu" ]; then
|
||||
echo "ERROR! Canary is currently only available for Ubuntu."
|
||||
exit 1
|
||||
else
|
||||
validate_release "releases_ubuntu"
|
||||
fi
|
||||
|
||||
if [ "${RELEASE}" == "canary" ]; then
|
||||
|
@ -1422,8 +1394,6 @@ function get_garuda() {
|
|||
local LATEST_URL=""
|
||||
local HASH_URL=""
|
||||
|
||||
validate_release "releases_garuda"
|
||||
|
||||
case ${RELEASE} in
|
||||
mate|cinnamon)
|
||||
REL_TYPE="community";;
|
||||
|
@ -1449,8 +1419,6 @@ function get_haiku() {
|
|||
local URL=""
|
||||
local HASH=""
|
||||
|
||||
validate_release "releases_haiku"
|
||||
|
||||
BASE=$(echo "${RELEASE}" | cut -d'-' -f1)
|
||||
URL="https://cdn.haiku-os.org/haiku-release/${BASE}"
|
||||
ISO="haiku-${RELEASE}-anyboot.iso"
|
||||
|
@ -1776,8 +1744,6 @@ function get_windows() {
|
|||
local DOWNLOAD_ID=""
|
||||
local DOWNLOAD_URL=""
|
||||
|
||||
validate_release "releases_windows"
|
||||
|
||||
# Ignore the most recent Windows 10 release for now.
|
||||
if [ "${RELEASE}" -eq 10 ]; then
|
||||
INDEX=0
|
||||
|
@ -1899,8 +1865,10 @@ if [ -n "${2}" ]; then
|
|||
fi
|
||||
fi
|
||||
VM_PATH="${OS}-${RELEASE}-${EDITION}"
|
||||
validate_release releases_"${OS}"
|
||||
get_"${OS}" "${EDITION}"
|
||||
elif [[ "${OS}" == *"ubuntu"* ]]; then
|
||||
validate_release releases_"${OS}"
|
||||
get_ubuntu
|
||||
elif [ "${OS}" == "windows" ]; then
|
||||
LANG="English International"
|
||||
|
@ -1914,8 +1882,10 @@ if [ -n "${2}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
fi
|
||||
validate_release releases_windows
|
||||
get_windows "${LANG}"
|
||||
else
|
||||
validate_release releases_"${OS}"
|
||||
get_"${OS}"
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue