From 9443931dbb308045fd8ab47033ea226ddeb8b114 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 22 Feb 2022 02:03:42 +0000 Subject: [PATCH 1/6] Fix get_windows() Use the passed LANG as LANG_EDITION. Simpler INDEX tweaking, make shellcheck happy. --- quickget | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/quickget b/quickget index 540eef5..a17361b 100755 --- a/quickget +++ b/quickget @@ -1850,6 +1850,7 @@ function get_windows() { local ARCH="x64" local INDEX=0 local LANG_CODE="en" + local LANG_EDITION="" local LATEST_WINDOWS_VERSION="" local WINDOWS_NAME="" local VERSION_ID="" @@ -1861,19 +1862,18 @@ function get_windows() { local DOWNLOAD_ID="" local DOWNLOAD_URL="" - # Ignore the most recent Windows 10 release for now. - if [ "${RELEASE}" -eq 10 ]; then - INDEX=0 - fi + LANG_EDITION="${1}" - if [ "${RELEASE}" -eq 11 ]; then - INDEX=0 - fi + # Ignore the most recent Windows 10 release for now. + case ${RELEASE} in + 10) INDEX=0;; + 11) INDEX=0;; + esac echo "Getting Windows ${RELEASE} URL..." WINDOWS_VERSIONS=$(wget -q -O- "https://tb.rg-adguard.net/php/get_version.php?type_id=1" | jq '.versions | sort_by(-(.version_id | tonumber))') dbg_windows "${WINDOWS_VERSIONS}" - LATEST_WINDOWS_VERSION=$(echo "${WINDOWS_VERSIONS}" | jq -c 'map(select(.name | contains("Windows '${RELEASE}'")))['${INDEX}']') + LATEST_WINDOWS_VERSION=$(echo "${WINDOWS_VERSIONS}" | jq -c 'map(select(.name | contains("Windows '"${RELEASE}"'")))['${INDEX}']') dbg_windows "${LATEST_WINDOWS_VERSION}" WINDOWS_NAME=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .name) @@ -1883,11 +1883,11 @@ function get_windows() { 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');; + 10|11) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows '"${RELEASE}"'").edition_id');; esac dbg_windows "${EDITION_ID}" - 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') + 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_EDITION}"'").language_id') dbg_windows "${LANGUAGE_ID}" ARCH_INFO=$(wget -q -O- "https://tb.rg-adguard.net/php/get_arch.php?language_id=${LANGUAGE_ID}") dbg_windows "${ARCH_INFO}" @@ -2005,7 +2005,7 @@ if [ -n "${2}" ]; then elif [ "${OS}" == "windows" ]; then LANG="English International" if [ -n "${3}" ]; then - EDITION="${3}" + LANG="${3}" if [[ ! ${LANGS[*]} =~ "${LANG}" ]]; then echo -e "ERROR! ${LANG} is not a supported Windows language:\n" for LANG in "${LANGS[@]}"; do From 2d271e3176e37b7bce86499a62d646a85c87537d Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 22 Feb 2022 02:28:04 +0000 Subject: [PATCH 2/6] Tidy up the KolibriOS support --- quickemu | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/quickemu b/quickemu index 5530eee..4c46658 100755 --- a/quickemu +++ b/quickemu @@ -488,9 +488,6 @@ function vm_boot() { fi MACHINE_TYPE="pc" NET_DEVICE="rtl8139" - if [ -z "${disk_size}" ]; then - disk_size="256M" - fi ;; macos) #https://www.nicksherlock.com/2020/06/installing-macos-big-sur-on-proxmox/ @@ -927,13 +924,6 @@ function vm_boot() { args+=(-drive if=floppy,format=raw,file="${floppy}") fi - # Since there is bug (probably) in KolibriOS: cdrom indexes 0 or 1 make system show an extra unexisting iso, so we use index=2 - if [ -n "${iso}" ] && [ "${guest_os}" == "kolibrios" ]; then - # shellcheck disable=SC2054 - args+=(-drive media=cdrom,index=2,file="${iso}") - iso="" - fi - if [ -n "${iso}" ]; then # shellcheck disable=SC2054 args+=(-drive media=cdrom,index=0,file="${iso}") @@ -944,8 +934,13 @@ function vm_boot() { args+=(-drive media=cdrom,index=1,file="${fixed_iso}") fi - # Attach the unattended configuration to Windows guests when booting from ISO - if [ -n "${iso}" ] && [ "${guest_os}" == "windows" ] && [ -e "${VMDIR}/unattended.iso" ]; then + if [ -n "${iso}" ] && [ "${guest_os}" == "kolibrios" ]; then + # Since there is bug (probably) in KolibriOS: cdrom indexes 0 or 1 make system show an extra unexisting iso, so we use index=2 + # shellcheck disable=SC2054 + args+=(-drive media=cdrom,index=2,file="${iso}") + iso="" + elif [ -n "${iso}" ] && [ "${guest_os}" == "windows" ] && [ -e "${VMDIR}/unattended.iso" ]; then + # Attach the unattended configuration to Windows guests when booting from ISO # shellcheck disable=SC2054 args+=(-drive media=cdrom,index=2,file="${VMDIR}/unattended.iso") fi From 6694a3af5ff41b24b0070841a8e50cd449f62d45 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 22 Feb 2022 02:37:44 +0000 Subject: [PATCH 3/6] Test for Windows and macOS before calculating available RAM Prevents throwing a syntax error when launching KolibriOS. --- quickemu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quickemu b/quickemu index 4c46658..398b6d6 100755 --- a/quickemu +++ b/quickemu @@ -328,8 +328,8 @@ function vm_boot() { fi echo ", ${RAM_VM} RAM" - if [ "${RAM_VM//G/}" -lt 4 ]; then - if [ "${guest_os}" == "macos" ] || [ "${guest_os}" == "windows" ]; then + if [ "${guest_os}" == "macos" ] || [ "${guest_os}" == "windows" ]; then + if [ "${RAM_VM//G/}" -lt 4 ]; then echo "ERROR! You have insufficient RAM to run ${guest_os} in a VM" exit 1 fi From df4442a63839d27258cd2229322330819e3d843e Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 22 Feb 2022 09:43:54 +0000 Subject: [PATCH 4/6] White space clean up --- quickget | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/quickget b/quickget index a17361b..eb7324e 100755 --- a/quickget +++ b/quickget @@ -1947,9 +1947,9 @@ if [ -n "${1}" ]; then 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 + WHERE=$(dirname "${BASH_SOURCE[0]}") + "${WHERE}/quickemu" --version + exit 0 fi else echo "ERROR! You must specify an operating system." @@ -1959,9 +1959,9 @@ else fi if [[ ! $(os_support) =~ ${OS} ]]; then - echo -e "ERROR! ${OS} is not a supported OS.\n" - os_support - exit 1 + echo -e "ERROR! ${OS} is not a supported OS.\n" + os_support + exit 1 fi if [ -n "${2}" ]; then From 5cf883a73a92e1454fca3bdf374b1421f8024ad8 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 22 Feb 2022 09:44:56 +0000 Subject: [PATCH 5/6] Use consistent ISO derivation in get_tails() --- quickget | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickget b/quickget index eb7324e..22befaf 100755 --- a/quickget +++ b/quickget @@ -1453,7 +1453,7 @@ function get_tails() { RELEASE_JSON="$(wget -q -O- "${RELEASE_JSON_URL}")" URL=$(echo "${RELEASE_JSON}" | jq -r '.installations[0]."installation-paths"[]|select(.type=="iso")|."target-files"[0].url') HASH=$(echo "${RELEASE_JSON}" | jq -r '.installations[0]."installation-paths"[]|select(.type=="iso")|."target-files"[0].sha256') - ISO=$(echo "${URL}" | sed -e "s/.*\/\([^\/]*\)$/\1/") + ISO="${URL##*/}" web_get "${URL}" "${VM_PATH}" check_hash "${ISO}" "${HASH}" make_vm_config "${ISO}" From 3ef1bfa003885c1f93ff903481cb1aabc4fb6f7e Mon Sep 17 00:00:00 2001 From: Alan Pope Date: Tue, 22 Feb 2022 12:53:05 +0000 Subject: [PATCH 6/6] switch to version numbers fixes #376 (#377) --- quickget | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/quickget b/quickget index 22befaf..7e9a18b 100755 --- a/quickget +++ b/quickget @@ -514,10 +514,10 @@ function releases_tails() { } function releases_ubuntu() { - echo bionic \ - focal \ - hirsute \ - impish \ + echo 18.04 \ + 20.04 \ + 21.04 \ + 21.10 \ devel \ canary }