quickemu/quickget

1207 lines
36 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
# Here the quick 'n dirty guide to adding a new OS to quickget
#
# 1. Add the new OS, all lowercase, to os_support()
# 2. Add a "pretty name" display name to pretty_name()
# 3. Create a releases_newos() generator that outputs the currently supported release versions
# 4. Add the new OS to make_vm_config()
# 5. Create a get_newos() function that does something like this:
# function get_newos() {
2021-10-19 18:19:11 +02:00
# local HASH=""
# local ISO=""
# local URL=""
#
# validate_release "releases_newos"
# ISO="newos-${RELEASE}-amd64.iso"
# URL="https://www.newos.org/download/${ISO}"
# web_get "${URL}" "${VM_PATH}"
2021-10-19 18:19:11 +02:00
# web_get "${URL}/SHA256SUMS" "${VM_PATH}"
# HASH=$(cat "${VM_PATH}/SHA256SUMS" | cut -d' ' -f1)
2021-10-19 21:34:03 +02:00
# check_hash "${ISO}" "${HASH}"
# make_vm_config "${ISO}"
# }
# 6. Add new OS to the argument parser at the bottom of the script
function cleanup() {
if [ -n "$(jobs -p)" ]; then
kill $(jobs -p)
fi
}
2021-10-21 17:20:26 +02:00
2021-10-19 17:32:35 +02:00
function pretty_name() {
2021-10-19 18:31:11 +02:00
local SIMPLE_NAME=""
2021-10-19 17:32:35 +02:00
local PRETTY_NAME=""
2021-10-19 18:31:11 +02:00
SIMPLE_NAME="${1}"
case ${SIMPLE_NAME} in
2021-11-01 19:31:35 +01:00
android) PRETTY_NAME="Android x86";;
archlinux) PRETTY_NAME="Arch Linux";;
2021-10-19 18:31:11 +02:00
elementary) PRETTY_NAME="elementary OS";;
freebsd) PRETTY_NAME="FreeBSD";;
2021-10-19 17:32:35 +02:00
linuxmint-cinnamon) PRETTY_NAME="Linux Mint Cinnamon";;
2021-10-19 18:31:11 +02:00
linuxmint-mate) PRETTY_NAME="Linux Mint MATE";;
linuxmint-xfce) PRETTY_NAME="Linux Mint XFCE";;
2021-10-25 14:23:05 +02:00
nixos-gnome) PRETTY_NAME="NixOS Gnome";;
nixos-plasma5) PRETTY_NAME="NixOS KDE";;
2021-10-25 14:23:05 +02:00
nixos-minimal) PRETTY_NAME="NixOS Minimal";;
2021-10-19 18:31:11 +02:00
macos) PRETTY_NAME="macOS";;
2021-10-21 00:22:35 +02:00
openbsd) PRETTY_NAME="OpenBSD";;
2021-10-19 18:50:28 +02:00
opensuse) PRETTY_NAME="openSUSE";;
2021-10-19 18:31:11 +02:00
popos) PRETTY_NAME="Pop!_OS";;
rockylinux) PRETTY_NAME="Rocky Linux";;
2021-10-19 18:31:11 +02:00
ubuntu-budgie) PRETTY_NAME="Ubuntu Budgie";;
ubuntu-kylin) PRETTY_NAME="Ubuntu Kylin";;
ubuntu-mate) PRETTY_NAME="Ubuntu MATE";;
ubuntu-studio) PRETTY_NAME="Ubuntu Studio";;
*) PRETTY_NAME="${SIMPLE_NAME^}";;
2021-10-19 17:32:35 +02:00
esac
echo "${PRETTY_NAME}"
}
2021-10-19 17:33:03 +02:00
function validate_release() {
local DISPLAY_NAME=""
local RELEASE_GENERATOR="${1}"
local RELEASES=""
DISPLAY_NAME="$(pretty_name "${OS}")"
RELEASES=$(${RELEASE_GENERATOR})
if [[ "${RELEASES}" != *"${RELEASE}"* ]]; then
echo "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release."
echo "${RELEASES}"
exit 1
fi
}
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-20 01:35:00 +02:00
function list_csv() {
local DISPLAY_NAME
local DOWNLOADER
local FUNC
2021-10-27 17:57:55 +02:00
local OPTION
local OS
local RELEASE
echo "Display Name,OS,Release,Option,Downloader"
for OS in $(os_support); do
2021-10-19 17:32:35 +02:00
DISPLAY_NAME="$(pretty_name "${OS}")"
if [[ "${OS}" == *"ubuntu"* ]]; then
FUNC="ubuntu"
elif [[ "${OS}" == *"linuxmint"* ]]; then
FUNC="linuxmint"
2021-10-28 23:36:41 +02:00
elif [[ "${OS}" == *"nixos"* ]]; then
FUNC="nixos"
else
FUNC="${OS}"
fi
for RELEASE in $("releases_${FUNC}"); do
if [ "${OS}" == "macos" ]; then
DOWNLOADER="macrecovery"
2021-10-27 17:57:01 +02:00
elif [ "${OS}" == "ubuntu" ] && [ "${RELEASE}" == "canary" ]; then
DOWNLOADER="zsync"
2021-10-27 17:57:01 +02:00
elif [[ "${OS}" == *"ubuntu"* ]] && [ "${RELEASE}" == "devel" ]; then
DOWNLOADER="zsync"
else
DOWNLOADER="wget"
fi
if [ "${OS}" == "windows" ]; then
2021-10-27 17:57:55 +02:00
for OPTION in "${LANGS[@]}"; do
echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER}"
done
elif [ "${OS}" == "popos" ]; then
2021-10-27 17:57:55 +02:00
for OPTION in intel nvidia; do
echo "${DISPLAY_NAME},${OS},${RELEASE},${OPTION},${DOWNLOADER}"
done
else
echo "${DISPLAY_NAME},${OS},${RELEASE},,${DOWNLOADER}"
fi
done
done
exit 0
}
function os_support() {
2021-10-29 15:50:45 +02:00
echo android \
archlinux \
elementary \
freebsd \
fedora \
kali \
kubuntu \
linuxmint-cinnamon \
linuxmint-mate \
linuxmint-xfce \
nixos-gnome \
nixos-plasma5 \
nixos-minimal \
lubuntu \
macos \
openbsd \
2021-10-16 20:27:45 +02:00
opensuse \
popos \
rockylinux \
ubuntu \
2021-09-28 03:14:30 +02:00
ubuntu-budgie \
ubuntu-kylin \
ubuntu-mate \
ubuntu-studio \
2021-09-28 06:03:16 +02:00
windows \
xubuntu
}
2021-10-29 15:50:45 +02:00
function releases_android() {
2021-11-01 19:31:35 +01:00
echo 9.0 \
8.1 \
2021-10-29 15:50:45 +02:00
7.1 \
6.0 \
5.1 \
4.4 \
4.0 \
2.2
}
function releases_archlinux() {
echo latest
}
function releases_elementary() {
2021-10-19 15:58:57 +02:00
echo 6.0
}
function releases_freebsd(){
2021-10-19 15:59:21 +02:00
echo 12.2 \
13.0
}
2021-10-13 21:12:33 +02:00
function releases_fedora(){
echo 33 \
34 \
35_beta
}
function releases_kali() {
echo latest \
weekly
}
function releases_linuxmint(){
echo 20.2
}
function releases_nixos(){
echo 21.05
}
function releases_openbsd(){
2021-10-21 00:22:35 +02:00
echo 7.0
}
2021-10-16 20:27:45 +02:00
function releases_opensuse(){
2021-10-19 16:00:07 +02:00
echo 15.0 \
15.1 \
15.2 \
15.3 \
microos \
tumbleweed
2021-10-16 20:27:45 +02:00
}
function releases_macos() {
2021-09-28 16:25:38 +02:00
echo high-sierra \
mojave \
catalina \
2021-10-27 12:56:56 +02:00
big-sur \
monterey
}
function releases_popos() {
2021-10-19 16:01:19 +02:00
echo 20.04 \
21.04
}
function releases_rockylinux() {
echo 8.4 \
8.3 \
8.2 \
8.1 \
8.0
}
function releases_ubuntu() {
echo bionic \
focal \
hirsute \
2021-10-15 02:20:50 +02:00
impish \
devel \
canary
}
2021-09-28 06:03:16 +02:00
function languages_windows() {
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 06:03:16 +02:00
}
function releases_windows() {
2021-10-06 00:51:57 +02:00
echo 8 \
10 \
11
2021-09-28 06:03:16 +02: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:
http://technet.microsoft.com/en-us/library/ff699038.aspx
-->
<settings pass="generalize">
<!--
The PersistAllDeviceInstalls setting indicates whether all plug and
play devices on the destination computer remain installed during the
generalize configuration pass.
-->
<component name="Microsoft-Windows-PnPSysprep"
processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35"
language="neutral"
versionScope="nonSxS">
<PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
</component>
</settings>
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>EFI</Type>
<Size>100</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>2</Order>
<Type>MSR</Type>
<Size>512</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>3</Order>
<Type>Primary</Type>
<Extend>true</Extend>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>System</Label>
<Format>FAT32</Format>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>3</PartitionID>
<Label>Windows</Label>
<Letter>C</Letter>
<Format>NTFS</Format>
</ModifyPartition>
</ModifyPartitions>
</Disk>
<WillShowUI>OnError</WillShowUI>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<WillShowUI>OnError</WillShowUI>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>3</PartitionID>
</InstallTo>
</OSImage>
</ImageInstall>
<UserData>
<AcceptEula>true</AcceptEula>
<ProductKey>
<key>VK7JG-NPHTM-C97JM-9MPGT-3V66T</key>
<WillShowUI>Never</WillShowUI>
</ProductKey>
</UserData>
<DynamicUpdate>
<Enable>true</Enable>
<WillShowUI>Never</WillShowUI>
</DynamicUpdate>
</component>
<component name="Microsoft-Windows-PnpCustomizationsWinPE"
publicKeyToken="31bf3856ad364e35" language="neutral"
versionScope="nonSxS" processorArchitecture="amd64">
<!--
This makes the VirtIO drivers available to Windows, assuming that
the VirtIO driver disk
(https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md)
is available as drive E:
-->
<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="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<ComputerName>*</ComputerName>
<OEMInformation>
<Manufacturer>Wimpys World</Manufacturer>
<Model>Quickemu</Model>
<SupportHours>24/7</SupportHours>
<SupportPhone></SupportPhone>
<SupportProvider>Wimpys World</SupportProvider>
<SupportURL>https://github.com/wimpysworld/quickemu/issues</SupportURL>
</OEMInformation>
<OEMName>Wimpys World</OEMName>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64"
publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<OOBE>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
</OOBE>
<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>
</FirstLogonCommands>
</component>
</settings>
</unattend>
EOF
}
2021-10-19 18:19:11 +02:00
function check_hash() {
local iso=""
local hash=""
local hash_algo=""
iso="${VM_PATH}/${1}"
2021-10-19 18:19:11 +02:00
hash="${2}"
# Guess the hash algorithm by the hash length
case ${#hash} in
32) hash_algo=md5sum;;
40) hash_algo=sha1sum;;
64) hash_algo=sha256sum;;
2021-10-21 02:13:43 +02:00
128) hash_algo=sha512sum;;
*) echo "WARNING! Can't guess hash algorithm, not checking ${iso} hash."
return;;
esac
2021-10-19 18:19:11 +02: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
}
function web_get() {
local DIR="${2}"
local FILE=""
local URL="${1}"
2021-09-28 06:03:16 +02:00
if [ -n "${3}" ]; then
FILE="${3}"
else
FILE="${URL##*/}"
fi
if ! mkdir -p "${DIR}" 2>/dev/null; then
echo "ERROR! Unable to create directory ${DIR}"
exit 1
fi
if ! wget --quiet --continue --show-progress --progress=bar:force:noscroll "${URL}" -O "${DIR}/${FILE}"; then
2021-09-28 06:03:16 +02:00
echo "ERROR! Failed to download ${URL}. Try running 'quickget' again."
exit 1
fi
}
function zsync_get() {
local DIR="${2}"
local FILE=""
local OUT=""
local URL="${1}"
FILE="${URL##*/}"
if [ -n "${3}" ]; then
OUT="${3}"
else
OUT="${FILE}"
fi
if ! mkdir -p "${DIR}" 2>/dev/null; then
echo "ERROR! Unable to create directory ${DIR}"
exit 1
fi
2021-10-19 20:42:01 +02:00
if ! zsync "${URL}.zsync" -i "${DIR}/${OUT}" -o "${DIR}/${OUT}" 2>/dev/null; then
echo "ERROR! Failed to download ${URL}.zsync"
exit 1
fi
2021-10-27 17:25:11 +02:00
if [ -e "${DIR}/${OUT}.zs-old" ]; then
rm "${DIR}/${OUT}.zs-old"
fi
}
function start_vm_info() {
echo
echo "To start your ${OS} ${RELEASE} virtual machine run:"
echo " quickemu --vm ${OS}-${RELEASE}.conf"
echo
}
function make_vm_config() {
local IMAGE_FILE=""
local ISO_FILE=""
local IMAGE_TYPE=""
local GUEST=""
local SEC_BOOT=""
IMAGE_FILE="${1}"
ISO_FILE="${2}"
if [ "${OS}" == "archlinux" ]; then
GUEST="linux"
IMAGE_TYPE="iso"
elif [ "${OS}" == "elementary" ]; then
GUEST="linux"
IMAGE_TYPE="iso"
elif [ "${OS}" == "freebsd" ]; then
GUEST="freebsd"
IMAGE_TYPE="iso"
elif [ "${OS}" == "fedora" ]; then
GUEST="linux"
IMAGE_TYPE="iso"
2021-10-25 14:22:33 +02:00
elif [ "${OS}" == "kali" ]; then
GUEST="linux"
IMAGE_TYPE="iso"
elif [[ "${OS}" == *"linuxmint"* ]]; then
GUEST="linux"
IMAGE_TYPE="iso"
elif [[ "${OS}" == *"nixos"* ]]; then
GUEST="linux"
IMAGE_TYPE="iso"
2021-10-21 00:22:35 +02:00
elif [ "${OS}" == "openbsd" ]; then
GUEST="openbsd"
IMAGE_TYPE="iso"
elif [ "${OS}" == "opensuse" ]; then
2021-10-16 20:27:45 +02:00
GUEST="linux"
IMAGE_TYPE="iso"
elif [ "${OS}" == "popos" ]; then
GUEST="linux"
IMAGE_TYPE="iso"
elif [ "${OS}" == "rockylinux" ]; then
GUEST="linux"
IMAGE_TYPE="iso"
2021-10-13 21:12:33 +02:00
elif [[ "${OS}" == *"ubuntu"* ]]; then
GUEST="linux"
2021-10-15 02:45:05 +02:00
IMAGE_TYPE="iso"
elif [ "${OS}" == "macos" ]; then
GUEST="macos"
IMAGE_TYPE="img"
2021-09-28 06:03:16 +02:00
elif [ "${OS}" == "windows" ]; then
GUEST="windows"
IMAGE_TYPE="iso"
fi
if [ ! -e "${OS}-${RELEASE}.conf" ]; then
echo "Making VM configuration for ${OS}-${RELEASE}..."
cat << EOF > "${OS}-${RELEASE}.conf"
guest_os="${GUEST}"
disk_img="${VM_PATH}/disk.qcow2"
2021-09-28 06:03:16 +02:00
${IMAGE_TYPE}="${VM_PATH}/${IMAGE_FILE}"
EOF
if [ -n "${ISO_FILE}" ]; then
echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${OS}-${RELEASE}.conf"
2021-09-28 06:03:16 +02:00
fi
2021-10-21 00:22:35 +02:00
if [ "${OS}" == "openbsd" ]; then
echo "boot=\"legacy\"" >> "${OS}-${RELEASE}.conf"
fi
if [ "${OS}" == "macos" ]; then
echo "macos_release=\"${RELEASE}\"" >> "${OS}-${RELEASE}.conf"
fi
2021-10-06 12:01:33 +02:00
# Enable TPM for Windows 11
2021-10-19 17:38:43 +02:00
if [ "${OS}" == "windows" ] && [ "${RELEASE}" -ge 11 ]; then
2021-10-06 12:01:33 +02:00
echo "tpm=\"on\"" >> "${OS}-${RELEASE}.conf"
# 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
echo "secureboot=\"${SEC_BOOT}\"" >> "${OS}-${RELEASE}.conf"
2021-10-06 12:01:33 +02:00
fi
fi
start_vm_info
}
2021-10-29 15:50:45 +02:00
function get_android() {
local HASH=""
local ISO=""
local URL=""
validate_release "releases_android"
fosshubVerionInfo=$(wget -O - -q "https://www.fosshub.com/Android-x86-old.html" | grep "var settings =")
verison="android-x86-${RELEASE}"
releaseJson=$(echo ${fosshubVerionInfo:16} | jq --arg ver "${verison}" 'first(.pool.f[] | select((.n | startswith($ver)) and (.n | endswith(".iso"))))')
HASH=$(echo "${releaseJson}" | jq -r .hash.sha256)
ISO=$(echo "${releaseJson}" | jq -r .n)
baseurl="https://mirrors.gigenet.com/OSDN/android-x86/"
releaseFolders=$(wget -q -O - ${baseurl} | grep -o -E [0-9]{5} | uniq)
for item in $releaseFolders; do
file=$(wget -O - -q ${baseurl}${item} | grep "${ISO}")
if [[ $file != "" ]]; then
URL="${baseurl}${item}/${ISO}"
break
fi
done
web_get "${URL}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
}
function get_archlinux() {
local HASH=""
local ISO=""
local URL=""
local VERSION=""
validate_release "releases_archlinux"
VERSION=$(wget -q -O- 'https://archlinux.org/releng/releases/json/' | jq '.latest_version' | cut -d "\"" -f 2)
2021-10-29 12:26:44 +02:00
URL="https://mirror.rackspace.com/archlinux/iso/${VERSION}"
ISO="archlinux-${VERSION}-x86_64.iso"
HASH=$(wget -q -O- 'https://archlinux.org/releng/releases/json/' | jq '.releases[0].sha1_sum' | cut -d "\"" -f 2)
web_get "${URL}/${ISO}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
}
function get_elementary() {
2021-10-19 15:58:57 +02:00
local ISO=""
local URL=""
2021-10-28 08:27:40 +02:00
local B66tim=""
2021-10-19 15:58:57 +02:00
validate_release "releases_elementary"
2021-10-28 08:27:40 +02:00
B66tim=$(date +%s | base64 )
2021-10-19 15:49:47 +02:00
ISO="elementaryos-${RELEASE}-stable.20211005.iso"
2021-10-28 23:42:31 +02:00
# TODO: derive region from geoIP
2021-10-28 08:27:40 +02:00
URL="https://ams3.dl.elementary.io/download/${B66tim}=/${ISO}"
2021-10-19 15:49:47 +02:00
web_get "${URL}" "${VM_PATH}"
make_vm_config "${ISO}"
}
function get_freebsd() {
2021-10-21 02:13:43 +02:00
local HASH=""
2021-10-19 15:59:21 +02:00
local ISO=""
local URL=""
2021-10-07 17:36:38 +02:00
validate_release "releases_freebsd"
2021-10-19 15:59:21 +02:00
ISO="FreeBSD-${RELEASE}-RELEASE-amd64-dvd1.iso"
2021-10-21 02:13:43 +02:00
HASH=$(wget -q -O- "https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/${RELEASE}/CHECKSUM.SHA512-FreeBSD-${RELEASE}-RELEASE-amd64" | grep '('"${ISO}"')' | cut -d' ' -f4)
2021-10-19 15:59:21 +02:00
URL="https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/${RELEASE}/${ISO}"
2021-10-19 15:49:47 +02:00
web_get "${URL}" "${VM_PATH}"
2021-10-21 02:13:43 +02:00
check_hash "${ISO}" "${HASH}"
2021-10-19 15:49:47 +02:00
make_vm_config "${ISO}"
}
2021-10-13 21:12:33 +02:00
function get_fedora() {
2021-10-19 16:01:43 +02:00
local FEDORA_RELEASE=""
local FEDORA_VERSIONS=""
local HASH=""
2021-10-19 16:01:43 +02:00
local ISO=""
2021-10-13 21:12:33 +02:00
local URL=""
2021-10-19 16:01:43 +02:00
local VERSION_NUM=""
validate_release "releases_fedora"
2021-10-13 21:12:33 +02:00
FEDORA_VERSIONS=$(wget -q -O- "https://getfedora.org/releases.json" | jq '.[] | select((.variant=="Workstation" or .variant=="Spins") and .arch=="x86_64")')
2021-10-19 16:01:43 +02:00
if [[ "${RELEASE}" == *"beta"* ]]; then
VERSION_NUM=${RELEASE%"_beta"}
FEDORA_RELEASE=$(echo "${FEDORA_VERSIONS}" | jq -c '. | select(.version | contains("Beta"))' | jq '. | select(.variant=="Workstation")')
2021-10-13 21:12:33 +02:00
ISO="Fedora-Workstation-Live-x86_64-${VERSION_NUM}_Beta-1.2.iso"
else
2021-10-19 16:01:43 +02:00
FEDORA_RELEASE=$(echo "${FEDORA_VERSIONS}" | jq '. | select(.variant=="Workstation" and .version=="'${RELEASE}'")')
ISO="Fedora-Workstation-Live-x86_64-${RELEASE}-1.2.iso"
2021-10-13 21:12:33 +02:00
fi
2021-10-15 02:45:05 +02:00
2021-10-19 15:49:47 +02:00
URL=$(echo "${FEDORA_RELEASE}" | jq -r '.link')
HASH=$(echo "${FEDORA_RELEASE}" | jq -r '.sha256')
2021-10-19 15:49:47 +02:00
web_get "${URL}" "${VM_PATH}"
2021-10-19 21:34:03 +02:00
check_hash "${ISO}" "${HASH}"
2021-10-19 15:49:47 +02:00
make_vm_config "${ISO}"
2021-10-13 21:12:33 +02:00
}
function get_kali() {
local HASH=""
local ISO=""
local URL=""
local SUBDIR=""
validate_release "releases_kali"
if [[ "${RELEASE}" == "latest" ]]; then
SUBDIR="current"
else
SUBDIR="kali-weeekly"
fi
ISO=$(wget -q -O- "https://cdimage.kali.org/${SUBDIR}/?C=M;O=D" |grep -o ">kali-linux-.*-installer-amd64.iso"|head -n 1|cut -c 2-)
HASH=$(wget -q -O- "https://cdimage.kali.org/${SUBDIR}/SHA256SUMS" | grep "${ISO}" | cut -d' ' -f1)
URL="https://cdimage.kali.org/${SUBDIR}/${ISO}"
web_get "${URL}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
}
function get_linuxmint() {
local FLAVOR=""
2021-10-21 01:54:45 +02:00
local HASH=""
local ISO=""
local URL=""
validate_release "releases_linuxmint"
FLAVOR=$(echo "${OS}" | cut -d'-' -f2)
ISO="linuxmint-${RELEASE}-${FLAVOR}-64bit.iso"
2021-10-21 01:54:45 +02:00
HASH=$(wget -q -O- "https://mirror.bytemark.co.uk/linuxmint/stable/${RELEASE}/sha256sum.txt" | grep "${ISO}" | cut -d' ' -f1)
URL="https://mirror.bytemark.co.uk/linuxmint/stable/${RELEASE}/${ISO}"
2021-10-19 15:49:47 +02:00
web_get "${URL}" "${VM_PATH}"
2021-10-21 01:54:45 +02:00
check_hash "${ISO}" "${HASH}"
2021-10-19 15:49:47 +02:00
make_vm_config "${ISO}"
}
function get_nixos() {
local FLAVOR=""
local HASH=""
local ISO=""
local URL=""
validate_release "releases_nixos"
FLAVOR=$(echo "${OS}" | cut -d'-' -f2)
ISO="latest-nixos-${FLAVOR}-x86_64-linux.iso"
URL="https://channels.nixos.org/nixos-${RELEASE}/${ISO}"
HASH=$(wget -q -O- "https://channels.nixos.org/nixos-${RELEASE}/${ISO}.sha256" | cut -d' ' -f1)
web_get "${URL}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
}
function get_openbsd() {
2021-10-21 00:22:35 +02:00
local HASH=""
local ISO=""
local URL=""
2021-10-21 00:22:35 +02:00
validate_release "releases_openbsd"
ISO="install${RELEASE//\./}.iso"
URL="https://cdn.openbsd.org/pub/OpenBSD/${RELEASE}/amd64/${ISO}"
HASH=$(wget -q -O- "https://cdn.openbsd.org/pub/OpenBSD/${RELEASE}/amd64/SHA256" | grep "${ISO}" | cut -d' ' -f4)
web_get "${URL}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
}
function get_rocky() {
local HASH=""
local ISO=""
local URL=""
local arch="x86_64"
local baseurl="https://download.rockylinux.org/pub/rocky/${RELEASE}/isos/${arch}"
validate_release "releases_rockylinux"
ISO="Rocky-${RELEASE}-${arch}-${ISOTYPE}.iso"
URL="${baseurl}/${ISO}"
HASH=$(wget -q -O- "${baseurl}/CHECKSUM" | grep "SHA256 (${ISO})" | grep -E -i -w -o '[0-9a-z]{64}')
web_get "${URL}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
}
2021-10-16 20:27:45 +02:00
function get_opensuse() {
2021-10-21 01:56:25 +02:00
local HASH=""
2021-10-19 16:00:07 +02:00
local ISO=""
2021-10-16 20:27:45 +02:00
local URL=""
validate_release "releases_opensuse"
2021-10-19 16:00:07 +02:00
if [ "${RELEASE}" == "tumbleweed" ]; then
2021-10-16 20:27:45 +02:00
ISO="openSUSE-Tumbleweed-DVD-x86_64-Current.iso"
2021-10-19 16:00:07 +02:00
URL="https://download.opensuse.org/tumbleweed/iso/${ISO}"
2021-10-21 01:56:25 +02:00
HASH=$(wget -q -O- "${URL}.sha256" | cut -d' ' -f1)
2021-10-19 16:00:07 +02:00
elif [ "${RELEASE}" == "microos" ]; then
2021-10-18 13:30:06 +02:00
ISO="openSUSE-MicroOS-DVD-x86_64-Current.iso"
2021-10-19 16:00:07 +02:00
URL="https://download.opensuse.org/tumbleweed/iso/${ISO}"
2021-10-21 01:56:25 +02:00
HASH=$(wget -q -O- "${URL}.sha256" | cut -d' ' -f1)
2021-10-16 20:27:45 +02:00
else
2021-10-19 16:00:07 +02:00
ISO="openSUSE-Leap-${RELEASE}-DVD-x86_64.iso"
URL="https://download.opensuse.org/distribution/leap/${RELEASE}/iso/${ISO}"
2021-10-21 01:56:25 +02:00
HASH=$(wget -q -O- "${URL}.sha256" | cut -d' ' -f1)
2021-10-16 20:27:45 +02:00
fi
2021-10-19 15:49:47 +02:00
web_get "${URL}" "${VM_PATH}"
2021-10-21 01:56:25 +02:00
check_hash "${ISO}" "${HASH}"
2021-10-19 15:49:47 +02:00
make_vm_config "${ISO}"
2021-10-16 20:27:45 +02:00
}
function get_macos() {
local BOARD_ID=""
local CWD=""
local MACRECOVERY=""
local MLB=""
case ${RELEASE} in
high-sierra)
BOARD_ID="Mac-7BA5B2D9E42DDD94"
MLB="00000000000J80300";;
2021-09-28 16:26:10 +02:00
mojave)
BOARD_ID="Mac-7BA5B2DFE22DDD8C"
MLB="00000000000KXPG00";;
catalina)
BOARD_ID="Mac-CFF7D910A743CAAF"
MLB="00000000000PHCD00";;
big-sur)
2021-10-27 16:44:29 +02:00
BOARD_ID="Mac-35C1E88140C3E6CF"
MLB="00000000000000000";;
2021-10-27 12:56:56 +02:00
monterey)
BOARD_ID="Mac-06F11F11946D27C5"
MLB="00000000000000000";;
*) echo "ERROR! Unknown release: ${RELEASE}"
releases_macos
exit 1;;
esac
# Use a bundled macrecovery if possible
2021-10-27 13:18:10 +02:00
CWD="$(dirname "${0}")"
2021-10-05 18:11:49 +02:00
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
2021-10-25 12:13:53 +02:00
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}" \
--basename RecoveryImage \
--outdir "${VM_PATH}" \
download
fi
if [ -e "${VM_PATH}/RecoveryImage.dmg" ] && [ ! -e "${VM_PATH}/RecoveryImage.img" ]; then
echo "Converting RecoveryImage..."
qemu-img convert "${VM_PATH}/RecoveryImage.dmg" -O raw "${VM_PATH}/RecoveryImage.img"
fi
make_vm_config RecoveryImage.img
}
function get_popos() {
local DRIVER="intel"
local HASH=""
2021-10-19 15:49:47 +02:00
local ISO=""
local URL=""
if [ -n "${1}" ]; then
DRIVER="${1}"
fi
validate_release "releases_popos"
URL=$(wget -q -O- "https://api.pop-os.org/builds/${RELEASE}/${DRIVER}" | jq ".url")
URL="${URL//\"/}"
ISO=$(echo "${URL}" | sed -e "s/.*\/\([^\/]*\)$/\1/")
HASH=$(wget -q -O- "https://api.pop-os.org/builds/${RELEASE}/${DRIVER}" | jq ".sha_sum")
HASH="${HASH//\"/}"
2021-10-19 15:49:47 +02:00
web_get "${URL}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
2021-10-19 15:49:47 +02:00
make_vm_config "${ISO}"
}
function get_ubuntu() {
local DEVEL="daily-live"
local ISO=""
local HASH=""
local PROJECT=""
local URL=""
case ${OS} in
kubuntu|lubuntu|ubuntu|ubuntu-budgie|ubuntu-mate|xubuntu)
PROJECT="${OS}";;
ubuntu-kylin)
PROJECT="ubuntukylin";;
ubuntu-studio)
PROJECT="ubuntustudio"
DEVEL="dvd";;
*) echo "ERROR! ${OS} is not a recognised Ubuntu flavour."
exit 1;;
esac
2021-10-27 17:25:53 +02:00
if [ "${RELEASE}" == "canary" ] && [ "${OS}" != "ubuntu" ]; then
echo "ERROR! Canary is currently only available for Ubuntu."
exit 1
else
validate_release "releases_ubuntu"
fi
if [ "${RELEASE}" == "canary" ]; then
DEVEL="daily-canary"
2021-10-27 17:25:53 +02:00
URL="http://cdimage.ubuntu.com/${PROJECT}/${DEVEL}/current"
elif [ "${RELEASE}" == "devel" ]; then
URL="http://cdimage.ubuntu.com/${PROJECT}/${DEVEL}/current"
elif [ "${PROJECT}" == "ubuntu" ]; then
URL="http://releases.ubuntu.com/${RELEASE}"
else
URL="http://cdimage.ubuntu.com/${PROJECT}/releases/${RELEASE}/release"
fi
HASH=$(wget -q -O- "${URL}/SHA256SUMS" | cut -d' ' -f1)
ISO=$(wget -q -O- "${URL}/SHA256SUMS" | grep 'desktop\|dvd' | grep amd64 | cut -d' ' -f2 | sed 's|*||g')
2021-10-27 17:25:53 +02:00
if [ "${RELEASE}" == "canary" ] || [ "${RELEASE}" == "devel" ]; then
zsync_get "${URL}/${ISO}" "${VM_PATH}" "${OS}-${RELEASE}.iso"
make_vm_config "${OS}-${RELEASE}.iso"
else
web_get "${URL}/${ISO}" "${VM_PATH}"
2021-10-19 21:34:03 +02:00
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
fi
}
2021-09-28 06:03:16 +02:00
# Adapted from https://gist.github.com/hongkongkiwi/15a5bf16437315df256c118c163607cb
function get_windows() {
local ARCH="x64"
local INDEX=0
2021-09-28 06:03:16 +02:00
local LANG_CODE="en"
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 16:14:03 +02:00
validate_release "releases_windows"
2021-09-28 06:03:16 +02:00
# Ignore the most recent Windows 10 release for now.
if [ ${RELEASE} -eq 10 ]; then
INDEX=1
fi
2021-09-28 06:03:16 +02:00
echo "Getting Windows ${RELEASE} URL..."
2021-10-05 21:08:13 +02:00
WINDOWS_VERSIONS=$(wget -q -O- "https://tb.rg-adguard.net/php/get_version.php?type_id=1" | jq '.versions | sort_by(-(.version_id | tonumber))')
LATEST_WINDOWS_VERSION=$(echo "${WINDOWS_VERSIONS}" | jq -c 'map(select(.name | contains("Windows '${RELEASE}'")))['${INDEX}']')
2021-10-05 21:08:13 +02:00
2021-09-28 06:03:16 +02:00
WINDOWS_NAME=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .name)
VERSION_ID=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .version_id)
2021-10-05 21:08:13 +02:00
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');;
2021-10-05 21:08:13 +02:00
esac
2021-09-28 06:03:16 +02:00
LANGUAGE_ID=$(wget -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_NAME}"'").language_id')
ARCH_INFO=$(wget -q -O- "https://tb.rg-adguard.net/php/get_arch.php?language_id=${LANGUAGE_ID}")
FILE_NAME=$(echo "${ARCH_INFO}" | jq -r '.archs[] | select(.name | contains("'${ARCH}'")).name')
ARCH_ID=$(echo "${ARCH_INFO}" | jq -r '.archs[] | select(.name | contains("'${ARCH}'")).arch_id')
DOWNLOAD_INFO=$(wget -q -O- "https://tb.rg-adguard.net/dl.php?fileName=${ARCH_ID}&lang=en")
DOWNLOAD_SHA1=$(echo "${DOWNLOAD_INFO}" | sed -e 's/<[^>]*>//g' | grep -o -P '(?<=SHA1: ).*(?= expire)' | sed 's/Link//')
2021-09-28 06:03:16 +02:00
DOWNLOAD_ID=$(echo "${DOWNLOAD_INFO}" | grep -oP '(?<=https:\/\/tb\.rg-adguard\.net/dl\.php\?go=)[0-9a-z]+')
DOWNLOAD_URL="https://tb.rg-adguard.net/dl.php?go=${DOWNLOAD_ID}"
echo "Downloading ${WINDOWS_NAME}..."
web_get "${DOWNLOAD_URL}" "${VM_PATH}" "${FILE_NAME}"
2021-10-09 17:10:58 +02:00
# Windows 10 doesn't include a SHA1, so only check the integrity if the SHA1 is available.
if [ -n "${DOWNLOAD_SHA1}" ]; then
2021-10-19 21:34:03 +02:00
check_hash "${FILE_NAME}" "${DOWNLOAD_SHA1}"
2021-10-09 17:10:58 +02:00
fi
2021-09-28 06:03:16 +02:00
web_get "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" "${VM_PATH}"
2021-10-19 17:39:21 +02: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 06:03:16 +02:00
make_vm_config "${FILE_NAME}" "virtio-win.iso"
}
trap cleanup EXIT
if ((BASH_VERSINFO[0] < 4))
then
echo "Sorry, you need bash 4.0 or newer to run this script."
exit 1
fi
LANGS=()
languages_windows
if [ -n "${1}" ]; then
OS="${1,,}"
2021-10-20 01:35:00 +02:00
if [ "${OS}" == "list" ] || [ "${OS}" == "list_csv" ]; then
list_csv
elif [ "${OS}" == "list_json" ]; then
list_json
fi
else
2021-10-19 15:56:45 +02:00
echo "ERROR! You must specify an operating system:"
os_support
exit 1
fi
if [ -n "${2}" ]; then
RELEASE="${2,,}"
2021-10-19 15:56:45 +02:00
VM_PATH="${OS}-${RELEASE}"
2021-10-29 15:50:45 +02:00
if [ "${OS}" == "android" ]; then
get_android
elif [ "${OS}" == "archlinux" ]; then
get_archlinux
elif [ "${OS}" == "elementary" ]; then
2021-10-19 15:56:45 +02:00
get_elementary
elif [ "${OS}" == "macos" ]; then
get_macos
elif [ "${OS}" == "freebsd" ]; then
get_freebsd
elif [ "${OS}" == "fedora" ]; then
get_fedora
elif [ "${OS}" == "kali" ]; then
get_kali
elif [[ "${OS}" == *"linuxmint-"* ]]; then
2021-10-19 15:56:45 +02:00
get_linuxmint
elif [[ "${OS}" == *"nixos-"* ]]; then
get_nixos
2021-10-21 00:22:35 +02:00
elif [ "${OS}" == "openbsd" ]; then
get_openbsd
2021-10-19 15:56:45 +02:00
elif [ "${OS}" == "opensuse" ]; then
get_opensuse
elif [ "${OS}" == "popos" ]; then
if [ -n "${3}" ]; then
DRIVER="${3}"
DRIVERS=(intel nvidia)
if [[ ! ${DRIVERS[*]} =~ ${DRIVER} ]]; then
echo "ERROR! ${DRIVER} is not a supported driver:"
for DRIVER in "${DRIVERS[@]}"; do
echo "${DRIVER}"
done
exit 1
fi
else
DRIVER="intel"
fi
VM_PATH="${OS}-${RELEASE}-${DRIVER}"
get_popos "${DRIVER}"
elif [ "${OS}" == "rockylinux" ]; then
if [ -n "${3}" ]; then
ISOTYPE="${3}"
ISOTYPES=(minimal dvd1 boot)
if [[ ! ${ISOTYPES[*]} =~ ${ISOTYPE} ]]; then
echo "iso ${ISOTYPE} is not supported:"
for ISOTYPE in "${ISOTYPES[@]}"; do
echo "${ISOTYPE}"
done
exit 1
fi
else
ISOTYPE="dvd1"
fi
VM_PATH="${OS}-${RELEASE}-${ISOTYPE}"
get_rocky "${ISOTYPE}"
2021-10-19 15:56:45 +02:00
elif [[ "${OS}" == *"ubuntu"* ]]; then
get_ubuntu
elif [ "${OS}" == "windows" ]; then
if [ -n "${3}" ]; then
LANG_NAME="${3}"
if [[ ! ${LANGS[*]} =~ ${LANG_NAME} ]]; then
echo "ERROR! ${LANG_NAME} is not a supported language:"
for LANG in "${LANGS[@]}"; do
echo "${LANG}"
done
exit 1
fi
else
LANG_NAME="English International"
fi
get_windows "${LANG_NAME}"
else
echo "ERROR! ${OS} is unknown:"
os_support
exit 1
fi
else
echo -n "ERROR! You must specify a release: "
if [ "${OS}" == "archlinux" ]; then
releases_archlinux
elif [ "${OS}" == "elementary" ]; then
releases_elementary
elif [ "${OS}" == "freebsd" ]; then
2021-10-07 17:36:10 +02:00
releases_freebsd
2021-10-16 20:09:39 +02:00
elif [ "${OS}" == "fedora" ]; then
releases_fedora
elif [ "${OS}" == "kali" ]; then
releases_kali
elif [[ "${OS}" == *"linuxmint-"* ]]; then
releases_linuxmint
elif [[ "${OS}" == *"nixos-"* ]]; then
releases_nixos
2021-10-16 20:27:45 +02:00
elif [ "${OS}" == "opensuse" ]; then
releases_opensuse
elif [ "${OS}" == "openbsd" ]; then
releases_openbsd
2021-10-07 17:36:10 +02:00
elif [ "${OS}" == "macos" ]; then
releases_macos
elif [ "${OS}" == "popos" ]; then
releases_popos
elif [[ "${OS}" == *"ubuntu"* ]]; then
releases_ubuntu
2021-10-06 00:51:57 +02:00
elif [ "${OS}" == "windows" ]; then
2021-09-28 06:03:16 +02:00
releases_windows
else
echo "${OS} is unknown"
os_support
fi
exit 1
fi