Consistently indent quickget with 4 spaces

This commit is contained in:
nqvrg 2022-02-24 16:06:57 +01:00
parent 2dd71036f3
commit 0d670056b6

188
quickget
View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
export LC_ALL=C
# Here the quick 'n dirty guide to adding a new OS to quickget
@ -30,38 +31,38 @@ function pretty_name() {
local PRETTY_NAME=""
SIMPLE_NAME="${1}"
case ${SIMPLE_NAME} in
alma) PRETTY_NAME="Alma Linux";;
alpine) PRETTY_NAME="Alpine Linux";;
android) PRETTY_NAME="Android x86";;
archlinux) PRETTY_NAME="Arch Linux";;
arcolinux) PRETTY_NAME="Arco Linux";;
cachyos) PRETTY_NAME="CachyOS";;
dragonflybsd) PRETTY_NAME="DragonFlyBSD";;
elementary) PRETTY_NAME="elementary OS";;
freebsd) PRETTY_NAME="FreeBSD";;
garuda) PRETTY_NAME="Garuda Linux";;
ghostbsd) PRETTY_NAME="GhostBSD";;
kdeneon) PRETTY_NAME="KDE Neon";;
kolibrios) PRETTY_NAME="KolibriOS";;
linuxmint) PRETTY_NAME="Linux Mint";;
mxlinux) PRETTY_NAME="MX Linux";;
netboot) PRETTY_NAME="netboot.xyz";;
netbsd) PRETTY_NAME="NetBSD";;
nixos) PRETTY_NAME="NixOS";;
macos) PRETTY_NAME="macOS";;
openbsd) PRETTY_NAME="OpenBSD";;
opensuse) PRETTY_NAME="openSUSE";;
oraclelinux) PRETTY_NAME="Oracle Linux";;
popos) PRETTY_NAME="Pop!_OS";;
regolith) PRETTY_NAME="Regolith Linux";;
rockylinux) PRETTY_NAME="Rocky Linux";;
ubuntu-budgie) PRETTY_NAME="Ubuntu Budgie";;
ubuntukylin) PRETTY_NAME="Ubuntu Kylin";;
ubuntu-mate) PRETTY_NAME="Ubuntu MATE";;
ubuntustudio) PRETTY_NAME="Ubuntu Studio";;
void) PRETTY_NAME="Void Linux";;
zorin) PRETTY_NAME="Zorin OS";;
*) PRETTY_NAME="${SIMPLE_NAME^}";;
alma) PRETTY_NAME="Alma Linux" ;;
alpine) PRETTY_NAME="Alpine Linux" ;;
android) PRETTY_NAME="Android x86" ;;
archlinux) PRETTY_NAME="Arch Linux" ;;
arcolinux) PRETTY_NAME="Arco Linux" ;;
cachyos) PRETTY_NAME="CachyOS" ;;
dragonflybsd) PRETTY_NAME="DragonFlyBSD" ;;
elementary) PRETTY_NAME="elementary OS" ;;
freebsd) PRETTY_NAME="FreeBSD" ;;
garuda) PRETTY_NAME="Garuda Linux" ;;
ghostbsd) PRETTY_NAME="GhostBSD" ;;
kdeneon) PRETTY_NAME="KDE Neon" ;;
kolibrios) PRETTY_NAME="KolibriOS" ;;
linuxmint) PRETTY_NAME="Linux Mint" ;;
mxlinux) PRETTY_NAME="MX Linux" ;;
netboot) PRETTY_NAME="netboot.xyz" ;;
netbsd) PRETTY_NAME="NetBSD" ;;
nixos) PRETTY_NAME="NixOS" ;;
macos) PRETTY_NAME="macOS" ;;
openbsd) PRETTY_NAME="OpenBSD" ;;
opensuse) PRETTY_NAME="openSUSE" ;;
oraclelinux) PRETTY_NAME="Oracle Linux" ;;
popos) PRETTY_NAME="Pop!_OS" ;;
regolith) PRETTY_NAME="Regolith Linux" ;;
rockylinux) PRETTY_NAME="Rocky Linux" ;;
ubuntu-budgie) PRETTY_NAME="Ubuntu Budgie" ;;
ubuntukylin) PRETTY_NAME="Ubuntu Kylin" ;;
ubuntu-mate) PRETTY_NAME="Ubuntu MATE" ;;
ubuntustudio) PRETTY_NAME="Ubuntu Studio" ;;
void) PRETTY_NAME="Void Linux" ;;
zorin) PRETTY_NAME="Zorin OS" ;;
*) PRETTY_NAME="${SIMPLE_NAME^}" ;;
esac
echo "${PRETTY_NAME}"
}
@ -73,8 +74,8 @@ function validate_release() {
DISPLAY_NAME="$(pretty_name "${OS}")"
case ${OS} in
*ubuntu*) RELEASE_GENERATOR="releases_ubuntu";;
*) RELEASE_GENERATOR="${1}";;
*ubuntu*) RELEASE_GENERATOR="releases_ubuntu" ;;
*) RELEASE_GENERATOR="${1}" ;;
esac
RELEASES=$(${RELEASE_GENERATOR})
@ -416,8 +417,7 @@ function releases_rockylinux() {
}
function editions_rockylinux() {
echo minimal \
dvd1
echo minimal dvd1
}
function releases_slackware() {
@ -453,7 +453,8 @@ function releases_windows() {
}
function languages_windows() {
LANGS=(Arabic
LANGS=(
Arabic
"Brazilian Portuguese"
Bulgarian
"Chinese (Simplified)"
@ -490,7 +491,8 @@ function languages_windows() {
Swedish
Thai
Turkish
Ukrainian)
Ukrainian
)
}
function releases_zorin() {
@ -510,12 +512,12 @@ function check_hash() {
# Guess the hash algorithm by the hash length
case ${#hash} in
32) hash_algo=md5sum;;
40) hash_algo=sha1sum;;
64) hash_algo=sha256sum;;
128) hash_algo=sha512sum;;
32) hash_algo=md5sum ;;
40) hash_algo=sha1sum ;;
64) hash_algo=sha256sum ;;
128) hash_algo=sha512sum ;;
*) echo "WARNING! Can't guess hash algorithm, not checking ${iso} hash."
return;;
return ;;
esac
echo -n "Checking ${iso} with ${hash_algo}... "
@ -608,31 +610,31 @@ function make_vm_config() {
case "${OS}" in
dragonflybsd)
GUEST="dragonflybsd"
IMAGE_TYPE="iso";;
IMAGE_TYPE="iso" ;;
freebsd|ghostbsd)
GUEST="freebsd"
IMAGE_TYPE="iso";;
IMAGE_TYPE="iso" ;;
haiku)
GUEST="haiku"
IMAGE_TYPE="iso";;
IMAGE_TYPE="iso" ;;
kolibrios)
GUEST="kolibrios"
IMAGE_TYPE="iso";;
IMAGE_TYPE="iso" ;;
macos)
GUEST="macos"
IMAGE_TYPE="img";;
IMAGE_TYPE="img" ;;
netbsd)
GUEST="netbsd"
IMAGE_TYPE="iso";;
IMAGE_TYPE="iso" ;;
openbsd)
GUEST="openbsd"
IMAGE_TYPE="iso";;
IMAGE_TYPE="iso" ;;
windows)
GUEST="windows"
IMAGE_TYPE="iso";;
IMAGE_TYPE="iso" ;;
*)
GUEST="linux"
IMAGE_TYPE="iso";;
IMAGE_TYPE="iso" ;;
esac
if [ -n "${EDITION}" ]; then
@ -654,14 +656,14 @@ EOF
# OS specific tweaks
case ${OS} in
alma|oraclelinux|rockylinux) echo "disk_size=\"32G\"" >> "${CONF_FILE}";;
dragonflybsd|haiku|openbsd|netbsd|slackware|tails) echo "boot=\"legacy\"" >> "${CONF_FILE}";;
alma|oraclelinux|rockylinux) echo "disk_size=\"32G\"" >> "${CONF_FILE}" ;;
dragonflybsd|haiku|openbsd|netbsd|slackware|tails) echo "boot=\"legacy\"" >> "${CONF_FILE}" ;;
kolibrios)
echo "boot=\"legacy\"" >> "${CONF_FILE}"
echo "disk_size=\"2G\"" >> "${CONF_FILE}"
echo "ram=\"128M\"" >> "${CONF_FILE}"
;;
macos) echo "macos_release=\"${RELEASE}\"" >> "${CONF_FILE}";;
macos) echo "macos_release=\"${RELEASE}\"" >> "${CONF_FILE}" ;;
esac
# Enable TPM for Windows 11
@ -688,7 +690,7 @@ function get_alma() {
local HASH=""
local ISO="AlmaLinux-${RELEASE}-x86_64-${EDITION}.iso"
local URL="http://lon.mirror.rackspace.com/almalinux/${RELEASE}/isos/x86_64/"
HASH="$(wget -q -O- "${URL}/CHECKSUM" | grep "(${ISO}" | cut -d' ' -f4)"
HASH=$(wget -q -O- "${URL}/CHECKSUM" | grep "(${ISO}" | cut -d' ' -f4)
echo "${URL}/${ISO} ${HASH}"
}
@ -699,8 +701,8 @@ function get_alpine() {
local VERSION=""
case ${RELEASE} in
latest) URL="https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64";;
*) URL="https://dl-cdn.alpinelinux.org/alpine/v${RELEASE}/releases/x86_64";;
latest) URL="https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64" ;;
*) URL="https://dl-cdn.alpinelinux.org/alpine/v${RELEASE}/releases/x86_64" ;;
esac
VERSION=$(wget -qO- "${URL}/latest-releases.yaml" | awk '/"Xen"/{found=0} {if(found) print} /"Virtual"/{found=1}' | grep 'version:' | awk '{print $2}')
ISO="alpine-virt-${VERSION}-x86_64.iso"
@ -762,8 +764,8 @@ function get_debian() {
local URL=""
case ${RELEASE} in
11.2.0) URL="https://cdimage.debian.org/debian-cd/${RELEASE}-live/amd64/iso-hybrid";;
*) URL="https://cdimage.debian.org/cdimage/archive/${RELEASE}-live/amd64/iso-hybrid/";;
11.2.0) URL="https://cdimage.debian.org/debian-cd/${RELEASE}-live/amd64/iso-hybrid" ;;
*) URL="https://cdimage.debian.org/cdimage/archive/${RELEASE}-live/amd64/iso-hybrid/" ;;
esac
if [ "${EDITION}" == "netinst" ]; then
@ -782,8 +784,8 @@ function get_devuan() {
local URL="https://files.devuan.org/devuan_${RELEASE}/desktop-live"
case ${RELEASE} in
beowulf) ISO="devuan_${RELEASE}_3.1.1_amd64_desktop-live.iso";;
chimaera) ISO="devuan_${RELEASE}_4.0.0_amd64_desktop-live.iso";;
beowulf) ISO="devuan_${RELEASE}_3.1.1_amd64_desktop-live.iso" ;;
chimaera) ISO="devuan_${RELEASE}_4.0.0_amd64_desktop-live.iso" ;;
esac
HASH=$(wget -q -O- "${URL}/SHASUMS.txt" | grep "${ISO}" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
@ -814,8 +816,8 @@ function get_fedora() {
local VARIANT=""
case ${EDITION} in
Server|Silverblue|Workstation) VARIANT="${EDITION}";;
*) VARIANT="Spins";;
Server|Silverblue|Workstation) VARIANT="${EDITION}" ;;
*) VARIANT="Spins" ;;
esac
JSON=$(wget -q -O- "https://getfedora.org/releases.json" | jq '.[] | select(.variant=="'${VARIANT}'" and .subvariant=="'"${EDITION}"'" and .arch=="x86_64" and .version=="'"${RELEASE}"'")')
@ -840,8 +842,8 @@ function get_garuda() {
local URL=""
case ${EDITION} in
cinnamon|mate) URL="http://mirrors.fossho.st/garuda/iso/community/${EDITION}/${RELEASE}";;
*) URL="http://mirrors.fossho.st/garuda/iso/garuda/${EDITION}/${RELEASE}";;
cinnamon|mate) URL="http://mirrors.fossho.st/garuda/iso/community/${EDITION}/${RELEASE}" ;;
*) URL="http://mirrors.fossho.st/garuda/iso/garuda/${EDITION}/${RELEASE}" ;;
esac
ISO="garuda-${EDITION}-linux-zen-${RELEASE}.iso"
HASH="$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1)"
@ -865,8 +867,8 @@ function get_ghostbsd() {
local HASH=""
case ${EDITION} in
mate) ISO="GhostBSD-${RELEASE}.iso";;
xfce) ISO="GhostBSD-${RELEASE}-XFCE.iso";;
mate) ISO="GhostBSD-${RELEASE}.iso" ;;
xfce) ISO="GhostBSD-${RELEASE}-XFCE.iso" ;;
esac
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | grep "${ISO}" | cut -d' ' -f4)
echo "${URL}/${ISO} ${HASH}"
@ -928,22 +930,22 @@ function get_macos() {
case ${RELEASE} in
high-sierra)
BOARD_ID="Mac-7BA5B2D9E42DDD94"
MLB="00000000000J80300";;
MLB="00000000000J80300" ;;
mojave)
BOARD_ID="Mac-7BA5B2DFE22DDD8C"
MLB="00000000000KXPG00";;
MLB="00000000000KXPG00" ;;
catalina)
BOARD_ID="Mac-CFF7D910A743CAAF"
MLB="00000000000PHCD00";;
MLB="00000000000PHCD00" ;;
big-sur)
BOARD_ID="Mac-35C1E88140C3E6CF"
MLB="00000000000000000";;
MLB="00000000000000000" ;;
monterey)
BOARD_ID="Mac-06F11F11946D27C5"
MLB="00000000000000000";;
MLB="00000000000000000" ;;
*) echo "ERROR! Unknown release: ${RELEASE}"
releases_macos
exit 1;;
exit 1 ;;
esac
# Use a bundled macrecovery if possible
@ -994,8 +996,8 @@ function get_manjaro() {
local URL=""
case ${RELEASE} in
gnome|kde|xfce) MANIFESTURL="https://gitlab.manjaro.org/webpage/manjaro-homepage/-/raw/master/site/content/downloads/official/${RELEASE}.md";;
budgie|cinnamon|deepin|i3|mate) MANIFESTURL="https://gitlab.manjaro.org/webpage/manjaro-homepage/-/raw/master/site/content/downloads/community/${RELEASE}.md";;
gnome|kde|xfce) MANIFESTURL="https://gitlab.manjaro.org/webpage/manjaro-homepage/-/raw/master/site/content/downloads/official/${RELEASE}.md" ;;
budgie|cinnamon|deepin|i3|mate) MANIFESTURL="https://gitlab.manjaro.org/webpage/manjaro-homepage/-/raw/master/site/content/downloads/community/${RELEASE}.md" ;;
esac
URL="$(wget -qO- "${MANIFESTURL}" | grep "Download_x64 =" | cut -d'"' -f2)"
@ -1010,9 +1012,9 @@ function get_mxlinux() {
local URL="https://sourceforge.net/projects/mx-linux/files/Final/${EDITION}"
case ${EDITION} in
Xfce) ISO="MX-${RELEASE}_x64.iso";;
KDE) ISO="MX-${RELEASE}_KDE_x64.iso";;
Fluxbox) ISO="MX-${RELEASE}_fluxbox_x64.iso";;
Xfce) ISO="MX-${RELEASE}_x64.iso" ;;
KDE) ISO="MX-${RELEASE}_KDE_x64.iso" ;;
Fluxbox) ISO="MX-${RELEASE}_fluxbox_x64.iso" ;;
esac
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
@ -1081,8 +1083,8 @@ function get_oraclelinux() {
local URL="https://yum.oracle.com/ISOS/OracleLinux/OL${VER_MAJ}/u${VER_MIN}/x86_64/"
case ${VER_MAJ} in
8) ISO="OracleLinux-R${VER_MAJ}-U${VER_MIN}-x86_64-dvd.iso";;
*) ISO="OracleLinux-R${VER_MAJ}-U${VER_MIN}-Server-x86_64-dvd.iso";;
8) ISO="OracleLinux-R${VER_MAJ}-U${VER_MIN}-x86_64-dvd.iso" ;;
*) ISO="OracleLinux-R${VER_MAJ}-U${VER_MIN}-Server-x86_64-dvd.iso" ;;
esac
HASH=$(wget -q -O- "https://linux.oracle.com/security/gpg/checksum/OracleLinux-R${VER_MAJ}-U${VER_MIN}-Server-x86_64.checksum" | grep "${ISO}" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
@ -1105,8 +1107,8 @@ function get_regolith() {
local URL=""
case ${EDITION} in
1.6.0) URL="https://github.com/regolith-linux/regolith-ubuntu-iso-builder/releases/download/release-release-${RELEASE}-${RELEASE}_standard-${EDITION}";;
2.0.0) URL="https://github.com/regolith-linux/regolith-ubuntu-iso-builder/releases/download/regolith-linux-2.0-${RELEASE}-latest";;
1.6.0) URL="https://github.com/regolith-linux/regolith-ubuntu-iso-builder/releases/download/release-release-${RELEASE}-${RELEASE}_standard-${EDITION}" ;;
2.0.0) URL="https://github.com/regolith-linux/regolith-ubuntu-iso-builder/releases/download/regolith-linux-2.0-${RELEASE}-latest" ;;
esac
HASH=$(wget -q -O- "${URL}/SHA256SUMS" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
@ -1119,8 +1121,8 @@ function get_rockylinux() {
local URL=""
case ${RELEASE} in
8.5) URL="https://download.rockylinux.org/pub/rocky/${RELEASE}/isos/x86_64";;
*) URL="http://dl.rockylinux.org/vault/rocky/${RELEASE}/isos/x86_64/";;
8.5) URL="https://download.rockylinux.org/pub/rocky/${RELEASE}/isos/x86_64" ;;
*) URL="http://dl.rockylinux.org/vault/rocky/${RELEASE}/isos/x86_64/" ;;
esac
HASH=$(wget -q -O- "${URL}/CHECKSUM" | grep "SHA256" | grep "${ISO}" | cut -d' ' -f4)
echo "${URL}/${ISO} ${HASH}"
@ -1201,10 +1203,10 @@ function get_void() {
DATE=$(wget -q -O- "${URL}/sha256sum.txt" | head -n1 | cut -d'.' -f1 | cut -d'-' -f4)
case ${EDITION} in
glibc) ISO="void-live-x86_64-${DATE}.iso";;
musl) ISO="void-live-x86_64-musl-${DATE}.iso";;
xfce-glibc) ISO="void-live-x86_64-${DATE}-xfce.iso";;
xfce-musl) ISO="void-live-x86_64-musl-${DATE}-xfce.iso";;
glibc) ISO="void-live-x86_64-${DATE}.iso" ;;
musl) ISO="void-live-x86_64-musl-${DATE}.iso" ;;
xfce-glibc) ISO="void-live-x86_64-${DATE}-xfce.iso" ;;
xfce-musl) ISO="void-live-x86_64-musl-${DATE}-xfce.iso" ;;
esac
HASH="$(wget -q -O- "${URL}/sha256sum.txt" | grep "${ISO}" | cut -d' ' -f4)"
echo "${URL}/${ISO} ${HASH}"
@ -1540,8 +1542,8 @@ function get_windows() {
# Ignore the most recent Windows 10 release for now.
case ${RELEASE} in
10) INDEX=0;;
11) INDEX=0;;
10) INDEX=0 ;;
11) INDEX=0 ;;
esac
echo "Getting Windows ${RELEASE} URL..."
@ -1555,8 +1557,8 @@ function get_windows() {
dbg_windows "${VERSION_ID}"
case ${RELEASE} in
8) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows 8.1 Pro + Core").edition_id');;
10|11) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows '"${RELEASE}"'").edition_id');;
8) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows 8.1 Pro + Core").edition_id') ;;
10|11) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows '"${RELEASE}"'").edition_id') ;;
esac
dbg_windows "${EDITION_ID}"