From af7348caf6cdb1f5b386001b84f0d41b2daf276e Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Wed, 20 Oct 2021 23:22:35 +0100 Subject: [PATCH] Refactor, and enable, OpenBSD support --- quickemu | 3 --- quickget | 38 ++++++++++++++++++-------------------- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/quickemu b/quickemu index 5cb857d..4af3b9c 100755 --- a/quickemu +++ b/quickemu @@ -396,9 +396,6 @@ function vm_boot() { if [ "${guest_os}" == "freebsd" ]; then MOUSE="usb-mouse" fi - if [ "${guest_os}" == "openbsd" ]; then - OUTPUT="gtk" - fi if [ -z "${disk_size}" ]; then disk_size="16G" fi diff --git a/quickget b/quickget index a9dd279..5d3bc66 100755 --- a/quickget +++ b/quickget @@ -34,6 +34,7 @@ function pretty_name() { linuxmint-mate) PRETTY_NAME="Linux Mint MATE";; linuxmint-xfce) PRETTY_NAME="Linux Mint XFCE";; macos) PRETTY_NAME="macOS";; + openbsd) PRETTY_NAME="OpenBSD";; opensuse) PRETTY_NAME="openSUSE";; popos) PRETTY_NAME="Pop!_OS";; ubuntu-budgie) PRETTY_NAME="Ubuntu Budgie";; @@ -141,7 +142,7 @@ function releases_linuxmint(){ } function releases_openbsd(){ - echo 7_0 + echo 7.0 } function releases_opensuse(){ @@ -514,7 +515,7 @@ function make_vm_config() { elif [[ "${OS}" == *"linuxmint"* ]]; then GUEST="linux" IMAGE_TYPE="iso" - elif [[ "${OS}" == "openbsd" ]]; then + elif [ "${OS}" == "openbsd" ]; then GUEST="openbsd" IMAGE_TYPE="iso" elif [ "${OS}" == "opensuse" ]; then @@ -545,6 +546,10 @@ EOF echo "fixed_iso=\"${VM_PATH}/${ISO_FILE}\"" >> "${OS}-${RELEASE}.conf" fi + if [ "${OS}" == "openbsd" ]; then + echo "boot=\"legacy\"" >> "${OS}-${RELEASE}.conf" + fi + if [ "${OS}" == "macos" ]; then echo "macos_release=\"${RELEASE}\"" >> "${OS}-${RELEASE}.conf" fi @@ -620,26 +625,17 @@ function get_linuxmint() { } function get_openbsd() { + local HASH="" + local ISO="" local URL="" - local DL_BASE="https://cdn.openbsd.org/pub/OpenBSD/7.0/amd64/" - local VERSION="" - case ${RELEASE} in - 7_0) VERSION=${RELEASE//_/};; - *) - echo "ERROR! OpenBSD ${RELEASE} is not a supported release." - releases_openbsd - exit 1 - ;; - esac - - URL="${DL_BASE}/install${VERSION}.iso" - - ISO="install${VERSION}.iso" - make_vm_dir - web_get ${URL} ${VM_PATH} - make_vm_config ${ISO} - start_vm_info + 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_opensuse() { @@ -882,6 +878,8 @@ if [ -n "${2}" ]; then get_fedora elif [[ "${OS}" == *"linuxmint"* ]]; then get_linuxmint + elif [ "${OS}" == "openbsd" ]; then + get_openbsd elif [ "${OS}" == "opensuse" ]; then get_opensuse elif [ "${OS}" == "popos" ]; then