2021-09-27 23:09:46 +00:00
#!/usr/bin/env bash
2022-02-23 09:53:27 +00:00
export LC_ALL=C
2021-09-27 23:09:46 +00:00
2021-10-19 15:55:57 +00:00
# Here the quick 'n dirty guide to adding a new OS to quickget
#
2022-02-21 18:02:24 +00:00
# 1. Update os_support() - add new OS, all lowercase
# 2. Update pretty_name() - add a pretty name for new OS *only if the catch all is not suitable*
# 3. Create a releases_newos() generator (required) outputs the current supported release versions
# 4. Create a editions_newos() generator (optional) outputs the editions if new OS has multiple flavours/editions
# 5. Update make_vm_config() - add any *required* new OS tweaks
# 6. Create a get_newos() function - that does something like this:
2021-10-19 15:55:57 +00:00
# function get_newos() {
2022-02-22 15:15:56 +00:00
# local EDITION="${1:-}"
2021-10-19 16:19:11 +00:00
# local HASH=""
2022-02-23 09:59:27 +00:00
# local ISO="newos-${RELEASE}-${EDITION}-amd64.iso"
# local URL="https://www.newos.org/download/${RELEASE}/${EDITION}"
2021-10-19 15:55:57 +00:00
#
2022-02-23 09:59:27 +00:00
# HASH=$(wget -q -O- "${URL}/SHA512SUMS" | grep "${ISO}" | cut -d' ' -f1)
# echo "${URL}/${ISO} ${HASH}"
2021-10-19 15:55:57 +00:00
# }
2021-10-28 21:41:35 +00:00
function cleanup() {
if [ -n "$(jobs -p)" ]; then
2021-11-17 16:59:47 +00:00
kill "$(jobs -p)"
2021-10-28 21:41:35 +00:00
fi
}
2021-10-21 15:20:26 +00:00
2021-10-19 15:32:35 +00:00
function pretty_name() {
2021-10-19 16:31:11 +00:00
local SIMPLE_NAME=""
2021-10-19 15:32:35 +00:00
local PRETTY_NAME=""
2021-10-19 16:31:11 +00:00
SIMPLE_NAME="${1}"
case ${SIMPLE_NAME} in
2021-12-03 13:42:04 +00:00
alma) PRETTY_NAME="Alma Linux";;
2021-12-30 10:23:40 +00:00
alpine) PRETTY_NAME="Alpine Linux";;
2021-11-01 18:31:35 +00:00
android) PRETTY_NAME="Android x86";;
2021-10-29 09:36:31 +00:00
archlinux) PRETTY_NAME="Arch Linux";;
2021-12-20 10:35:54 +00:00
arcolinux) PRETTY_NAME="Arco Linux";;
2021-11-22 20:32:38 +00:00
cachyos) PRETTY_NAME="CachyOS";;
2022-07-24 00:13:00 +00:00
centos-stream) PRETTY_NAME="CentOS Stream";;
2022-02-23 11:39:11 +00:00
dragonflybsd) PRETTY_NAME="DragonFlyBSD";;
2021-10-19 16:31:11 +00:00
elementary) PRETTY_NAME="elementary OS";;
2022-07-24 00:07:33 +00:00
endeavouros) PRETTY_NAME="EndeavourOS";;
2021-10-19 16:31:11 +00:00
freebsd) PRETTY_NAME="FreeBSD";;
2022-02-24 22:31:23 +00:00
freedos) PRETTY_NAME="FreeDOS";;
2021-11-08 00:32:57 +00:00
garuda) PRETTY_NAME="Garuda Linux";;
2022-02-21 23:32:50 +00:00
ghostbsd) PRETTY_NAME="GhostBSD";;
2021-11-08 00:03:50 +00:00
kdeneon) PRETTY_NAME="KDE Neon";;
2021-12-21 21:13:47 +00:00
kolibrios) PRETTY_NAME="KolibriOS";;
2022-02-21 05:08:33 +00:00
linuxmint) PRETTY_NAME="Linux Mint";;
2022-07-24 00:17:23 +00:00
lmde) PRETTY_NAME="Linux Mint Debian Edition";;
2022-02-21 04:35:33 +00:00
mxlinux) PRETTY_NAME="MX Linux";;
2022-02-21 16:41:26 +00:00
netboot) PRETTY_NAME="netboot.xyz";;
2022-02-22 00:51:34 +00:00
netbsd) PRETTY_NAME="NetBSD";;
2022-02-21 04:49:19 +00:00
nixos) PRETTY_NAME="NixOS";;
2021-10-19 16:31:11 +00:00
macos) PRETTY_NAME="macOS";;
2021-10-20 22:22:35 +00:00
openbsd) PRETTY_NAME="OpenBSD";;
2021-10-19 16:50:28 +00:00
opensuse) PRETTY_NAME="openSUSE";;
2021-11-16 18:13:22 +00:00
oraclelinux) PRETTY_NAME="Oracle Linux";;
2021-10-19 16:31:11 +00:00
popos) PRETTY_NAME="Pop!_OS";;
2022-08-18 08:44:09 +00:00
reactos) PRETTY_NAME="ReactOS";;
2021-11-01 18:10:55 +00:00
rockylinux) PRETTY_NAME="Rocky Linux";;
2021-10-19 16:31:11 +00:00
ubuntu-budgie) PRETTY_NAME="Ubuntu Budgie";;
2022-02-23 22:21:32 +00:00
ubuntukylin) PRETTY_NAME="Ubuntu Kylin";;
2021-10-19 16:31:11 +00:00
ubuntu-mate) PRETTY_NAME="Ubuntu MATE";;
2022-02-23 22:21:32 +00:00
ubuntustudio) PRETTY_NAME="Ubuntu Studio";;
2022-01-16 03:38:45 +00:00
void) PRETTY_NAME="Void Linux";;
2021-11-07 23:18:29 +00:00
zorin) PRETTY_NAME="Zorin OS";;
2021-10-19 16:31:11 +00:00
*) PRETTY_NAME="${SIMPLE_NAME^}";;
2021-10-19 15:32:35 +00:00
esac
echo "${PRETTY_NAME}"
}
2021-10-19 15:33:03 +00:00
function validate_release() {
local DISPLAY_NAME=""
2022-02-21 15:35:10 +00:00
local RELEASE_GENERATOR=""
2021-10-19 15:33:03 +00:00
local RELEASES=""
DISPLAY_NAME="$(pretty_name "${OS}")"
2022-02-21 15:35:10 +00:00
case ${OS} in
*ubuntu*) RELEASE_GENERATOR="releases_ubuntu";;
*) RELEASE_GENERATOR="${1}";;
esac
2021-10-19 15:33:03 +00:00
RELEASES=$(${RELEASE_GENERATOR})
if [[ "${RELEASES}" != *"${RELEASE}"* ]]; then
2022-02-21 15:04:03 +00:00
echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release.\n"
echo -n "${RELEASES}"
2021-10-19 15:33:03 +00:00
exit 1
fi
}
2021-10-19 23:37:46 +00:00
function list_json() {
# Reference: https://stackoverflow.com/a/67359273
list_csv | jq -R 'split(",") as $h|reduce inputs as $in ([]; . += [$in|split(",")|. as $a|reduce range(0,length) as $i ({};.[$h[$i]]=$a[$i])])'
exit 0
}
2021-10-19 23:35:00 +00:00
function list_csv() {
2021-10-19 10:41:57 +00:00
local DISPLAY_NAME
2022-02-21 07:06:06 +00:00
local DL=""
2021-10-27 15:32:11 +00:00
local DOWNLOADER
2021-10-19 10:41:57 +00:00
local FUNC
2021-10-27 15:57:55 +00:00
local OPTION
2021-10-19 10:41:57 +00:00
local OS
2021-11-13 19:42:46 +00:00
local PNG
2021-10-19 10:41:57 +00:00
local RELEASE
2021-11-13 19:42:46 +00:00
local SVG
2022-02-21 07:06:06 +00:00
local HAS_ZSYNC=0
# Check if zsync is available
if command -v zsync &>/dev/null; then
HAS_ZSYNC=1
fi
2021-11-13 10:50:49 +00:00
2022-02-21 07:06:06 +00:00
if command -v aria2c &>/dev/null; then
DL="aria2c"
elif command -v wget &>/dev/null; then
2021-11-13 10:50:49 +00:00
DL="wget"
fi
2022-02-21 07:06:06 +00:00
2021-11-13 19:42:46 +00:00
echo "Display Name,OS,Release,Option,Downloader,PNG,SVG"
2021-10-19 10:41:57 +00:00
for OS in $(os_support); do
2021-10-19 15:32:35 +00:00
DISPLAY_NAME="$(pretty_name "${OS}")"
2021-10-19 10:41:57 +00:00
if [[ "${OS}" == *"ubuntu"* ]]; then
FUNC="ubuntu"
else
FUNC="${OS}"
fi
2021-11-17 11:59:30 +00:00
PNG="https://quickemu-project.github.io/quickemu-icons/png/${FUNC}/${FUNC}-quickemu-white-pinkbg.png"
2021-11-18 11:12:27 +00:00
SVG="https://quickemu-project.github.io/quickemu-icons/svg/${FUNC}/${FUNC}-quickemu-white-pinkbg.svg"
2021-11-13 19:42:46 +00:00
2021-10-19 10:41:57 +00:00
for RELEASE in $("releases_${FUNC}"); do
2021-10-27 15:32:11 +00:00
if [ "${OS}" == "macos" ]; then
DOWNLOADER="macrecovery"
2022-02-21 07:06:06 +00:00
elif [ "${OS}" == "ubuntu" ] && [ "${RELEASE}" == "canary" ] && [ ${HAS_ZSYNC} -eq 1 ]; then
DOWNLOADER="zsync"
elif [[ "${OS}" == *"ubuntu"* ]] && [ "${RELEASE}" == "devel" ] && [ ${HAS_ZSYNC} -eq 1 ]; then
DOWNLOADER="zsync"
2021-10-27 15:32:11 +00:00
else
2022-02-21 07:06:06 +00:00
DOWNLOADER="${DL}"
2021-10-27 15:32:11 +00:00
fi
2022-02-21 09:19:07 +00:00
# If the OS has an editions_() function, use it.
if [[ $(type -t "editions_${OS}") == function ]]; then
for OPTION in $(editions_"${OS}"); do
2022-02-21 04:49:19 +00:00
echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}"
done
2022-02-21 09:19:07 +00:00
elif [ "${OS}" == "windows" ]; then
for OPTION in "${LANGS[@]}"; do
2021-11-13 19:42:46 +00:00
echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER},${PNG},${SVG}"
2021-10-19 19:36:05 +00:00
done
2021-10-19 10:41:57 +00:00
else
2021-11-13 19:42:46 +00:00
echo "${DISPLAY_NAME},${OS},${RELEASE},,${DOWNLOADER},${PNG},${SVG}"
2021-10-19 10:41:57 +00:00
fi
done
done
exit 0
}
2021-09-27 23:09:46 +00:00
function os_support() {
2021-12-03 13:42:04 +00:00
echo alma \
2021-12-30 10:23:04 +00:00
alpine \
2021-12-03 13:42:04 +00:00
android \
2021-10-29 13:50:45 +00:00
archlinux \
2021-12-20 10:35:54 +00:00
arcolinux \
2022-07-23 23:59:15 +00:00
batocera \
2021-11-22 20:32:38 +00:00
cachyos \
2022-07-24 00:13:00 +00:00
centos-stream \
2021-11-19 22:01:27 +00:00
debian \
2022-07-24 00:15:52 +00:00
deepin \
2022-02-21 04:37:37 +00:00
devuan \
2022-02-23 11:39:11 +00:00
dragonflybsd \
2021-10-29 09:36:31 +00:00
elementary \
2022-07-24 00:07:33 +00:00
endeavouros \
2021-10-19 11:04:16 +00:00
fedora \
2022-02-21 16:29:42 +00:00
freebsd \
2022-02-24 22:31:23 +00:00
freedos \
2021-11-08 00:32:57 +00:00
garuda \
2021-11-28 23:06:23 +00:00
gentoo \
2022-02-21 23:32:50 +00:00
ghostbsd \
2021-12-26 15:05:38 +00:00
haiku \
2021-10-25 10:32:22 +00:00
kali \
2021-11-07 23:39:20 +00:00
kdeneon \
2021-12-21 21:13:47 +00:00
kolibrios \
2021-10-07 15:22:45 +00:00
kubuntu \
2022-02-21 05:08:33 +00:00
linuxmint \
2022-07-24 00:17:23 +00:00
lmde \
2022-02-21 04:23:29 +00:00
manjaro \
2022-02-21 04:35:33 +00:00
mxlinux \
2022-02-21 16:41:26 +00:00
netboot \
2022-02-22 00:51:34 +00:00
netbsd \
2022-02-21 04:49:19 +00:00
nixos \
2021-09-27 23:09:46 +00:00
lubuntu \
macos \
2021-10-20 21:07:07 +00:00
openbsd \
2021-10-16 18:27:45 +00:00
opensuse \
2021-11-16 18:13:22 +00:00
oraclelinux \
2021-10-19 11:04:00 +00:00
popos \
2022-08-18 08:44:09 +00:00
reactos \
2021-11-01 18:10:55 +00:00
rockylinux \
2022-02-21 02:36:19 +00:00
slackware \
2021-11-07 23:41:39 +00:00
solus \
2022-01-05 16:50:09 +00:00
tails \
2021-09-27 23:09:46 +00:00
ubuntu \
2021-09-28 01:14:30 +00:00
ubuntu-budgie \
2022-02-23 03:31:04 +00:00
ubuntukylin \
2021-09-27 23:09:46 +00:00
ubuntu-mate \
2022-02-23 03:31:04 +00:00
ubuntustudio \
2022-01-16 03:38:45 +00:00
void \
2021-09-28 04:03:16 +00:00
windows \
2021-11-07 23:18:29 +00:00
xubuntu \
zorin
2021-09-27 23:09:46 +00:00
}
2021-12-03 13:42:04 +00:00
function releases_alma() {
2022-07-24 00:28:18 +00:00
echo 8.6 9.0
2021-12-03 13:42:04 +00:00
}
2022-02-21 15:05:15 +00:00
function editions_alma() {
2022-02-23 03:33:00 +00:00
echo minimal dvd
2022-02-21 15:05:15 +00:00
}
2021-12-30 10:23:04 +00:00
function releases_alpine() {
2022-02-23 03:33:00 +00:00
echo 3.12 3.13 3.14 3.15 latest
2021-12-30 10:23:04 +00:00
}
2021-10-29 13:50:45 +00:00
function releases_android() {
2022-02-23 03:33:00 +00:00
echo 7.1 8.1 9.0
2022-02-22 15:02:54 +00:00
}
function editions_android() {
2022-02-23 03:33:00 +00:00
echo x86 x86_64
2021-10-29 13:50:45 +00:00
}
2021-10-29 09:36:31 +00:00
function releases_archlinux() {
echo latest
}
2021-12-20 10:35:54 +00:00
function releases_arcolinux() {
2022-02-23 03:33:00 +00:00
echo v21.09.11 v21.11.05 v22.01.10
2022-02-21 21:12:20 +00:00
}
function editions_arcolinux() {
2022-02-23 03:33:00 +00:00
echo large small
2021-12-20 10:35:54 +00:00
}
2022-02-21 16:29:42 +00:00
function releases_cachyos() {
2022-08-01 00:24:08 +00:00
echo 220731
}
function editions_cachyos() {
echo kde gnome xfce
2022-02-21 16:29:42 +00:00
}
2022-07-24 00:13:00 +00:00
function releases_centos-stream() {
echo 8 9
}
function editions_centos-stream() {
echo dvd1 boot
}
2021-11-19 22:01:27 +00:00
function releases_debian() {
2022-09-20 10:35:38 +00:00
DEBCURRENT=$(wget -q https://cdimage.debian.org/debian-cd/ -O- |grep '\.[0-9]/'|cut -d\> -f9|cut -d\/ -f1)
local DEBOLD=$(wget -q https://cdimage.debian.org/cdimage/archive/ -O- |grep -e '>[1-9][0-9]\.'|grep -v 'live' | cut -d\> -f9|cut -d\/ -f1 )
echo ${DEBOLD} ${DEBCURRENT}
2021-11-19 22:01:27 +00:00
}
2022-02-21 09:19:07 +00:00
function editions_debian() {
2022-02-23 11:32:55 +00:00
echo standard cinnamon gnome kde lxde lxqt mate xfce netinst
2022-02-21 09:19:07 +00:00
}
2022-07-24 00:15:52 +00:00
function releases_deepin() {
2022-09-12 02:21:09 +00:00
echo 20 20.1 20.2 20.2.1 20.2.2 20.2.3 20.2.4 20.3 20.4 20.5 20.6 20.7
2022-07-24 00:15:52 +00:00
}
2022-02-21 03:20:13 +00:00
function releases_devuan() {
2022-02-23 03:33:00 +00:00
echo beowulf chimaera
2022-02-21 03:20:13 +00:00
}
2022-02-23 11:39:11 +00:00
function releases_dragonflybsd() {
echo 6.2.1
}
2021-10-19 11:04:16 +00:00
function releases_elementary() {
2022-01-17 00:48:40 +00:00
echo 6.1
2021-10-19 11:04:16 +00:00
}
2022-07-24 00:07:33 +00:00
function releases_endeavouros() {
echo apollo_22_1 \
atlantis-21_4 \
atlantis_neo-21_5
}
2022-02-21 22:18:50 +00:00
function releases_fedora() {
2022-07-24 00:16:05 +00:00
echo 33 34 35 36
2021-10-13 19:12:33 +00:00
}
2022-07-23 23:59:15 +00:00
function releases_batocera() {
2022-08-01 08:14:21 +00:00
echo 32 33 34
2022-07-23 23:59:15 +00:00
}
2022-02-21 22:18:50 +00:00
function editions_fedora() {
echo Workstation \
Cinnamon \
i3 \
KDE \
LXDE \
LXQt \
Mate \
Xfce \
Silverblue \
Server
}
2022-02-21 16:29:42 +00:00
function releases_freebsd(){
2022-07-24 00:10:21 +00:00
echo 12.3 13.0
2021-11-28 23:06:23 +00:00
}
2022-02-23 11:18:41 +00:00
function editions_freebsd(){
echo disc1 dvd1
}
2022-02-24 22:31:23 +00:00
function releases_freedos() {
2022-02-24 23:04:35 +00:00
echo 1.2 1.3
2022-02-24 22:31:23 +00:00
}
2021-11-08 00:32:57 +00:00
function releases_garuda() {
2022-07-24 00:08:54 +00:00
echo latest
2022-02-21 20:08:50 +00:00
}
function editions_garuda() {
2022-07-24 00:08:54 +00:00
URL="https://mirrors.fossho.st/garuda/iso/latest/garuda/"
echo $(wget -q -O - ${URL} | grep '^<a href' | sed -e 's/^.*="//' -e 's/\/.*//')
2021-11-08 00:32:57 +00:00
}
2022-02-23 03:33:00 +00:00
function releases_gentoo() {
2022-02-21 16:29:42 +00:00
echo latest
}
2022-02-23 03:33:00 +00:00
function releases_ghostbsd() {
echo 21.10.16 21.11.24 22.01.12
2022-02-21 23:32:50 +00:00
}
2022-02-23 03:33:00 +00:00
function editions_ghostbsd() {
echo mate xfce
2022-02-21 23:32:50 +00:00
}
2021-12-26 15:05:38 +00:00
function releases_haiku() {
2022-02-21 17:40:50 +00:00
echo r1beta3
2021-12-26 15:05:38 +00:00
}
2022-02-21 17:40:50 +00:00
function editions_haiku() {
2022-02-23 03:33:00 +00:00
echo x86_64 x86_gcc2h
2022-02-21 17:40:50 +00:00
}
2021-10-25 10:32:22 +00:00
function releases_kali() {
2022-02-23 03:33:00 +00:00
echo current kali-weekly
2021-10-25 10:32:22 +00:00
}
2021-11-07 23:39:20 +00:00
function releases_kdeneon() {
2022-02-23 03:33:00 +00:00
echo user testing unstable developer
2021-11-07 23:39:20 +00:00
}
2021-12-21 21:13:47 +00:00
function releases_kolibrios() {
2022-01-17 05:38:57 +00:00
echo latest
2021-12-21 21:13:47 +00:00
}
2021-10-16 19:58:53 +00:00
function releases_linuxmint(){
2022-08-07 09:15:56 +00:00
echo 20.2 20.3 21
2021-10-16 19:58:53 +00:00
}
2022-02-21 09:19:07 +00:00
function editions_linuxmint(){
2022-02-23 03:33:00 +00:00
echo cinnamon mate xfce
2022-02-21 09:19:07 +00:00
}
2022-07-24 00:17:23 +00:00
function editions_lmde(){
echo cinnamon
}
function releases_lmde(){
echo 5
}
2021-12-27 07:06:28 +00:00
function releases_mxlinux(){
2022-09-19 10:26:00 +00:00
echo 21.2.1
2021-12-27 07:06:28 +00:00
}
2022-02-21 09:19:07 +00:00
function editions_mxlinux(){
2022-02-23 03:33:00 +00:00
echo Xfce KDE Fluxbox
2022-02-21 09:19:07 +00:00
}
2022-02-21 16:29:42 +00:00
function releases_macos() {
2022-09-20 10:34:02 +00:00
echo high-sierra mojave catalina big-sur monterey ventura
2022-02-21 16:29:42 +00:00
}
function releases_manjaro() {
echo xfce \
gnome \
kde \
budgie \
cinnamon \
i3 \
mate
}
2022-02-21 16:41:26 +00:00
function releases_netboot() {
echo latest
}
2022-02-22 00:51:34 +00:00
function releases_netbsd() {
2022-02-23 03:33:00 +00:00
echo 9.0 9.1 9.2
2022-02-22 00:51:34 +00:00
}
2021-10-24 21:20:46 +00:00
function releases_nixos(){
2022-07-24 00:16:24 +00:00
echo 21.05 21.11 22.05
2021-10-24 21:20:46 +00:00
}
2022-02-21 09:19:07 +00:00
function editions_nixos(){
2022-02-23 03:33:00 +00:00
echo gnome plasma5 minimal
2022-02-21 09:19:07 +00:00
}
2021-10-20 21:07:07 +00:00
function releases_openbsd(){
2022-07-24 00:10:35 +00:00
echo 6.8 6.9 7.0 7.1
2021-10-20 21:07:07 +00:00
}
2021-10-16 18:27:45 +00:00
function releases_opensuse(){
2022-07-24 00:17:54 +00:00
echo 15.0 15.1 15.2 15.3 15.4 microos tumbleweed
2021-10-16 18:27:45 +00:00
}
2021-11-16 18:13:22 +00:00
function releases_oraclelinux() {
2022-08-01 08:14:53 +00:00
echo 7.7 7.8 7.9 8.4 8.5 8.6 9.0
2021-11-16 18:13:22 +00:00
}
2021-10-19 11:04:00 +00:00
function releases_popos() {
2022-07-24 00:19:04 +00:00
echo 20.04 21.10 22.04
2021-10-19 11:04:00 +00:00
}
2022-02-21 09:19:07 +00:00
function editions_popos() {
2022-02-23 03:33:00 +00:00
echo intel nvidia
2022-02-21 09:19:07 +00:00
}
2022-08-18 08:44:09 +00:00
function releases_reactos() {
echo latest
}
2021-11-01 18:10:55 +00:00
function releases_rockylinux() {
2022-07-24 00:21:41 +00:00
echo 8.3 8.4 8.5 9.0
2021-11-01 18:10:55 +00:00
}
2022-07-24 00:21:41 +00:00
# Rocky have renamed dvd1 -> dvd at 9.0
2022-02-21 15:05:55 +00:00
function editions_rockylinux() {
echo minimal \
2022-07-24 00:21:41 +00:00
"dvd (dvd1 prior to 9.0)"
2022-02-21 15:05:55 +00:00
}
2022-02-21 02:36:19 +00:00
function releases_slackware() {
2022-02-23 03:33:00 +00:00
echo 14.2 15.0
2022-02-21 02:36:19 +00:00
}
2021-11-07 23:41:39 +00:00
function releases_solus() {
2022-02-21 14:57:11 +00:00
echo 4.3
}
function editions_solus() {
2022-02-23 03:33:00 +00:00
echo Budgie GNOME MATE Plasma
2021-11-07 23:41:39 +00:00
}
2022-01-05 16:50:09 +00:00
function releases_tails() {
echo stable
}
2021-09-27 23:09:46 +00:00
function releases_ubuntu() {
2022-04-22 08:44:23 +00:00
local LTS_SUPPORT="14.04 16.04 18.04 20.04 22.04"
2022-03-01 11:10:53 +00:00
case "${OS}" in
kubuntu|lubuntu|ubuntukylin|\
ubuntu-mate|ubuntustudio|xubuntu)
## after 14.04
LTS_SUPPORT="${LTS_SUPPORT/14.04 /}"
;;
ubuntu-budgie)
#after 16.04
LTS_SUPPORT="${LTS_SUPPORT/14.04 16.04 /}"
;;
esac
echo ${LTS_SUPPORT} \
2022-08-11 01:27:54 +00:00
jammy-daily \
2022-02-24 22:28:29 +00:00
daily-live \
daily-canary \
eol-4.10 \
eol-5.04 \
eol-5.10 \
eol-6.06.0 eol-6.06.1 eol-6.06.2 \
eol-6.10 \
eol-7.04 \
eol-7.10 \
eol-8.04.0 eol-8.04.1 eol-8.04.2 eol-8.04.3 eol-8.04.4 \
eol-8.10 \
eol-9.04 \
eol-9.10 \
eol-10.04.0 eol-10.04.1 eol-10.04.2 eol-10.04.3 eol-10.04.4 \
eol-10.10 \
eol-11.04 \
eol-11.10 \
eol-12.04 eol-12.04.0 eol-12.04.1 eol-12.04.2 eol-12.04.3 eol-12.04.4 eol-12.04.5 \
eol-12.10 \
eol-13.04 \
eol-13.10 \
eol-14.04.0 eol-14.04.1 eol-14.04.2 eol-14.04.3 eol-14.04.4 eol-14.04.5 \
eol-14.10 \
eol-15.04 \
eol-15.10 \
eol-16.04.0 eol-16.04.1 eol-16.04.2 eol-16.04.3 eol-16.04.4 eol-16.04.5 eol-16.04.6 \
eol-16.10 \
eol-17.04 \
eol-17.10 \
eol-18.04 eol-18.04.0 eol-18.04.1 eol-18.04.2 eol-18.04.3 eol-18.04.4 eol-18.04.5 \
eol-18.10 \
eol-19.04 \
eol-19.10 \
eol-20.04 eol-20.04.0 eol-20.04.1 eol-20.04.2 \
eol-20.10 \
eol-21.04 \
eol-21.10 \
;
2021-09-27 23:09:46 +00:00
}
2022-01-16 03:38:45 +00:00
function releases_void() {
2022-02-21 15:24:25 +00:00
echo current
}
function editions_void() {
2022-02-23 03:33:00 +00:00
echo glibc musl xfce-glibc xfce-musl
2022-01-16 03:38:45 +00:00
}
2022-02-21 10:11:25 +00:00
function releases_windows() {
2022-02-23 03:33:00 +00:00
echo 8 10 11
2022-02-21 10:11:25 +00:00
}
2021-09-28 04:03:16 +00:00
function languages_windows() {
2021-10-19 10:41:57 +00:00
LANGS=(Arabic
"Brazilian Portuguese"
Bulgarian
"Chinese (Simplified)"
"Chinese (Traditional)"
Croatian
Czech
Danish
Dutch
English
"English International"
Estonian
Finnish
French
"French Canadian"
German
Greek
Hebrew
Hungarian
Italian
Japanese
Korean
Latvian
Lithuanian
Norwegian
Polish
Portuguese
Romanian
Russian
"Serbian Latin"
Slovak
Slovenian
Spanish
"Spanish (Mexico)"
Swedish
Thai
Turkish
Ukrainian)
2021-09-28 04:03:16 +00:00
}
2021-11-07 23:18:29 +00:00
function releases_zorin() {
2022-02-21 17:48:32 +00:00
echo 16
}
function editions_zorin() {
2022-02-23 03:33:00 +00:00
echo core64 lite64 education64 edulite64
2021-11-07 23:18:29 +00:00
}
2021-12-06 15:20:48 +00:00
function check_hash() {
local iso=""
local hash=""
local hash_algo=""
iso="${VM_PATH}/${1}"
hash="${2}"
2021-10-08 01:04:30 +00:00
2021-12-06 15:20:48 +00:00
# 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;;
*) echo "WARNING! Can't guess hash algorithm, not checking ${iso} hash."
return;;
esac
2021-10-08 01:04:30 +00:00
2021-12-06 15:20:48 +00:00
echo -n "Checking ${iso} with ${hash_algo}... "
if ! echo "${hash} ${iso}" | ${hash_algo} --check --status; then
echo "ERROR!"
echo "${iso} doesn't match ${hash}. Try running 'quickget' again."
exit 1
else
echo "Good!"
fi
}
2021-12-06 10:58:24 +00:00
2021-12-06 15:20:48 +00:00
function web_get() {
local DIR="${2}"
local FILE=""
local URL="${1}"
2021-12-06 10:58:24 +00:00
2021-12-06 15:20:48 +00:00
if [ -n "${3}" ]; then
FILE="${3}"
else
FILE="${URL##*/}"
fi
2021-10-08 01:04:30 +00:00
2021-12-06 15:20:48 +00:00
if ! mkdir -p "${DIR}" 2>/dev/null; then
echo "ERROR! Unable to create directory ${DIR}"
exit 1
fi
2022-02-19 11:49:09 +00:00
2022-02-21 07:06:06 +00:00
if command -v aria2c &>/dev/null; then
2022-02-24 22:23:41 +00:00
if ! aria2c --stderr -x16 --continue=true --summary-interval=0 --download-result=hide --console-log-level=error "${URL}" -o "${DIR}/${FILE}"; then
2022-02-21 01:40:23 +00:00
echo #Necessary as aria2c in suppressed mode does not have new lines
2022-02-21 01:51:15 +00:00
echo "ERROR! Failed to download ${URL} with aria2c. Try running 'quickget' again."
2022-02-17 10:06:47 +00:00
exit 1
fi
2022-02-21 01:40:23 +00:00
echo #Necessary as aria2c in suppressed mode does not have new lines
2022-02-17 10:14:17 +00:00
else
2022-02-17 10:06:47 +00:00
if ! wget --quiet --continue --show-progress --progress=bar:force:noscroll "${URL}" -O "${DIR}/${FILE}"; then
2022-02-21 01:51:15 +00:00
echo "ERROR! Failed to download ${URL} with wget. Try running 'quickget' again."
2022-02-17 10:06:47 +00:00
exit 1
fi
2021-12-06 15:20:48 +00:00
fi
}
2021-10-08 01:04:30 +00:00
2021-12-06 15:20:48 +00:00
function zsync_get() {
local DIR="${2}"
2022-02-23 03:24:56 +00:00
local FILE="${1##*/}"
2021-12-06 15:20:48 +00:00
local OUT=""
local URL="${1}"
2022-02-21 07:06:06 +00:00
if command -v zsync &>/dev/null; then
2022-02-23 03:24:56 +00:00
if [ -n "${3}" ]; then
OUT="${3}"
else
OUT="${FILE}"
fi
2021-09-27 23:09:46 +00:00
2022-02-23 03:24:56 +00:00
if ! mkdir -p "${DIR}" 2>/dev/null; then
echo "ERROR! Unable to create directory ${DIR}"
2021-11-13 10:50:49 +00:00
exit 1
2022-02-23 03:24:56 +00:00
fi
2021-11-13 10:50:49 +00:00
2022-02-25 23:01:51 +00:00
# Only force http for zsync - not earlier because we might fall through here
if ! zsync "${URL/https/http}.zsync" -i "${DIR}/${OUT}" -o "${DIR}/${OUT}" 2>/dev/null; then
echo "ERROR! Failed to download ${URL/https/http}.zsync"
2022-02-23 03:24:56 +00:00
exit 1
fi
if [ -e "${DIR}/${OUT}.zs-old" ]; then
rm "${DIR}/${OUT}.zs-old"
fi
2021-11-13 10:50:49 +00:00
else
2022-02-23 03:24:56 +00:00
echo "INFO: zsync not found, falling back to wget/aria2c"
if [ -n "${3}" ]; then
web_get "${1}" "${2}" "${3}"
else
web_get "${1}" "${2}"
fi
2021-09-27 23:09:46 +00:00
fi
}
function make_vm_config() {
2022-02-21 20:29:22 +00:00
local CONF_FILE=""
2021-09-27 23:09:46 +00:00
local IMAGE_FILE=""
2021-09-28 14:32:12 +00:00
local ISO_FILE=""
2021-09-27 23:09:46 +00:00
local IMAGE_TYPE=""
local GUEST=""
2021-10-25 15:13:53 +00:00
local SEC_BOOT=""
2021-09-27 23:09:46 +00:00
IMAGE_FILE="${1}"
2021-09-28 14:32:12 +00:00
ISO_FILE="${2}"
2022-02-17 10:03:31 +00:00
case "${OS}" in
2022-07-23 23:59:15 +00:00
batocera)
GUEST="batocera"
IMAGE_TYPE="img";;
2022-02-23 11:39:11 +00:00
dragonflybsd)
GUEST="dragonflybsd"
IMAGE_TYPE="iso";;
2022-02-21 23:32:50 +00:00
freebsd|ghostbsd)
GUEST="freebsd"
2022-02-17 10:03:31 +00:00
IMAGE_TYPE="iso";;
2022-02-17 10:14:03 +00:00
haiku)
GUEST="haiku"
IMAGE_TYPE="iso";;
2022-02-24 22:31:23 +00:00
freedos)
GUEST="freedos"
IMAGE_TYPE="iso";;
2022-02-17 10:14:03 +00:00
kolibrios)
GUEST="kolibrios"
IMAGE_TYPE="iso";;
2022-02-21 05:57:59 +00:00
macos)
2022-02-17 10:03:31 +00:00
GUEST="macos"
IMAGE_TYPE="img";;
2022-02-22 00:51:34 +00:00
netbsd)
GUEST="netbsd"
IMAGE_TYPE="iso";;
2022-02-21 23:32:50 +00:00
openbsd)
GUEST="openbsd"
IMAGE_TYPE="iso";;
2022-08-18 08:44:09 +00:00
reactos)
GUEST="reactos"
IMAGE_TYPE="iso";;
2022-02-21 05:57:59 +00:00
windows)
2022-02-17 10:03:31 +00:00
GUEST="windows"
IMAGE_TYPE="iso";;
*)
GUEST="linux"
IMAGE_TYPE="iso";;
esac
2021-12-03 13:42:04 +00:00
2022-02-21 20:29:22 +00:00
if [ -n "${EDITION}" ]; then
CONF_FILE="${OS}-${RELEASE}-${EDITION}.conf"
else
CONF_FILE="${OS}-${RELEASE}.conf"
2021-12-03 13:42:04 +00:00
fi
2022-02-21 20:29:22 +00:00
if [ ! -e "${CONF_FILE}" ]; then
echo "Making ${CONF_FILE}"
cat << EOF > "${CONF_FILE}"
2022-03-22 15:44:14 +00:00
#!$(which quickemu) --vm
2021-09-27 23:09:46 +00:00
guest_os="${GUEST}"
disk_img="${VM_PATH}/disk.qcow2"
2021-09-28 04:03:16 +00:00
${IMAGE_TYPE}="${VM_PATH}/${IMAGE_FILE}"
2021-09-27 23:09:46 +00:00
EOF
2022-03-22 15:44:14 +00:00
echo "Giving user execute permissions on ${CONF_FILE},"
chmod u+x "${CONF_FILE}"
2021-09-28 14:32:12 +00:00
if [ -n "${ISO_FILE}" ]; then
2022-02-21 20:29:22 +00:00
echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${CONF_FILE}"
2021-09-28 04:03:16 +00:00
fi
2021-12-21 21:13:47 +00:00
2022-02-21 20:29:22 +00:00
# OS specific tweaks
2022-02-21 15:57:32 +00:00
case ${OS} in
2022-08-19 16:16:54 +00:00
alma|centos-stream|oraclelinux|rockylinux)
echo "disk_size=\"32G\"" >> "${CONF_FILE}";;
batocera)
echo "disk_size=\"8G\"" >> "${CONF_FILE}";;
dragonflybsd|haiku|openbsd|netbsd|slackware|tails)
echo "boot=\"legacy\"" >> "${CONF_FILE}";;
2022-07-24 00:15:52 +00:00
deepin)
echo "disk_size=\"64G\"" >> "${CONF_FILE}"
echo "ram=\"4G\"" >> "${CONF_FILE}"
;;
2022-02-24 22:31:23 +00:00
freedos)
echo "boot=\"legacy\"" >> "${CONF_FILE}"
echo "disk_size=\"4G\"" >> "${CONF_FILE}"
echo "ram=\"256M\"" >> "${CONF_FILE}"
;;
2022-02-22 00:53:36 +00:00
kolibrios)
echo "boot=\"legacy\"" >> "${CONF_FILE}"
echo "disk_size=\"2G\"" >> "${CONF_FILE}"
echo "ram=\"128M\"" >> "${CONF_FILE}"
;;
2022-08-18 08:47:59 +00:00
zorin)
case ${EDITION} in
education64|edulite64)
echo "disk_size=\"32G\"" >> "${CONF_FILE}";;
esac
;;
2022-08-18 08:44:09 +00:00
reactos)
echo "boot=\"legacy\"" >> "${CONF_FILE}"
echo "disk_size=\"12G\"" >> "${CONF_FILE}"
echo "ram=\"2048M\"" >> "${CONF_FILE}"
;;
2022-08-18 11:55:47 +00:00
macos)
echo "macos_release=\"${RELEASE}\"" >> "${CONF_FILE}"
# https://github.com/quickemu-project/quickemu/issues/438
if [ "${RELEASE}" == "monterey" ]; then
echo "cpu_cores=2" >> "${CONF_FILE}"
fi
;;
2022-02-21 15:57:32 +00:00
esac
2021-10-06 10:01:33 +00:00
# Enable TPM for Windows 11
2021-10-19 15:38:43 +00:00
if [ "${OS}" == "windows" ] && [ "${RELEASE}" -ge 11 ]; then
2022-02-21 20:29:22 +00:00
echo "tpm=\"on\"" >> "${CONF_FILE}"
2021-10-25 15:13:53 +00:00
# Only force SecureBoot on for non-Debian/Ubuntu distros.
if [ -e "/usr/share/OVMF/OVMF_CODE_4M.fd" ] && [ -e "/usr/share/OVMF/OVMF_VARS_4M.fd" ]; then
SEC_BOOT="off"
else
SEC_BOOT="on"
fi
2022-02-21 20:29:22 +00:00
echo "secureboot=\"${SEC_BOOT}\"" >> "${CONF_FILE}"
2021-10-06 10:01:33 +00:00
fi
2021-09-27 23:09:46 +00:00
fi
2022-02-21 20:29:22 +00:00
echo
echo "To start your $(pretty_name "${OS}") virtual machine run:"
echo " quickemu --vm ${CONF_FILE}"
echo
exit 0
2021-09-27 23:09:46 +00:00
}
2021-12-03 13:42:04 +00:00
function get_alma() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-12-03 13:42:04 +00:00
local HASH=""
2022-02-23 10:02:25 +00:00
local ISO="AlmaLinux-${RELEASE}-x86_64-${EDITION}.iso"
2022-07-24 00:09:40 +00:00
local URL="http://lon.mirror.rackspace.com/almalinux/${RELEASE/beta-1/beta}/isos/x86_64/"
2022-02-23 10:02:25 +00:00
HASH="$(wget -q -O- "${URL}/CHECKSUM" | grep "(${ISO}" | cut -d' ' -f4)"
echo "${URL}/${ISO} ${HASH}"
2021-12-03 13:42:04 +00:00
}
2021-12-30 10:23:04 +00:00
function get_alpine() {
local HASH=""
local ISO=""
local URL=""
local VERSION=""
2022-01-17 02:13:53 +00:00
2022-02-21 01:52:37 +00:00
case ${RELEASE} in
2022-02-23 10:04:05 +00:00
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";;
2022-02-21 01:52:37 +00:00
esac
2022-02-21 20:37:40 +00:00
VERSION=$(wget -qO- "${URL}/latest-releases.yaml" | awk '/"Xen"/{found=0} {if(found) print} /"Virtual"/{found=1}' | grep 'version:' | awk '{print $2}')
2021-12-30 10:23:04 +00:00
ISO="alpine-virt-${VERSION}-x86_64.iso"
2022-02-21 20:37:40 +00:00
HASH=$(wget -qO- "${URL}/latest-releases.yaml" | awk '/"Xen"/{found=0} {if(found) print} /"Virtual"/{found=1}' | grep 'sha256:' | awk '{print $2}')
2022-02-23 10:04:05 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-12-30 10:23:04 +00:00
}
2022-02-22 15:02:54 +00:00
function get_android() {
local EDITION="${1:-}"
local HASH=""
local ISO=""
local JSON_ALL=""
local JSON_REL=""
local URL="https://mirrors.gigenet.com/OSDN/android-x86"
JSON_ALL=$(wget -q -O- "https://www.fosshub.com/Android-x86-old.html" | grep "var settings =" | cut -d'=' -f2-)
JSON_REL=$(echo "${JSON_ALL}" | jq --arg ver "${OS}-${EDITION}-${RELEASE}" 'first(.pool.f[] | select((.n | startswith($ver)) and (.n | endswith(".iso"))))')
ISO=$(echo "${JSON_REL}" | jq -r .n)
HASH=$(echo "${JSON_REL}" | jq -r .hash.sha256)
# Traverse the directories to find the .iso location
2022-08-07 11:11:56 +00:00
for DIR in $(wget -4 -q -O- "${URL}" | grep -o -E '[0-9]{5}' | sort -ur); do
if wget -4 -q -O- "${URL}/${DIR}" | grep "${ISO}" &>/dev/null; then
2022-02-22 15:02:54 +00:00
URL="${URL}/${DIR}"
break
fi
done
2022-02-23 10:09:07 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-02-22 15:02:54 +00:00
}
2021-10-29 09:36:31 +00:00
function get_archlinux() {
local HASH=""
local ISO=""
2022-02-23 10:11:01 +00:00
local URL="https://mirror.rackspace.com/archlinux"
ISO=$(wget -q -O- "https://archlinux.org/releng/releases/json/" | jq -r '.releases[0].iso_url')
HASH=$(wget -q -O- "https://archlinux.org/releng/releases/json/" | jq -r '.releases[0].sha1_sum')
echo "${URL}/${ISO} ${HASH}"
2021-10-29 09:36:31 +00:00
}
2021-12-20 10:35:54 +00:00
function get_arcolinux() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-12-20 10:35:54 +00:00
local HASH=""
2022-02-23 10:20:09 +00:00
local ISO="arcolinux${EDITION:0:1}-${RELEASE}-x86_64.iso"
local URL="https://ant.seedhost.eu/arcolinux/iso/${RELEASE}"
HASH=$(wget -q -O- "${URL}/${ISO}.sha1" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
2021-12-20 10:35:54 +00:00
}
2021-11-19 22:01:27 +00:00
2022-07-23 23:59:15 +00:00
function get_batocera() {
local HASH=""
2022-08-01 08:14:21 +00:00
local URL="https://mirrors.o2switch.fr/batocera/x86_64/stable/last"
local ISO="$(curl -sl ${URL}/ | grep -e 'batocera.*img.gz'|cut -d\" -f2)"
local CURRENT_RELEASE=$(echo "${ISO}"| cut -d\- -f3)
case ${RELEASE} in
${CURRENT_RELEASE}) #Current release
URL+=""
;;
*)
URL+="/archives/${RELEASE}"
ISO="$(curl -sl ${URL}/ | grep -e 'batocera.*img.gz'|cut -d\" -f2)"
;; # non-current are here
esac
2022-07-23 23:59:15 +00:00
echo "${URL}/${ISO} ${HASH}"
}
2022-01-17 03:42:51 +00:00
function get_cachyos() {
local HASH=""
2022-08-01 00:24:08 +00:00
local ISO="cachyos-${EDITION}-linux-${RELEASE}.iso"
local URL="https://mirror.cachyos.org/ISO/${EDITION}/${RELEASE}"
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1)
2022-02-23 10:20:55 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-01-17 03:42:51 +00:00
}
2021-11-19 22:01:27 +00:00
2022-07-24 00:13:00 +00:00
function get_centos-stream() {
local HASH=""
local ISO=""
case ${RELEASE} in
8)
ISO="CentOS-Stream-${RELEASE}-x86_64-latest-${EDITION}.iso"
URL="https://mirrors.ocf.berkeley.edu/centos/8-stream/isos/x86_64"
HASH=$(wget -q -O- ${URL}/CHECKSUM | grep "SHA256 (${ISO}" | cut -d' ' -f4)
;;
9)
ISO="CentOS-Stream-${RELEASE}-latest-x86_64-${EDITION}.iso"
URL="https://mirrors.ocf.berkeley.edu/centos-stream/9-stream/BaseOS/x86_64/iso"
HASH=$(wget -q -O- ${URL}/${ISO}.SHA256SUM | grep "SHA256 (${ISO}" | cut -d' ' -f4)
;;
esac
echo "${URL}/${ISO} ${HASH}"
}
2021-11-19 22:01:27 +00:00
function get_debian() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-11-19 22:01:27 +00:00
local HASH=""
2022-02-23 10:29:25 +00:00
local ISO="debian-live-${RELEASE}-amd64-${EDITION}.iso"
2022-02-21 20:07:58 +00:00
local URL=""
2021-11-19 22:01:27 +00:00
2022-09-20 10:35:38 +00:00
DEBCURRENT=$(wget -q https://cdimage.debian.org/debian-cd/ -O- |grep '\.[0-9]/'|cut -d\> -f9|cut -d\/ -f1)
case ${RELEASE} in
"${DEBCURRENT}") URL="https://cdimage.debian.org/debian-cd/${RELEASE}-live/amd64/iso-hybrid";;
2022-02-23 10:29:25 +00:00
*) URL="https://cdimage.debian.org/cdimage/archive/${RELEASE}-live/amd64/iso-hybrid/";;
2022-02-21 20:07:58 +00:00
esac
2022-02-23 11:32:55 +00:00
if [ "${EDITION}" == "netinst" ]; then
2022-02-23 22:21:44 +00:00
URL="${URL/-live/}"
URL="${URL/hybrid/cd}"
ISO="${ISO/-live/}"
2022-02-23 11:32:55 +00:00
fi
2022-02-21 03:52:39 +00:00
HASH=$(wget -q -O- "${URL}/SHA512SUMS" | grep "${ISO}" | cut -d' ' -f1)
2022-02-23 10:29:25 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-11-19 22:01:27 +00:00
}
2022-07-24 00:15:52 +00:00
function get_deepin() {
local HASH=""
local EDITION=""
local ISO="deepin-desktop-community-${RELEASE}-amd64.iso"
# deepin-desktop-community-20.3-amd64.iso
local URL="https://cdimage.deepin.com/releases/"${RELEASE}
# fix iso name
if [[ "${RELEASE}" == *"20" ]] ; then
EDITION="1003"
ISO="deepin-desktop-community-${EDITION}-amd64.iso"
elif [[ "${RELEASE}" == *"20.1" ]]; then
EDITION="1010"
ISO="deepin-desktop-community-${EDITION}-amd64.iso"
fi
HASH=$(wget -q -O- "${URL}/SHA256SUMS" | grep "${ISO}" | cut -d' ' -f1)
#echo "${URL}/${ISO} ${HASH}"
web_get "${URL}/${ISO}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
}
2022-02-21 03:20:13 +00:00
function get_devuan() {
local HASH=""
local ISO=""
2022-02-23 10:30:15 +00:00
local URL="https://files.devuan.org/devuan_${RELEASE}/desktop-live"
2022-02-21 03:20:13 +00:00
case ${RELEASE} in
2022-02-23 10:30:15 +00:00
beowulf) ISO="devuan_${RELEASE}_3.1.1_amd64_desktop-live.iso";;
2022-09-12 01:49:07 +00:00
chimaera) ISO="devuan_${RELEASE}_4.0.2_amd64_desktop-live.iso";;
2022-02-21 03:20:13 +00:00
esac
HASH=$(wget -q -O- "${URL}/SHASUMS.txt" | grep "${ISO}" | cut -d' ' -f1)
2022-02-23 10:30:15 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-02-21 03:20:13 +00:00
}
2022-02-23 11:39:11 +00:00
function get_dragonflybsd() {
local HASH=""
2022-02-23 11:41:53 +00:00
local ISO="dfly-x86_64-${RELEASE}_REL.iso"
local URL="http://mirror-master.dragonflybsd.org/iso-images"
2022-02-23 11:39:11 +00:00
HASH=$(wget -q -O- "${URL}/md5.txt" | grep "(${ISO})" | cut -d' ' -f4)
2022-02-23 11:41:53 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-02-23 11:39:11 +00:00
}
2021-10-19 11:04:16 +00:00
function get_elementary() {
2022-02-23 10:30:45 +00:00
local HASH=""
local ISO="elementaryos-${RELEASE}-stable.20211218-rc.iso"
local URL="https://ams3.dl.elementary.io/download"
echo "${URL}/$(date +%s | base64)/${ISO} ${HASH}"
2021-10-19 11:04:16 +00:00
}
2022-07-24 00:07:33 +00:00
function get_endeavouros() {
local HASH=""
# Endeavour release names are Capitalized and our $RELEASE is forced to lowercase so we have to revert it
local ISO="EndeavourOS_${RELEASE@u}.iso"
local URL="https://github.com/endeavouros-team/ISO/releases/download/1-EndeavourOS-ISO-releases-archive"
HASH=$(wget -q -O- "${URL}/${ISO}.sha512sum" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
}
2021-10-13 19:12:33 +00:00
function get_fedora() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-10-19 16:20:05 +00:00
local HASH=""
2021-10-19 14:01:43 +00:00
local ISO=""
2022-02-21 22:18:50 +00:00
local JSON=""
2021-10-13 19:12:33 +00:00
local URL=""
2022-02-21 22:18:50 +00:00
local VARIANT=""
2021-10-19 14:01:43 +00:00
2022-02-21 22:18:50 +00:00
case ${EDITION} in
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}"'")')
URL=$(echo "${JSON}" | jq -r '.link' | head -n1)
HASH=$(echo "${JSON}" | jq -r '.sha256' | head -n1)
2022-02-23 10:31:53 +00:00
echo "${URL} ${HASH}"
2021-10-13 19:12:33 +00:00
}
2022-02-21 16:29:42 +00:00
function get_freebsd() {
2022-03-11 15:23:45 +00:00
local EDITION="${1}"
2022-02-21 16:29:42 +00:00
local HASH=""
2022-03-11 15:23:45 +00:00
local ISO="FreeBSD-${RELEASE}-RELEASE-amd64-${EDITION}.iso"
2022-02-23 10:32:53 +00:00
local URL="https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/${RELEASE}"
2022-02-21 16:29:42 +00:00
2022-02-23 10:32:53 +00:00
HASH=$(wget -q -O- "${URL}/CHECKSUM.SHA256-FreeBSD-${RELEASE}-RELEASE-amd64" | grep "${ISO}" | grep -v ".xz" | cut -d' ' -f4)
echo "${URL}/${ISO} ${HASH}"
2022-02-21 16:29:42 +00:00
}
2022-02-24 22:31:23 +00:00
function get_freedos() {
local HASH=""
local ISO=""
2022-02-24 23:04:35 +00:00
local URL="http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/${RELEASE}/official"
2022-02-24 22:31:23 +00:00
2022-02-24 23:04:35 +00:00
case ${RELEASE} in
2022-02-24 22:31:23 +00:00
1.2)
ISO="FD12CD.iso"
HASH=$(wget -q -O- "${URL}/FD12.sha" | grep "${ISO}" | cut -d' ' -f1)
;;
1.3)
ISO="FD13-LiveCD.zip"
2022-02-24 23:04:35 +00:00
HASH=$(wget -q -O- "${URL}/verify.txt" | grep -A 8 "sha256sum" | grep "${ISO}" | cut -d' ' -f1)
2022-02-24 22:31:23 +00:00
;;
esac
echo "${URL}/${ISO} ${HASH}"
}
2022-02-21 16:29:42 +00:00
function get_garuda() {
2022-07-24 00:08:54 +00:00
local EDITION="${1:-}"
local HASH=""
local ISO=""
local URL="https://mirrors.fossho.st/garuda/iso/latest/garuda/"
2022-02-21 16:29:42 +00:00
2022-07-24 00:08:54 +00:00
ISO=${EDITION}/latest.iso
2022-03-01 11:07:50 +00:00
2022-07-24 00:08:54 +00:00
HASH="$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1)"
echo "${URL}/${ISO} ${HASH}"
2022-02-21 16:29:42 +00:00
}
2021-11-28 23:06:23 +00:00
function get_gentoo() {
2021-11-29 04:00:55 +00:00
local HASH=""
local ISO=""
2022-02-21 01:55:29 +00:00
local URL="https://mirror.bytemark.co.uk/gentoo/releases/amd64/autobuilds/"
2021-11-29 04:00:55 +00:00
2022-02-21 01:55:29 +00:00
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)
2022-02-23 10:34:59 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-11-28 23:06:23 +00:00
}
2022-02-21 23:32:50 +00:00
function get_ghostbsd() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2022-02-21 23:32:50 +00:00
local ISO=""
2022-02-23 10:36:07 +00:00
local URL="https://download.ghostbsd.org/releases/amd64/${RELEASE}"
2022-02-21 23:32:50 +00:00
local HASH=""
case ${EDITION} in
mate) ISO="GhostBSD-${RELEASE}.iso";;
xfce) ISO="GhostBSD-${RELEASE}-XFCE.iso";;
esac
2022-02-23 10:36:07 +00:00
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | grep "${ISO}" | cut -d' ' -f4)
echo "${URL}/${ISO} ${HASH}"
2022-02-21 23:32:50 +00:00
}
2022-02-21 16:29:42 +00:00
function get_haiku() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2022-02-23 10:37:17 +00:00
local ISO="haiku-${RELEASE}-${EDITION}-anyboot.iso"
2022-07-24 00:11:03 +00:00
# local URL="https://cdn.haiku-os.org/haiku-release/${RELEASE}" # domain gone
local URL="http://mirror.rit.edu/haiku/${RELEASE}" # NY, USA
# local URL="https://mirrors.tnonline.net/haiku/haiku-release/${RELEASE}" # Sweden
# local URL="https://mirror.aarnet.edu.au/pub/haiku/${RELEASE}" # Aus
2022-02-21 16:29:42 +00:00
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | grep "${ISO}" | cut -d' ' -f4)
2022-02-23 10:37:17 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-02-21 16:29:42 +00:00
}
2021-10-25 10:32:22 +00:00
function get_kali() {
local HASH=""
local ISO=""
2022-02-23 10:39:45 +00:00
local URL="https://cdimage.kali.org/${RELEASE}"
2021-10-25 10:32:22 +00:00
2022-02-21 01:55:51 +00:00
ISO=$(wget -q -O- "${URL}/?C=M;O=D" | grep -o ">kali-linux-.*-installer-amd64.iso" | head -n 1 | cut -c 2-)
HASH=$(wget -q -O- "${URL}/SHA256SUMS" | grep -v torrent | grep "${ISO}" | cut -d' ' -f1)
2022-02-23 10:39:45 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-10-25 10:32:22 +00:00
}
2021-11-07 23:39:20 +00:00
function get_kdeneon() {
2022-02-21 05:01:35 +00:00
local HASH=""
2022-02-21 15:08:09 +00:00
local ISO=""
2022-02-23 10:40:31 +00:00
local URL="https://files.kde.org/neon/images/${RELEASE}/current"
2021-11-07 23:39:20 +00:00
2022-02-21 05:01:35 +00:00
ISO=$(wget -q -O- "${URL}/neon-${RELEASE}-current.sha256sum" | cut -d' ' -f3-)
HASH=$(wget -q -O- "${URL}/neon-${RELEASE}-current.sha256sum" | cut -d' ' -f1)
2022-02-23 10:40:31 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-11-07 23:39:20 +00:00
}
2021-12-21 21:13:47 +00:00
function get_kolibrios() {
local HASH=""
2022-02-21 01:56:23 +00:00
local ISO="kolibri.iso"
local URL="https://builds.kolibrios.org/eng"
2022-02-23 10:41:03 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-12-21 21:13:47 +00:00
}
2021-10-16 19:58:53 +00:00
function get_linuxmint() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-10-20 23:54:45 +00:00
local HASH=""
2022-02-23 10:41:59 +00:00
local ISO="linuxmint-${RELEASE}-${EDITION}-64bit.iso"
local URL="https://mirror.bytemark.co.uk/linuxmint/stable/${RELEASE}"
2021-10-16 19:58:53 +00:00
2022-02-23 10:41:59 +00:00
HASH=$(wget -q -O- "${URL}/sha256sum.txt" | grep "${ISO}" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
2021-10-16 19:58:53 +00:00
}
2021-12-29 12:36:58 +00:00
2022-07-24 00:17:23 +00:00
function get_lmde() {
local EDITION="${1:-}"
local HASH=""
local ISO="lmde-${RELEASE}-${EDITION}-64bit.iso"
local URL="https://mirror.bytemark.co.uk/linuxmint/debian"
HASH=$(wget -q -O- "${URL}/sha256sum.txt" | grep "${ISO}" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
}
2022-02-21 16:29:42 +00:00
function get_macos() {
local BOARD_ID=""
local CWD=""
local MACRECOVERY=""
2022-08-19 16:39:13 +00:00
local MLB="00000000000000000"
2022-08-19 16:20:06 +00:00
local OS_TYPE="default"
2022-02-21 16:29:42 +00:00
case ${RELEASE} in
2022-09-20 10:34:02 +00:00
lion) #10.7
BOARD_ID="Mac-2E6FAB96566FE58C"
MLB="00000000000F25Y00";;
mountainlion) #10.8
BOARD_ID="Mac-7DF2A3B5E5D671ED"
MLB="00000000000F65100";;
mavericks) #10.9
BOARD_ID="Mac-F60DEB81FF30ACF6"
MLB="00000000000FNN100";;
yosemite) #10.10
BOARD_ID="Mac-E43C1C25D4880AD6"
MLB="00000000000GDVW00";;
elcapitan) #10.11
BOARD_ID="Mac-FFE5EF870D7BA81A"
MLB="00000000000GQRX00";;
sierra) #10.12
BOARD_ID="Mac-77F17D7DA9285301"
MLB="00000000000J0DX00";;
high-sierra) #10.13
BOARD_ID="Mac-BE088AF8C5EB4FA2"
2022-02-21 16:29:42 +00:00
MLB="00000000000J80300";;
2022-09-20 10:34:02 +00:00
mojave) #10.14
2022-02-21 16:29:42 +00:00
BOARD_ID="Mac-7BA5B2DFE22DDD8C"
MLB="00000000000KXPG00";;
2022-09-20 10:34:02 +00:00
catalina) #10.15
BOARD_ID="Mac-00BE6ED71E35EB86";;
big-sur) #11
BOARD_ID="Mac-42FD25EABCABB274";;
monterey) #12
BOARD_ID="Mac-E43C1C25D4880AD6";;
ventura) #13
echo "ERROR! Not yet supported: ${RELEASE}"
exit 1;;
2022-02-21 16:29:42 +00:00
*) echo "ERROR! Unknown release: ${RELEASE}"
releases_macos
exit 1;;
esac
# Use a bundled macrecovery if possible
CWD="$(dirname "${0}")"
if [ -x "${CWD}/macrecovery" ]; then
MACRECOVERY="${CWD}/macrecovery"
elif [ -x /usr/bin/macrecovery ]; then
MACRECOVERY="/usr/bin/macrecovery"
else
web_get "https://raw.githubusercontent.com/wimpysworld/quickemu/master/macrecovery" "${HOME}/.quickemu"
MACRECOVERY="python3 ${HOME}/.quickemu/macrecovery"
fi
if [ -z "${MACRECOVERY}" ]; then
echo "ERROR! Can not find a usable macrecovery."
exit 1
fi
# Get firmware
web_get "https://github.com/kholia/OSX-KVM/raw/master/OpenCore/OpenCore.qcow2" "${VM_PATH}"
web_get "https://github.com/kholia/OSX-KVM/raw/master/OVMF_CODE.fd" "${VM_PATH}"
if [ ! -e "${VM_PATH}/OVMF_VARS-1024x768.fd" ]; then
web_get "https://github.com/kholia/OSX-KVM/raw/master/OVMF_VARS-1024x768.fd" "${VM_PATH}"
fi
if [ ! -e "${VM_PATH}/RecoveryImage.chunklist" ]; then
echo "Downloading ${RELEASE}..."
${MACRECOVERY} \
--board-id "${BOARD_ID}" \
--mlb "${MLB}" \
2022-08-19 16:20:06 +00:00
--os-type "${OS_TYPE}" \
2022-02-21 16:29:42 +00:00
--basename RecoveryImage \
--outdir "${VM_PATH}" \
download
fi
if [ -e "${VM_PATH}/RecoveryImage.dmg" ] && [ ! -e "${VM_PATH}/RecoveryImage.img" ]; then
echo "Converting RecoveryImage..."
2022-09-19 12:25:09 +00:00
qemu-img convert "${VM_PATH}/RecoveryImage.dmg" -O raw "${VM_PATH}/RecoveryImage.img" 2>/dev/null
2022-02-21 16:29:42 +00:00
fi
make_vm_config RecoveryImage.img
}
2021-12-29 12:36:58 +00:00
function get_manjaro() {
local HASH=""
local ISO=""
2022-02-21 15:08:09 +00:00
local MANIFESTURL=""
2021-12-29 12:36:58 +00:00
local URL=""
2022-01-17 02:13:53 +00:00
2022-02-21 04:23:29 +00:00
case ${RELEASE} in
2022-02-23 10:42:57 +00:00
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";;
2021-12-29 12:36:58 +00:00
esac
2022-01-17 02:13:53 +00:00
2022-02-23 10:42:57 +00:00
URL="$(wget -qO- "${MANIFESTURL}" | grep "Download_x64 =" | cut -d'"' -f2)"
HASH=$(wget -qO- "${MANIFESTURL}" | grep "Download_x64_Checksum =" | cut -d'"' -f2)
echo "${URL} ${HASH}"
2021-12-29 12:36:58 +00:00
}
2021-12-27 07:06:28 +00:00
function get_mxlinux() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-12-27 07:06:28 +00:00
local HASH=""
local ISO=""
2022-02-23 10:48:25 +00:00
local URL="https://sourceforge.net/projects/mx-linux/files/Final/${EDITION}"
2021-12-27 07:06:28 +00:00
2022-02-21 09:19:07 +00:00
case ${EDITION} in
2022-02-23 10:48:25 +00:00
Xfce) ISO="MX-${RELEASE}_x64.iso";;
KDE) ISO="MX-${RELEASE}_KDE_x64.iso";;
Fluxbox) ISO="MX-${RELEASE}_fluxbox_x64.iso";;
2022-02-21 01:59:35 +00:00
esac
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1)
2022-02-23 10:48:25 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-12-27 07:06:28 +00:00
}
2022-02-21 16:41:26 +00:00
function get_netboot() {
local ISO="netboot.xyz.iso"
local HASH=""
local URL="https://boot.netboot.xyz/ipxe"
HASH=$(wget -q -O- "${URL}/netboot.xyz-sha256-checksums.txt" | grep "${ISO}" | cut -d' ' -f1)
2022-02-23 10:49:11 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-02-21 16:41:26 +00:00
}
2022-02-22 00:51:34 +00:00
function get_netbsd() {
local HASH=""
2022-02-23 10:51:01 +00:00
local ISO="NetBSD-${RELEASE}-amd64.iso"
local URL="https://cdn.netbsd.org/pub/NetBSD/NetBSD-${RELEASE}/images/"
2022-02-22 00:51:34 +00:00
HASH=$(wget -q -O- "${URL}/MD5" | grep "${ISO}" | cut -d' ' -f4)
2022-02-23 10:51:01 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-02-22 00:51:34 +00:00
}
2021-10-24 21:20:46 +00:00
function get_nixos() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-10-24 21:20:46 +00:00
local HASH=""
2022-02-23 10:52:45 +00:00
local ISO="latest-nixos-${EDITION}-x86_64-linux.iso"
local URL="https://channels.nixos.org/nixos-${RELEASE}"
2022-02-21 02:00:17 +00:00
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1)
2022-02-23 10:52:45 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-10-24 21:20:46 +00:00
}
2022-02-21 01:40:23 +00:00
2021-10-20 21:07:07 +00:00
function get_openbsd() {
2021-10-20 22:22:35 +00:00
local HASH=""
2022-02-23 10:53:17 +00:00
local ISO="install${RELEASE//\./}.iso"
local URL="https://cdn.openbsd.org/pub/OpenBSD/${RELEASE}/amd64"
2022-02-21 02:00:45 +00:00
HASH=$(wget -q -O- "${URL}/SHA256" | grep "${ISO}" | cut -d' ' -f4)
2022-02-23 10:53:17 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-10-20 21:07:07 +00:00
}
2021-10-16 18:27:45 +00:00
function get_opensuse() {
2021-10-20 23:56:25 +00:00
local HASH=""
2021-10-19 14:00:07 +00:00
local ISO=""
2021-10-16 18:27:45 +00:00
local URL=""
2021-10-19 14:00:07 +00:00
if [ "${RELEASE}" == "tumbleweed" ]; then
2021-10-16 18:27:45 +00:00
ISO="openSUSE-Tumbleweed-DVD-x86_64-Current.iso"
2022-02-23 10:54:49 +00:00
URL="https://download.opensuse.org/tumbleweed/iso"
2021-10-19 14:00:07 +00:00
elif [ "${RELEASE}" == "microos" ]; then
2021-10-18 11:30:06 +00:00
ISO="openSUSE-MicroOS-DVD-x86_64-Current.iso"
2022-02-23 10:54:49 +00:00
URL="https://download.opensuse.org/tumbleweed/iso"
2021-12-13 16:31:37 +00:00
elif [ "$RELEASE" == 15.0 ] || [ "$RELEASE" == 15.1 ]; then
2021-10-19 14:00:07 +00:00
ISO="openSUSE-Leap-${RELEASE}-DVD-x86_64.iso"
2022-02-23 10:54:49 +00:00
URL="https://download.opensuse.org/distribution/leap/${RELEASE}/iso"
2021-12-13 16:31:37 +00:00
else
ISO="openSUSE-Leap-${RELEASE}-DVD-x86_64-Current.iso"
2022-02-23 10:54:49 +00:00
URL="https://download.opensuse.org/distribution/leap/${RELEASE}/iso"
2021-10-16 18:27:45 +00:00
fi
2022-03-01 11:11:36 +00:00
HASH=$(wget -q -O- "${URL}/${ISO}.sha256" |awk '{if(NR==4) print $0}'|cut -d' ' -f1)
2022-02-23 10:54:49 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-10-16 18:27:45 +00:00
}
2021-11-16 18:13:22 +00:00
function get_oraclelinux() {
local HASH=""
local ISO=""
2022-02-23 10:55:29 +00:00
local VER_MAJ=${RELEASE::1}
local VER_MIN=${RELEASE:2:1}
local URL="https://yum.oracle.com/ISOS/OracleLinux/OL${VER_MAJ}/u${VER_MIN}/x86_64/"
case ${VER_MAJ} in
2022-08-01 08:14:53 +00:00
7) ISO="OracleLinux-R${VER_MAJ}-U${VER_MIN}-Server-x86_64-dvd.iso";;
*) ISO="OracleLinux-R${VER_MAJ}-U${VER_MIN}-x86_64-dvd.iso";;
2022-02-23 10:55:29 +00:00
esac
2022-02-21 02:03:21 +00:00
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)
2022-02-23 10:55:29 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-11-16 18:13:22 +00:00
}
2021-10-19 11:04:00 +00:00
function get_popos() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-10-19 19:36:05 +00:00
local HASH=""
2021-10-19 13:49:47 +00:00
local ISO=""
2021-10-19 11:04:00 +00:00
local URL=""
2022-02-22 15:29:46 +00:00
URL=$(wget -q -O- "https://api.pop-os.org/builds/${RELEASE}/${EDITION}" | jq -r .url)
HASH=$(wget -q -O- "https://api.pop-os.org/builds/${RELEASE}/${EDITION}" | jq -r .sha_sum)
2022-02-23 10:56:59 +00:00
echo "${URL} ${HASH}"
2021-10-19 11:04:00 +00:00
}
2022-08-18 08:44:09 +00:00
function get_reactos() {
local HASH=""
local URL=""
local TMPURL=""
2022-09-19 10:26:00 +00:00
TMPURL=$(wget -q -S -O- --max-redirect=0 "https://sourceforge.net/projects/reactos/files/latest/download" 2>&1 | grep -i Location | cut -d' ' -f4)
2022-08-18 08:44:09 +00:00
URL=${TMPURL%\?*}
echo "${URL} ${HASH}"
}
2022-02-21 16:29:42 +00:00
function get_rockylinux() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2022-02-21 16:29:42 +00:00
local HASH=""
2022-02-23 11:00:29 +00:00
local ISO="Rocky-${RELEASE}-x86_64-${EDITION}.iso"
2022-02-21 16:29:42 +00:00
local URL=""
2022-02-23 11:00:29 +00:00
case ${RELEASE} in
2022-07-24 00:21:41 +00:00
9.0) URL="https://download.rockylinux.org/pub/rocky/${RELEASE}/isos/x86_64";;
2022-02-23 11:00:29 +00:00
*) URL="http://dl.rockylinux.org/vault/rocky/${RELEASE}/isos/x86_64/";;
esac
2022-03-01 11:11:36 +00:00
HASH=$(wget -q -O- "${URL}/CHECKSUM" | grep "SHA256" | grep "${ISO})" | cut -d' ' -f4)
2022-02-23 11:00:29 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-02-21 16:29:42 +00:00
}
function get_slackware() {
local HASH=""
2022-02-23 11:01:39 +00:00
local ISO="slackware64-${RELEASE}-install-dvd.iso"
local URL="https://slackware.nl/slackware/slackware-iso/slackware64-${RELEASE}-iso"
2022-02-21 16:29:42 +00:00
HASH=$(wget -q -O- "${URL}/${ISO}.md5" | cut -d' ' -f1)
2022-02-23 11:01:39 +00:00
echo "${URL}/${ISO} ${HASH}"
2022-02-21 16:29:42 +00:00
}
function get_solus() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2022-02-21 16:29:42 +00:00
local HASH=""
2022-02-23 11:03:45 +00:00
local ISO="Solus-${RELEASE}-${EDITION}.iso"
local URL="https://mirrors.rit.edu/solus/images/${RELEASE}"
2022-02-21 16:29:42 +00:00
2022-02-23 11:03:45 +00:00
HASH=$(wget -q -O- "${URL}/${ISO}.sha256sum" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
2022-02-21 16:29:42 +00:00
}
2022-01-05 16:50:09 +00:00
function get_tails() {
2022-02-21 02:04:23 +00:00
local ISO=""
2022-02-23 11:05:55 +00:00
local JSON=""
2022-02-21 02:04:23 +00:00
local HASH=""
local URL=""
2022-02-23 11:05:55 +00:00
JSON="$(wget -q -O- "https://tails.boum.org/install/v2/Tails/amd64/${RELEASE}/latest.json")"
URL=$(echo "${JSON}" | jq -r '.installations[0]."installation-paths"[]|select(.type=="iso")|."target-files"[0].url')
HASH=$(echo "${JSON}" | jq -r '.installations[0]."installation-paths"[]|select(.type=="iso")|."target-files"[0].sha256')
echo "${URL} ${HASH}"
2022-01-05 16:50:09 +00:00
}
2021-11-08 00:10:02 +00:00
2021-09-27 23:09:46 +00:00
function get_ubuntu() {
local ISO=""
2021-10-19 16:20:05 +00:00
local HASH=""
2021-09-27 23:09:46 +00:00
local URL=""
2022-02-23 03:31:04 +00:00
if [[ "${RELEASE}" == *"daily"* ]] && [ "${OS}" == "ubuntustudio" ]; then
# Ubuntu Studio daily-live images are in the dvd directory
RELEASE="dvd"
elif [ "${RELEASE}" == "daily-canary" ] && [ "${OS}" != "ubuntu" ]; then
# daily-canary is only available for Ubuntu, switch flavours to daily-live
RELEASE="daily-live"
2021-10-27 15:25:53 +00:00
fi
2021-10-21 17:46:02 +00:00
2022-02-24 22:28:29 +00:00
if [[ "${RELEASE}" == "eol-"* ]]; then
URL="https://old-releases.ubuntu.com/releases/${RELEASE/eol-/}"
2022-08-11 01:27:54 +00:00
elif [[ "${RELEASE}" == "jammy-daily" ]]; then
URL="https://cdimage.ubuntu.com/${OS}/jammy/daily-live/current"
VM_PATH="${OS}-jammy-live"
2022-02-24 22:28:29 +00:00
elif [[ "${RELEASE}" == *"daily"* ]] || [ "${RELEASE}" == "dvd" ]; then
URL="https://cdimage.ubuntu.com/${OS}/${RELEASE}/current"
2022-03-11 16:15:44 +00:00
VM_PATH="${OS}-daily-live"
2022-02-23 03:31:04 +00:00
elif [ "${OS}" == "ubuntu" ]; then
2022-02-24 22:28:29 +00:00
URL="https://releases.ubuntu.com/${RELEASE}"
2021-09-27 23:09:46 +00:00
else
2022-02-24 22:28:29 +00:00
URL="https://cdimage.ubuntu.com/${OS}/releases/${RELEASE}/release"
2021-09-27 23:09:46 +00:00
fi
2022-02-24 22:28:29 +00:00
if wget -q --spider "${URL}/SHA256SUMS"; then
2022-07-24 00:03:37 +00:00
ISO=$(wget -q -O- "${URL}/SHA256SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso | cut -d'*' -f2)
HASH=$(wget -q -O- "${URL}/SHA256SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso |cut -d' ' -f1)
2022-02-24 22:28:29 +00:00
else
2022-07-24 00:03:37 +00:00
ISO=$(wget -q -O- "${URL}/MD5SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso | cut -d' ' -f3)
HASH=$(wget -q -O- "${URL}/MD5SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso | cut -d' ' -f1)
2022-02-24 22:28:29 +00:00
fi
2022-02-23 03:31:04 +00:00
#echo "${URL}/${ISO} ${HASH}"
if [[ "${RELEASE}" == *"daily"* ]] || [ "${RELEASE}" == "dvd" ]; then
zsync_get "${URL}/${ISO}" "${VM_PATH}" "${OS}-devel.iso"
make_vm_config "${OS}-devel.iso"
2021-09-27 23:09:46 +00:00
else
web_get "${URL}/${ISO}" "${VM_PATH}"
2021-10-19 19:34:03 +00:00
check_hash "${ISO}" "${HASH}"
2021-09-28 01:13:08 +00:00
make_vm_config "${ISO}"
2021-09-27 23:09:46 +00:00
fi
}
2022-01-16 03:38:45 +00:00
2022-02-21 16:29:42 +00:00
function get_void() {
2022-02-21 02:05:09 +00:00
local DATE=""
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2021-11-08 00:32:57 +00:00
local HASH=""
local ISO=""
2022-02-21 16:29:42 +00:00
local URL="https://alpha.de.repo.voidlinux.org/live/current"
2021-11-08 00:32:57 +00:00
2022-02-21 16:29:42 +00:00
DATE=$(wget -q -O- "${URL}/sha256sum.txt" | head -n1 | cut -d'.' -f1 | cut -d'-' -f4)
case ${EDITION} in
2022-02-23 03:37:28 +00:00
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";;
2021-11-08 00:32:57 +00:00
esac
2022-02-21 16:29:42 +00:00
HASH="$(wget -q -O- "${URL}/sha256sum.txt" | grep "${ISO}" | cut -d' ' -f4)"
2022-02-23 11:06:33 +00:00
echo "${URL}/${ISO} ${HASH}"
2021-11-08 00:32:57 +00:00
}
2021-09-27 23:09:46 +00:00
2022-02-21 16:29:42 +00:00
function get_zorin() {
2022-02-22 15:15:56 +00:00
local EDITION="${1:-}"
2022-02-23 11:06:51 +00:00
local HASH=""
2021-12-26 15:05:38 +00:00
local ISO=""
local URL=""
2022-02-21 16:29:42 +00:00
# Parse out the iso URL from the redirector
2022-02-21 17:48:32 +00:00
URL=$(wget -q -S -O- --max-redirect=0 "https://zrn.co/${RELEASE}${EDITION}" 2>&1 | grep Location | cut -d' ' -f4)
2022-02-23 11:06:51 +00:00
echo "${URL} ${HASH}"
2021-12-26 15:05:38 +00:00
}
2021-12-06 15:20:48 +00:00
function unattended_windows() {
cat << 'EOF' > "${1}"
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
For documentation on components:
2021-12-06 17:23:12 +00:00
https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/
2021-12-06 15:20:48 +00:00
-->
2021-12-06 17:26:54 +00:00
<settings pass="offlineServicing">
2022-08-01 10:04:22 +00:00
<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EnableLUA>false</EnableLUA>
</component>
2022-08-01 09:16:51 +00:00
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2021-12-06 17:26:54 +00:00
<ComputerName>*</ComputerName>
</component>
</settings>
2021-12-06 15:20:48 +00:00
<settings pass="generalize">
2022-08-01 09:16:51 +00:00
<component name="Microsoft-Windows-PnPSysprep" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
2021-12-06 15:20:48 +00:00
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
</component>
2022-08-01 10:04:22 +00:00
<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipRearm>1</SkipRearm>
</component>
2021-12-06 15:20:48 +00:00
</settings>
<settings pass="specialize">
2022-08-01 09:16:51 +00:00
<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2022-02-20 09:37:09 +00:00
<SkipAutoActivation>true</SkipAutoActivation>
2021-12-06 15:20:48 +00:00
</component>
2022-08-01 09:16:51 +00:00
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2021-12-06 17:25:54 +00:00
<ComputerName>*</ComputerName>
<OEMInformation>
<Manufacturer>Quickemu Project</Manufacturer>
<Model>Quickemu</Model>
<SupportHours>24/7</SupportHours>
<SupportPhone></SupportPhone>
<SupportProvider>Quickemu Project</SupportProvider>
<SupportURL>https://github.com/quickemu-project/quickemu/issues</SupportURL>
</OEMInformation>
<OEMName>Quickemu Project</OEMName>
2022-08-01 10:04:22 +00:00
<ProductKey>W269N-WFGWX-YVC9B-4J6C9-T83GX</ProductKey>
2021-12-06 17:25:54 +00:00
</component>
2022-08-01 09:16:51 +00:00
<component name="Microsoft-Windows-SQMApi" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2021-12-06 15:20:48 +00:00
<CEIPEnabled>0</CEIPEnabled>
</component>
</settings>
<settings pass="windowsPE">
2022-08-01 09:16:51 +00:00
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2021-12-06 17:33:08 +00:00
<Diagnostics>
<OptIn>false</OptIn>
</Diagnostics>
2021-12-06 15:20:48 +00:00
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<!-- Windows RE Tools partition -->
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>256</Size>
</CreatePartition>
<!-- System partition (ESP) -->
<CreatePartition wcm:action="add">
<Order>2</Order>
<Type>EFI</Type>
<Size>128</Size>
</CreatePartition>
<!-- Microsoft reserved partition (MSR) -->
<CreatePartition wcm:action="add">
<Order>3</Order>
<Type>MSR</Type>
<Size>128</Size>
</CreatePartition>
<!-- Windows partition -->
<CreatePartition wcm:action="add">
<Order>4</Order>
<Type>Primary</Type>
<Extend>true</Extend>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<!-- Windows RE Tools partition -->
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>WINRE</Label>
<Format>NTFS</Format>
<TypeID>DE94BBA4-06D1-4D40-A16A-BFD50179D6AC</TypeID>
</ModifyPartition>
<!-- System partition (ESP) -->
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>2</PartitionID>
<Label>System</Label>
<Format>FAT32</Format>
</ModifyPartition>
<!-- MSR partition does not need to be modified -->
<ModifyPartition wcm:action="add">
<Order>3</Order>
<PartitionID>3</PartitionID>
</ModifyPartition>
<!-- Windows partition -->
<ModifyPartition wcm:action="add">
<Order>4</Order>
<PartitionID>4</PartitionID>
<Label>Windows</Label>
<Letter>C</Letter>
<Format>NTFS</Format>
</ModifyPartition>
</ModifyPartitions>
</Disk>
</DiskConfiguration>
2021-12-06 17:33:08 +00:00
<DynamicUpdate>
<Enable>true</Enable>
<WillShowUI>Never</WillShowUI>
</DynamicUpdate>
2021-12-06 15:20:48 +00:00
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>4</PartitionID>
</InstallTo>
<InstallToAvailablePartition>false</InstallToAvailablePartition>
</OSImage>
</ImageInstall>
2021-12-07 10:11:03 +00:00
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>reg add HKLM\System\Setup\LabConfig /v BypassCPUCheck /t REG_DWORD /d 0x00000001 /f</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>reg add HKLM\System\Setup\LabConfig /v BypassRAMCheck /t REG_DWORD /d 0x00000001 /f</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>3</Order>
<Path>reg add HKLM\System\Setup\LabConfig /v BypassSecureBootCheck /t REG_DWORD /d 0x00000001 /f</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>4</Order>
<Path>reg add HKLM\System\Setup\LabConfig /v BypassTPMCheck /t REG_DWORD /d 0x00000001 /f</Path>
</RunSynchronousCommand>
</RunSynchronous>
2021-12-06 17:27:50 +00:00
<UpgradeData>
<Upgrade>false</Upgrade>
<WillShowUI>Never</WillShowUI>
</UpgradeData>
2021-12-06 15:20:48 +00:00
<UserData>
<AcceptEula>true</AcceptEula>
2022-08-01 10:04:22 +00:00
<FullName>Quickemu</FullName>
<Organization>Quickemu Project</Organization>
<!-- https://docs.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys -->
2021-12-06 15:20:48 +00:00
<ProductKey>
2022-08-01 10:04:22 +00:00
<Key>W269N-WFGWX-YVC9B-4J6C9-T83GX</Key>
2021-12-06 15:20:48 +00:00
<WillShowUI>Never</WillShowUI>
</ProductKey>
</UserData>
</component>
2022-08-01 09:16:51 +00:00
<component name="Microsoft-Windows-PnpCustomizationsWinPE" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="amd64" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2021-12-06 15:20:48 +00:00
<!--
This makes the VirtIO drivers available to Windows, assuming that
2022-02-20 09:38:03 +00:00
the VirtIO driver disk is available as drive E:
https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md
2021-12-06 15:20:48 +00:00
-->
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="1">
<Path>E:\qemufwcfg\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
<Path>E:\vioinput\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="3">
<Path>E:\vioscsi\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="4">
<Path>E:\viostor\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="5">
<Path>E:\vioserial\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="6">
<Path>E:\qxldod\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="7">
<Path>E:\amd64\w10</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="8">
<Path>E:\viogpudo\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="9">
<Path>E:\viorng\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="10">
<Path>E:\NetKVM\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="11">
<Path>E:\viofs\w10\amd64</Path>
</PathAndCredentials>
<PathAndCredentials wcm:action="add" wcm:keyValue="12">
<Path>E:\Balloon\w10\amd64</Path>
</PathAndCredentials>
</DriverPaths>
</component>
</settings>
<settings pass="oobeSystem">
2022-08-01 09:16:51 +00:00
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2022-08-01 10:04:22 +00:00
<AutoLogon>
<Password>
<Value>quickemu</Value>
<PlainText>true</PlainText>
</Password>
<Enabled>true</Enabled>
<Username>Quickemu</Username>
</AutoLogon>
<DisableAutoDaylightTimeSet>false</DisableAutoDaylightTimeSet>
2021-12-06 15:20:48 +00:00
<OOBE>
<HideEULAPage>true</HideEULAPage>
2022-08-01 10:04:22 +00:00
<HideLocalAccountScreen>true</HideLocalAccountScreen>
2021-12-06 15:20:48 +00:00
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
2022-08-01 10:04:22 +00:00
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
2021-12-06 15:20:48 +00:00
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
2022-08-01 10:04:22 +00:00
<NetworkLocation>Home</NetworkLocation>
2021-12-06 15:20:48 +00:00
<ProtectYourPC>3</ProtectYourPC>
2022-08-01 10:04:22 +00:00
<SkipUserOOBE>true</SkipUserOOBE>
<SkipMachineOOBE>true</SkipMachineOOBE>
2021-12-06 15:20:48 +00:00
<VMModeOptimizations>
<SkipWinREInitialization>true</SkipWinREInitialization>
</VMModeOptimizations>
</OOBE>
2022-08-01 10:04:22 +00:00
<UserAccounts>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>quickemu</Value>
<PlainText>true</PlainText>
</Password>
<Description>Quickemu</Description>
<DisplayName>Quickemu</DisplayName>
<Group>Administrators</Group>
<Name>Quickemu</Name>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<RegisteredOrganization>Quickemu Project</RegisteredOrganization>
<RegisteredOwner>Quickemu</RegisteredOwner>
2021-12-06 15:20:48 +00:00
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>msiexec /i E:\guest-agent\qemu-ga-x86_64.msi /quiet /passive /qn</CommandLine>
<Description>Install Virtio Guest Agent</Description>
<Order>1</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>msiexec /i F:\spice-webdavd-x64-latest.msi /quiet /passive /qn</CommandLine>
<Description>Install spice-webdavd file sharing agent</Description>
<Order>2</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>msiexec /i F:\UsbDk_1.0.22_x64.msi /quiet /passive /qn</CommandLine>
<Description>Install usbdk USB sharing agent</Description>
<Order>3</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>msiexec /i F:\spice-vdagent-x64-0.10.0.msi /quiet /passive /qn</CommandLine>
<Description>Install spice-vdagent SPICE agent</Description>
<Order>4</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>Cmd /c POWERCFG -H OFF</CommandLine>
<Description>Disable Hibernation</Description>
<Order>5</Order>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>
</unattend>
EOF
}
2021-12-06 10:55:54 +00:00
function dbg_windows() {
local DEBUG=0
if [ ${DEBUG} -eq 1 ]; then
echo "${1}"
fi
}
2021-09-28 04:03:16 +00:00
# Adapted from https://gist.github.com/hongkongkiwi/15a5bf16437315df256c118c163607cb
function get_windows() {
local ARCH="x64"
2021-10-29 08:50:23 +00:00
local INDEX=0
2021-09-28 04:03:16 +00:00
local LANG_CODE="en"
2022-02-22 18:42:12 +00:00
local LANG_EDITION="${1}"
2021-09-28 04:03:16 +00:00
local LATEST_WINDOWS_VERSION=""
local WINDOWS_NAME=""
local VERSION_ID=""
local EDITION_ID=""
local LANGUAGE_ID=""
local FILE_NAME=""
local ARCH_ID=""
local DOWNLOAD_INFO=""
local DOWNLOAD_ID=""
local DOWNLOAD_URL=""
2021-10-19 14:14:03 +00:00
2022-02-22 02:03:42 +00:00
# Ignore the most recent Windows 10 release for now.
case ${RELEASE} in
10) INDEX=0;;
11) INDEX=0;;
esac
2021-11-17 17:02:20 +00:00
2021-09-28 04:03:16 +00:00
echo "Getting Windows ${RELEASE} URL..."
2022-09-19 10:01:43 +00:00
WINDOWS_VERSIONS=$(wget -4 -q -O- "https://tb.rg-adguard.net/php/get_version.php?type_id=1" | jq '.versions | sort_by(-(.version_id | tonumber))')
2021-12-06 10:55:54 +00:00
dbg_windows "${WINDOWS_VERSIONS}"
2022-02-22 02:03:42 +00:00
LATEST_WINDOWS_VERSION=$(echo "${WINDOWS_VERSIONS}" | jq -c 'map(select(.name | contains("Windows '"${RELEASE}"'")))['${INDEX}']')
2021-12-06 10:55:54 +00:00
dbg_windows "${LATEST_WINDOWS_VERSION}"
2021-09-28 04:03:16 +00:00
WINDOWS_NAME=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .name)
2021-12-06 10:55:54 +00:00
dbg_windows "${WINDOWS_NAME}"
2021-09-28 04:03:16 +00:00
VERSION_ID=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .version_id)
2021-12-06 10:55:54 +00:00
dbg_windows "${VERSION_ID}"
2021-10-05 19:08:13 +00:00
case ${RELEASE} in
2022-09-19 10:01:43 +00:00
8) EDITION_ID=$(wget -4 -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 -4 -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');;
2021-10-05 19:08:13 +00:00
esac
2021-12-06 10:55:54 +00:00
dbg_windows "${EDITION_ID}"
2021-10-05 19:08:13 +00:00
2022-09-19 10:01:43 +00:00
LANGUAGE_ID=$(wget -4 -q -O- "https://tb.rg-adguard.net/php/get_language.php?edition_id=${EDITION_ID}&lang=name_${LANG_CODE}" | jq -r '.languages[] | select(.name_'${LANG_CODE}'=="'"${LANG_EDITION}"'").language_id')
2021-12-06 10:55:54 +00:00
dbg_windows "${LANGUAGE_ID}"
2022-09-19 10:01:43 +00:00
ARCH_INFO=$(wget -4 -q -O- "https://tb.rg-adguard.net/php/get_arch.php?language_id=${LANGUAGE_ID}")
2021-12-06 10:55:54 +00:00
dbg_windows "${ARCH_INFO}"
2021-09-28 04:03:16 +00:00
FILE_NAME=$(echo "${ARCH_INFO}" | jq -r '.archs[] | select(.name | contains("'${ARCH}'")).name')
2021-12-06 10:55:54 +00:00
dbg_windows "${FILE_NAME}"
2021-09-28 04:03:16 +00:00
ARCH_ID=$(echo "${ARCH_INFO}" | jq -r '.archs[] | select(.name | contains("'${ARCH}'")).arch_id')
2021-12-06 10:55:54 +00:00
dbg_windows "${ARCH_ID}"
2022-09-19 10:01:43 +00:00
DOWNLOAD_INFO=$(wget -4 -q -O- "https://tb.rg-adguard.net/dl.php?fileName=${ARCH_ID}&lang=en")
2021-12-06 10:55:54 +00:00
dbg_windows "${DOWNLOAD_INFO}"
2021-10-09 15:26:45 +00:00
DOWNLOAD_SHA1=$(echo "${DOWNLOAD_INFO}" | sed -e 's/<[^>]*>//g' | grep -o -P '(?<=SHA1: ).*(?= expire)' | sed 's/Link//')
2021-12-06 10:55:54 +00:00
dbg_windows "${DOWNLOAD_SHA1}"
2021-09-28 04:03:16 +00:00
DOWNLOAD_ID=$(echo "${DOWNLOAD_INFO}" | grep -oP '(?<=https:\/\/tb\.rg-adguard\.net/dl\.php\?go=)[0-9a-z]+')
2021-12-06 10:55:54 +00:00
dbg_windows "${DOWNLOAD_ID}"
2022-07-24 00:09:19 +00:00
REDIRECT_URL="https://tb.rg-adguard.net/dl.php?go=${DOWNLOAD_ID}"
dbg_windows "${REDIRECT_URL}"
DOWNLOAD_URL=$(curl --head --silent --write-out "%{redirect_url}\n" --output /dev/null "${REDIRECT_URL}")
2021-12-06 10:55:54 +00:00
dbg_windows "${DOWNLOAD_URL}"
2021-09-28 04:03:16 +00:00
2022-07-24 00:09:19 +00:00
MS_BASE_URL="https://software.download.prss.microsoft.com/"
if [[ ! ${DOWNLOAD_URL} =~ ^${MS_BASE_URL} ]]; then
echo "Download URL not leading to Microsoft CDN"
exit 1
fi
2021-09-28 04:03:16 +00:00
echo "Downloading ${WINDOWS_NAME}..."
web_get "${DOWNLOAD_URL}" "${VM_PATH}" "${FILE_NAME}"
2021-10-09 15:10:58 +00:00
2021-10-19 16:20:05 +00:00
# Windows 10 doesn't include a SHA1, so only check the integrity if the SHA1 is available.
2021-10-09 15:32:40 +00:00
if [ -n "${DOWNLOAD_SHA1}" ]; then
2021-10-19 19:34:03 +00:00
check_hash "${FILE_NAME}" "${DOWNLOAD_SHA1}"
2021-10-09 15:10:58 +00:00
fi
2021-09-28 04:03:16 +00:00
web_get "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" "${VM_PATH}"
2021-10-19 15:39:21 +00:00
rm -f "${VM_PATH}/unattended.iso"
case ${RELEASE} in
10|11)
echo "Making unattended.iso"
mkdir -p "${VM_PATH}/unattended" 2>/dev/null
web_get https://www.spice-space.org/download/windows/spice-webdavd/spice-webdavd-x64-latest.msi "${VM_PATH}/unattended"
web_get https://www.spice-space.org/download/windows/vdagent/vdagent-win-0.10.0/spice-vdagent-x64-0.10.0.msi "${VM_PATH}/unattended"
web_get https://www.spice-space.org/download/windows/usbdk/UsbDk_1.0.22_x64.msi "${VM_PATH}/unattended"
unattended_windows "${VM_PATH}/unattended/autounattend.xml"
mkisofs -quiet -l -o "${VM_PATH}/unattended.iso" "${VM_PATH}/unattended/"
;;
esac
2021-09-28 04:03:16 +00:00
make_vm_config "${FILE_NAME}" "virtio-win.iso"
}
2022-02-21 01:50:37 +00:00
2022-02-22 18:44:02 +00:00
create_vm() {
# shellcheck disable=SC2206
local URL_HASH=(${1// / })
local URL="${URL_HASH[0]}"
local HASH="${URL_HASH[1]}"
local ISO="${URL##*/}"
2022-02-24 22:31:23 +00:00
2022-02-22 18:44:02 +00:00
#echo "${URL}"
#echo "${ISO}"
#echo "${HASH}"
web_get "${URL}" "${VM_PATH}"
2022-02-24 22:31:23 +00:00
2022-02-22 18:44:02 +00:00
if [ -n "${HASH}" ]; then
check_hash "${ISO}" "${HASH}"
fi
2022-02-24 22:31:23 +00:00
if [ ${OS} == "freedos" ] && [[ $ISO =~ ".zip" ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso')
fi
2022-07-23 23:59:15 +00:00
if [[ ${OS} == "batocera" ]] && [[ ${ISO} =~ ".gz" ]]; then
gzip -d "${VM_PATH}/${ISO}"
ISO="${ISO/.gz/}"
fi
2022-02-24 22:31:23 +00:00
2022-08-18 08:44:09 +00:00
if [ ${OS} == "reactos" ] && [[ $ISO =~ ".zip" ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso' | grep -v '.zip')
fi
2022-02-22 18:44:02 +00:00
make_vm_config "${ISO}"
}
2021-10-28 21:41:35 +00:00
trap cleanup EXIT
2022-02-23 03:33:32 +00:00
if ((BASH_VERSINFO[0] < 4)); then
echo "Sorry, you need bash 4.0 or newer to run this script."
exit 1
2021-10-28 21:41:35 +00:00
fi
2021-10-19 10:41:57 +00:00
LANGS=()
languages_windows
2021-09-27 23:09:46 +00:00
if [ -n "${1}" ]; then
OS="${1,,}"
2022-02-21 01:50:37 +00:00
if [ "${OS}" == "list" ] || [ "${OS}" == "list_csv" ]; then
list_csv
elif [ "${OS}" == "list_json" ]; then
list_json
elif [ "${OS}" == "--version" ] || [ "${OS}" == "-version" ] || [ "${OS}" == "version" ]; then
2022-02-22 09:43:54 +00:00
WHERE=$(dirname "${BASH_SOURCE[0]}")
"${WHERE}/quickemu" --version
exit 0
2022-02-21 01:50:37 +00:00
fi
2021-09-27 23:09:46 +00:00
else
2022-02-21 17:34:30 +00:00
echo "ERROR! You must specify an operating system."
echo -n " - Operating Systems: "
2021-09-27 23:09:46 +00:00
os_support
exit 1
fi
2022-02-21 09:19:07 +00:00
if [[ ! $(os_support) =~ ${OS} ]]; then
2022-02-22 09:43:54 +00:00
echo -e "ERROR! ${OS} is not a supported OS.\n"
os_support
exit 1
2022-02-21 09:19:07 +00:00
fi
2021-09-27 23:09:46 +00:00
if [ -n "${2}" ]; then
RELEASE="${2,,}"
2021-10-19 13:56:45 +00:00
VM_PATH="${OS}-${RELEASE}"
2022-02-21 09:19:07 +00:00
# If the OS has an editions_() function, use it.
if [[ $(type -t "editions_${OS}") == function ]]; then
2022-02-21 14:57:11 +00:00
EDITIONS=($(editions_${OS}))
2022-02-21 09:19:07 +00:00
EDITION=${EDITIONS[0]}
2021-10-19 19:36:05 +00:00
if [ -n "${3}" ]; then
2022-02-21 09:19:07 +00:00
EDITION="${3}"
if [[ ! ${EDITIONS[*]} =~ ${EDITION} ]]; then
echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition:\n"
for EDITION in "${EDITIONS[@]}"; do
echo -n "${EDITION} "
2021-10-19 19:36:05 +00:00
done
exit 1
fi
fi
2022-02-21 17:33:36 +00:00
2022-07-24 00:11:46 +00:00
# Handle odd missing fedora cominations
if [[ $OS == fedora ]] ; then
if [[ ${RELEASE} = "33" && ${EDITION} = "i3" ]] || [[ ${RELEASE} = "34" && ${EDITION} = "Cinnamon" ]] ; then
echo "ERROR! Unsupported combination"
echo " Fedora 33 i3 and Fedora 34 Cinnamon are not available, please choose another Release or Edition"
exit 1;
fi
fi
2022-02-21 17:33:36 +00:00
2022-02-21 09:19:07 +00:00
VM_PATH="${OS}-${RELEASE}-${EDITION}"
2022-02-23 09:59:27 +00:00
validate_release "releases_${OS}"
create_vm "$("get_${OS}" "${EDITION}")"
2022-02-22 18:48:42 +00:00
elif [ "${OS}" == "macos" ]; then
# macOS doesn't use create_vm()
validate_release releases_macos
get_macos
2021-10-19 13:56:45 +00:00
elif [[ "${OS}" == *"ubuntu"* ]]; then
2022-02-22 18:48:42 +00:00
# Ubuntu doesn't use create_vm()
2022-02-21 15:40:08 +00:00
validate_release releases_ubuntu
2022-02-21 10:11:25 +00:00
get_ubuntu
2022-07-24 00:15:52 +00:00
elif [[ "${OS}" == *"deepin"* ]]; then
# deepin doesn't use create_vm()
validate_release releases_deepin
get_deepin
2021-10-19 13:56:45 +00:00
elif [ "${OS}" == "windows" ]; then
2022-02-21 10:11:25 +00:00
LANG="English International"
2021-10-19 13:56:45 +00:00
if [ -n "${3}" ]; then
2022-02-22 02:03:42 +00:00
LANG="${3}"
2022-02-21 10:11:25 +00:00
if [[ ! ${LANGS[*]} =~ "${LANG}" ]]; then
echo -e "ERROR! ${LANG} is not a supported Windows language:\n"
2021-10-19 13:56:45 +00:00
for LANG in "${LANGS[@]}"; do
2022-02-21 09:19:07 +00:00
echo -n "${LANG} "
2021-10-19 13:56:45 +00:00
done
exit 1
fi
fi
2022-02-22 18:48:42 +00:00
# Windows doesn't use create_vm()
2022-02-21 15:04:03 +00:00
validate_release releases_windows
2022-02-21 10:11:25 +00:00
get_windows "${LANG}"
2021-10-19 13:56:45 +00:00
else
2022-02-23 09:59:27 +00:00
validate_release "releases_${OS}"
create_vm "$("get_${OS}")"
2021-10-19 13:56:45 +00:00
fi
2021-09-27 23:09:46 +00:00
else
2022-02-21 15:40:08 +00:00
echo "ERROR! You must specify a release."
2022-02-21 09:19:07 +00:00
case ${OS} in
2022-02-21 15:40:08 +00:00
*ubuntu*)
echo -n " - Releases: "
2022-02-24 22:28:29 +00:00
releases_ubuntu | sed -Ee 's/eol-\S+//g' # hide eol releases
2022-02-21 15:40:08 +00:00
;;
*)
echo -n " - Releases: "
releases_"${OS}"
if [[ $(type -t "editions_${OS}") == function ]]; then
echo -n " - Editions: "
editions_"${OS}"
fi
;;
2022-02-21 09:19:07 +00:00
esac
2021-09-27 23:09:46 +00:00
exit 1
2021-11-08 00:03:50 +00:00
fi
2022-02-23 11:45:39 +00:00
2022-02-23 11:50:31 +00:00
# vim:tabstop=4:shiftwidth=4:expandtab