/g' | grep "$HASH_LANG 64-bit" | grep -o -P '(?<= | ).*(?= |
)')
check_hash "${VM_PATH}/${FILE_NAME}" "${HASH}"
fi
}
function get_windows() {
if [ "${RELEASE}" == "10-ltsc" ]; then
download_windows_workstation windows-10-enterprise ltsc
elif [ "${OS}" == "windows-server" ]; then
download_windows_server "windows-server-${RELEASE}"
else
download_windows_workstation "${RELEASE}"
fi
if [ "${download_iso}" == 'on' ]; then
exit 0
fi
echo "Downloading VirtIO drivers..."
web_get "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso" "${VM_PATH}"
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
if [ -n "${FILE_NAME}" ]; then
make_vm_config "${FILE_NAME}" "virtio-win.iso"
else
make_vm_config "windows-${RELEASE}.iso" "virtio-win.iso"
fi
}
open_url() {
local URL="$1";
xdg-open $URL || sensible-browser $URL || x-www-browser $URL || gnome-open $URL;
}
create_vm() {
# shellcheck disable=SC2206
local URL_HASH=(${1// / })
local URL="${URL_HASH[0]}"
local HASH="${URL_HASH[1]}"
local ISO="${URL##*/}"
#echo "${URL}"
#echo "${ISO}"
#echo "${HASH}"
web_get "${URL}" "${VM_PATH}"
if [ -n "${HASH}" ]; then
check_hash "${ISO}" "${HASH}"
fi
if [ ${OS} == "freedos" ] && [[ $ISO =~ ".zip" ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso')
fi
#if [ ${OS} == "guix" ] && [[ $ISO =~ ".qcow2" ]]; then
#cp ${VM_PATH}/${ISO} ${VM_PATH}/disc.qcow2
#fi
if [[ ${OS} == "batocera" ]] && [[ ${ISO} =~ ".gz" ]]; then
gzip -d "${VM_PATH}/${ISO}"
ISO="${ISO/.gz/}"
fi
# Could be other OS iso files compressed with bzip2 or gzip
# but for now we'll keep this to know cases
if [[ ${OS} == "dragonflybsd" ]] && [[ ${ISO} =~ ".bz2" ]]; then
bzip2 -d "${VM_PATH}/${ISO}"
ISO="${ISO/.bz2/}"
fi
if [[ ${OS} == "easyos" ]] && [[ ${ISO} =~ ".img" ]]; then
qemu-img convert -f raw -O qcow2 "${VM_PATH}/${ISO}" "${VM_PATH}/disk.qcow2"
ISO="${ISO/.img/}"
fi
if [ ${OS} == "reactos" ] && [[ $ISO =~ ".zip" ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso' | grep -v '.zip')
fi
make_vm_config "${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=()
os_supported_release() {
if [[ ! " ${RELEASES[*]} " =~ " ${RELEASE} " ]]; then
echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release."
echo -n 'Supported releases: '
"releases_${OS}"
exit 1
fi
}
os_supported_edition() {
if [[ ! " ${EDITIONS[*]} " =~ " ${EDITION} " ]]; then
echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition\n"
echo -n ' - Editions: '
for EDITION in "${EDITIONS[@]}"; do
echo -n "${EDITION} "
done
echo ""
exit 1
fi
}
os_error_edition() {
echo -en "ERROR! You must specify an edition.\n - Editions: "
#TODO ERROR here
"editions_${OS}"
exit 1
}
os_supported_lang() {
echo -e "ERROR! ${LANG} is not a supported $(pretty_name "${OS}") language\n"
echo -n ' - Editions: '
for LANG in "${LANGS[@]}"; do
echo -n "${LANG} "
done
exit 1
}
handle_missing() {
# Handle odd missing Fedora combinations
if [[ $OS == fedora ]] ; then
if [[ ${RELEASE} = "33" && ${EDITION} = "i3" ]] || [[ ${RELEASE} = "34" && ${EDITION} = "Cinnamon" ]] || [[ "${RELEASE}" < "39" && ${EDITION} = "Onyx" ]]; then
echo "ERROR! Unsupported combination"
echo " Fedora ${RELEASE} ${EDITION} is not available, please choose another Release or Edition"
exit 1;
fi
fi
# Handle missing Manjaro Sway minimal
if [[ $OS == manjaro ]] ; then
if [[ ${RELEASE} == "sway" && ${EDITION} == "minimal" ]] ; then
echo "ERROR! Unsupported combination"
echo " Manjaro Sway does not have a minimal edition"
exit 1;
fi
fi
}
os_error() {
echo "ERROR! You must specify an operating system."
echo "- Supported Operating Systems:"
os_support | fold -s -w "$(tput cols)"
echo -e "\nTo see all possible arguments, use:\n quickget -h or quickget --help"
exit 1
}
os_not_supported() {
echo -e "ERROR! ${OS} is not a supported OS.\n"
os_support | fold -s -w "$(tput cols)"
exit 1
}
os_path_error() {
echo "ERROR! You must specify path."
os_error
exit 1
}
os_error_release() {
echo "ERROR! You must specify a release."
case ${OS} in
*ubuntu-server*)
echo -n " - Releases: "
releases_ubuntu-server | sed -Ee 's/eol-\S+//g' # hide eol releases
;;
*ubuntu*)
echo -n " - Releases: "
releases_ubuntu | sed -Ee 's/eol-\S+//g' # hide eol releases
;;
*windows*)
echo -n " - Releases: "
"releases_${OS}"
echo -n " - Languages: "
"languages_${OS}" && echo "${LANGS[@]}"
;;
*)
echo -n " - Releases: "
"releases_${OS}" | fold -s -w "$(tput cols)"
if [[ $(type -t "editions_${OS}") == function ]]; then
echo -n ' - Editions: '
"editions_${OS}"
fi
;;
esac
exit 1
}
if [ -n "${1}" ]; then
OS="${1,,}"
if [ "${OS}" == "list" ] || [ "${OS}" == "list_csv" ]; then
list_csv
elif [ "${OS}" == "list_json" ]; then
list_json
elif [ "${OS}" == "--version" ] || [ "${OS}" == "-version" ] || [ "${OS}" == "version" ]; then
WHERE=$(dirname "${BASH_SOURCE[0]}")
"${WHERE}/quickemu" --version
exit 0
fi
else
echo "ERROR! You must specify an operating system."
echo -n " - Operating Systems: "
os_support
echo "
You can also use these arguments:
Only show ISO download URL
--show-iso-url / -s {distro} {release} [edition]
Test if ISO is available
--test-iso-url / -t {distro} {release} [edition]
Open distro homepage
--open-distro-homepage / -o {distro}
Only download ISO
--download-iso / -d {distro} {release} [edition]"
exit 1
fi
if [[ ! " $(os_support) " =~ " ${OS} " ]]; then
echo -e "ERROR! ${OS} is not a supported OS.\n"
os_support
exit 1
fi
help_message() {
#shellcheck disable=SC2016
printf ' _ _
__ _ _ _ _ ___║ ║ ____ _ ___║ ║_
/ _` ║ ║ ║ ║ ║/ __║ ║/ / _` ║/ _ \ __║
( (_║ ║ ║_║ ║ ║ (__║ < (_║ ║ __/ ║_ MIT
\__, ║\__,_║_║\___║_║\ \__, ║\___║\__║ license
║_║ version: %s ║___/ part of QUICKEMU project
QEMU %s --------------------------------------------------
> Quickly create and run optimised Linux, <
> Windows and macOS desktop virtual machines. <
homepage - Not Yet
repository - https://github.com/quickemu-project/quickemu
official GUI - https://github.com/quickemu-project/quickgui
by Wimpy https://github.com/flexiondotorg and contributors
Discord - https://discord.gg/wimpy-s-world-712850672223125565
--------------------------------------------------------------
Basic Usage:
quickget