From a43aff6abccfc1f9d3154bfbf2f978d90faf6a19 Mon Sep 17 00:00:00 2001 From: zenobit Date: Thu, 14 Dec 2023 01:57:23 +0100 Subject: [PATCH] quickfzf 0.3 --- quickfzf | 319 +++++++++++++++++++++++++++++++ quickget | 569 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 884 insertions(+), 4 deletions(-) create mode 100755 quickfzf diff --git a/quickfzf b/quickfzf new file mode 100755 index 0000000..8d17dc6 --- /dev/null +++ b/quickfzf @@ -0,0 +1,319 @@ +#!/usr/bin/bash + +# Author: zenobit +# Description: Uses fzf to provide a simple TUI for quickemu and quickget +# License MIT + +tui_define_variables() { + progname="${progname:="${0##*/}"}" + version='0.3' + #EDITOR='nano' + configdir="$HOME/.config/$progname" + vms=(*.conf) + TMP="/tmp/$progname" + # Set traps to catch the signals and exit gracefully + trap 'exit' INT + trap 'exit' EXIT + # Dependency check: check if fzf,quickemu is installed and can be executed + if ! command -v quickemu >/dev/null 2>&1; then + echo 'You are missing quickemu...' && exit 1 + fi + QUICKGET=$(command -v quickget) || exit 2 + if ! command -v fzf >/dev/null 2>&1; then + echo 'You are missing fzf...' && exit 3 + fi + qcommand="quickemu < ${configdir}/command -vm" +} + +tui_display_header() { + printf 'Simple TUI for quickemu\n%s: v.%s\nquickemu: v.%s\n' "$progname" "$version" "$(quickemu --version)" + if [ -z "$EDITOR" ]; then + echo 'editor: Not set! edit configs will not work!' + else + echo "editor: $EDITOR" + fi + printf 'Workdir:\n %s\n' "$(pwd)" + if [ -f "${configdir}/command" ]; then + printf '\ncustom command:\n quickemu %s\n' "$(cat "${configdir}/command")" + fi + if [ -f "${configdir}/vm" ]; then + printf '\nVMs config:\n-------------\n%s\n' "$(cat "${configdir}/vm")" + fi + printf '\nPrepared VMs:\n-------------\n' +} + +tui_print_available_VMs() { + if [ ${#vms[@]} -eq 0 ]; then + echo 'No VMs found.' + exit 1 + else + printf '%s\n' "${vms[@]%.*}" + echo '-------------' + printf 'Press CTRL+c anytime to kill %s' "$progname" + fi +} + +tui_action_prompt_fzf() { + start=$(printf "Do you want to... +run VM +create new VM +open distro homepage +advanced & settings" | fzf --height 10% --layout=reverse --info=inline --header-lines=1) + case $start in + c|'create new VM' ) todo='create';; + a|'advanced & settings' ) todo='advanced';; + r|'run VM' ) todo='run';; + h|'open distro homepage' ) todo='homepage';; + esac +} + +fzf_get_releases() { + release=$(echo "$choices" | grep 'Releases' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Release') +} + +fzf_get_editions() { + edition=$(echo "$choices" | grep 'Editions' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose Edition') +} + +tui_create_VM() { + os=$("$QUICKGET" | awk 'NR==2,/zorin/' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose OS to download') + choices=$("$QUICKGET" "$os" | sed 1d) + # Get the release and edition to download, if necessary + if [ -z "$os" ]; then exit 100 + elif [ "$(echo "$choices" | wc -l)" = 1 ]; then + fzf_get_releases || exit 101 + printf '\n Trying to download %s %s...\n\n' "$os" "$release" + "$QUICKGET" "$os" "$release" || exit 104 + cat "${configdir}/vm" >> $(ls -t | head -n1) + else + fzf_get_releases || exit 102 + fzf_get_editions || exit 103 + printf '\n Trying to download %s %s %s...\n\n' "$os" "$release" "$edition" + "$QUICKGET" "$os" "$release" "$edition" || exit 105 + echo "${configdir}/vm" >> ./"$(ls -t | head -n1)" + fi +} + +tui_edit_default_VMs_config() { + printf 'For example:\ncpu_cores="2"\nram="4G"\n' + ${EDITOR} ${configdir}/vm +} + +fzf_edit_VM_config() { + find *.conf | fzf --cycle --header='Choose config to edit' --height 10% --layout=reverse --info=inline --preview 'cat {}' --bind 'enter:become($EDITOR {})' || exit 104 +} + +fzf_custom_quickemu_command() { + custom=$(echo "edit delete"| grep -o '[^ ]*' | fzf --cycle --header='Edit or delete custom command?') +} + +tui_custom_quickemu_command() { + fzf_custom_quickemu_command + if [ "$custom" = "edit" ]; then + quickemu + printf '\nEnter quickemu custom command:\n For example:--public-dir ~/Downloads\n:' + read -r command + mkdir -p "$configdir" + echo "$command" > "${configdir}/command" + elif [ "$custom" = "delete" ]; then + rm "${configdir}/command" + fi +} + +tui_choose_VM_to_run() { + chosen=$(printf '%s\n' "${vms[@]%.*}" | fzf --cycle --header='Choose VM to run' --height 50% --layout=reverse --info=inline --preview 'cat {}.conf') +} + +tui_run_VM() { + printf '\n Starting %s...\n\n' "$chosen" + if [ -f "${configdir}/command" ]; then + quickemu < "${configdir}/command" -vm "$chosen".conf + else + quickemu -vm "$chosen".conf + fi +} + +quickget_add_distro() { + echo "for now with yad only" #TODO + yad --form --field="Pretty name" "" --field="Name" "" --field="Releases" "" --field="Editions" "" --field="URL" "" --field="ISO" "" --field="Checksum file" "" > "${TMP}/template" + PRETTY_NAME="$(cat "${TMP}/template" | cut -d'|' -f1)" + NAME="$("${TMP}/template" > cut -d'|' -f2)" + RELEASES="$(cat "${TMP}/template" | cut -d'|' -f3)" + EDITIONS="$(cat "${TMP}/template" | cut -d'|' -f4)" + URL="$(cat "${TMP}/template" | cut -d'|' -f5)" + ISO="$(cat "${TMP}/template" | cut -d'|' -f6)" + CHECKSUM_FILE="$(cat "${TMP}/template" | cut -d'|' -f7)" + cat < "${TMP}/template" +#32 + +$NAME) PRETTY_NAME="$PRETTY_NAME";; + +#line 184+ + +$NAME \\ + +#line 262+ + +function releases_$NAME() { +echo $RELEASES +} + +function editions_$NAME() { +echo $EDITIONS +} + +#line 1052+ + +function get_$NAME() { +local EDITION="\${1:-}" +local HASH="" +local ISO="$ISO" +local URL="$URL" +HASH="\$(wget -q -O- \${URL}/\${CHECKSUM_FILE} | grep (\${ISO} | cut -d' ' -f4)" +echo "\${URL}/\${ISO}" "\${HASH}" +} + +EOF + diff "${TMP}/template" "quickget" +} + +function quickget_get_releases_and_editions() { + result=$(quickget "$os" | sed 1d | cut -d':' -f2) + releases=$(echo "$result" | head -1) + editions=$(echo "$result" | tail -1) +} + +function desktop_entry_create() { + cat < "${DESKTOP_FILE}" +[Desktop Entry] +Version=$version +Type=$type +Name=$name +GenericName=$progname +Comment=$comment +Exec=$execmd +Icon=$icon +Terminal=$terminal +X-MultipleArgs=$args +Type=$type +Categories=$categories +StartupNotify=$notify +MimeType=$mime +Keywords=$keyword + +EOF +} + +quickget_test_download_ISOs() { + rm -r "${TMP}" + mkdir -p "$TMP" && cd "$TMP" + touch "${TMP}/test" + "$QUICKGET" | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > supported + while read -r get_name; do + echo "Trying $get_name..." + mkdir -p "${TMP}/_distros/$get_name" && cd "${TMP}/_distros/$get_name" + releases=$("$QUICKGET" "$get_name" | grep 'Releases' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//') + echo "$releases" > releases + editions=$("$QUICKGET" "$get_name" | grep 'Editions' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//') + echo "$editions" > editions + if [ -z "$editions" ]; then + for release in $releases; do + echo "$get_name" >> "${TMP}/test" + "$QUICKGET" -t "$get_name" "${release}" >> "${TMP}/test" + done + else + while read -r release; do + for edition in $editions; do + echo "$get_name" >> "${TMP}/test" + "$QUICKGET" -t "$get_name" "${release}" "${edition}" >> "${TMP}/test" + done + done < releases + fi + cd "$TMP" + done < supported + printf "\nDone" +} + +quickget_show_ISOs_urls(){ + rm -r "${TMP}" + mkdir -p "$TMP" && cd "$TMP" + touch "${TMP}/test" + "$QUICKGET" | sed 1d | cut -d':' -f2 | grep -o '[^ ]*' > supported + while read -r get_name; do + echo "Trying $get_name..." + mkdir -p "${TMP}/_distros/$get_name" && cd "${TMP}/_distros/$get_name" + releases=$("$QUICKGET" "$get_name" | grep 'Releases' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//') + echo "$releases" > releases + editions=$("$QUICKGET" "$get_name" | grep 'Editions' | cut -d':' -f2 | sed 's/^ //' | sed 's/ *$//') + echo "$editions" > editions + if [ -z "$editions" ]; then + for release in $releases; do + echo "$get_name" >> "${TMP}/test" + timeout 3 "$QUICKGET" -s "$get_name" "${release}" >> "${TMP}/test" && $(killall zsync >> /dev/null) + done + else + while read -r release; do + for edition in $editions; do + echo "$get_name" >> "${TMP}/test" + timeout 3 "$QUICKGET" -s "$get_name" "${release}" "${edition}" >> "${TMP}/test" && $(killall zsync >> /dev/null) + done + done < releases + fi + cd "$TMP" + done < supported + printf "\nDone" +} + +quickget_open_distro_homepage(){ + os=$("$QUICKGET" | awk 'NR==2,/zorin/' | cut -d':' -f2 | grep -o '[^ ]*' | fzf --cycle --header='Choose distro homepage to open') + "$QUICKGET" -o "${os}" +} + +tui_advanced_menu() { + advance=$(printf "Do you want to... +default VMs config +edit VM config +quickemu custom command +quickget add distro +quickget test ISOs URLs +quickget show ISOs URLs" | fzf --height 10% --layout=reverse --info=inline --header-lines=1) + case $advance in + 'default VMs config' ) tui_edit_default_VMs_config;; + 'edit VM config' ) fzf_edit_VM_config;; + 'quickemu custom command' ) tui_custom_quickemu_command;; + 'quickget add distro' ) quickget_add_distro;; + 'quickget test ISOs URLs' ) quickget_test_download_ISOs;; + 'quickget show ISOs URLs' ) quickget_show_ISOs_urls;; + esac +} + +tui_what_to_do() { + if [ "$#" -eq "1" ]; then + todo="$1" + fi + case $todo in + advanced ) tui_advanced_menu;; + create ) tui_create_VM || exit 200;; + edit ) tui_edit_VM_config || exit 201;; + custom ) tui_custom_quickemu_command || exit 202;; + homepage ) quickget_open_distro_homepage || exit 203;; + run ) + tui_choose_VM_to_run || exit 204 + tui_run_VM || exit 205 + ;; + esac +} + +tui_run() { + tui_define_variables || exit 4 + tui_display_header || exit 5 + tui_print_available_VMs || exit 6 + tui_action_prompt_fzf || exit 7 + tui_what_to_do || exit 8 +} + +while true +do + tui_run + exit 0 +done diff --git a/quickget b/quickget index 4ea03d1..f8c75c2 100755 --- a/quickget +++ b/quickget @@ -55,15 +55,24 @@ function pretty_name() { local PRETTY_NAME="" SIMPLE_NAME="${1}" case ${SIMPLE_NAME} in + agarimos) PRETTY_NAME="AgarimOS";; alma) PRETTY_NAME="Alma Linux";; alpine) PRETTY_NAME="Alpine Linux";; android) PRETTY_NAME="Android x86";; archlinux) PRETTY_NAME="Arch Linux";; archcraft) PRETTY_NAME="Archcraft";; arcolinux) PRETTY_NAME="Arco Linux";; + artixlinux) PRETTY_NAME="Artix Linux";; + atheanos) PRETTY_NAME="Athena OS";; + biglinux) PRETTY_NAME="BigLinux";; blendos) PRETTY_NAME="BlendOS";; + bodhi) PRETTY_NAME="Bodhi Linux";; cachyos) PRETTY_NAME="CachyOS";; centos-stream) PRETTY_NAME="CentOS Stream";; + cereus) PRETTY_NAME="Cereus Linux";; + chimera) PRETTY_NAME="Chimera Linux";; + devuan) PRETTY_NAME="Devuan";; + dietpi) PRETTY_NAME="DietPi";; dragonflybsd) PRETTY_NAME="DragonFlyBSD";; easyos) PRETTY_NAME="EasyOS";; elementary) PRETTY_NAME="elementary OS";; @@ -71,6 +80,8 @@ function pretty_name() { endless) PRETTY_NAME="Endless OS";; freebsd) PRETTY_NAME="FreeBSD";; freedos) PRETTY_NAME="FreeDOS";; + fvoid) PRETTY_NAME="F-Void";; + gabeeos) PRETTY_NAME="gabeeOS Linux";; garuda) PRETTY_NAME="Garuda Linux";; ghostbsd) PRETTY_NAME="GhostBSD";; holoiso) PRETTY_NAME="SteamOS HoloISO";; @@ -80,6 +91,7 @@ function pretty_name() { linuxmint) PRETTY_NAME="Linux Mint";; lmde) PRETTY_NAME="Linux Mint Debian Edition";; mageia) PRETTY_NAME="Mageia";; + miyo) PRETTY_NAME="Miyo Linux";; mxlinux) PRETTY_NAME="MX Linux";; netboot) PRETTY_NAME="netboot.xyz";; netbsd) PRETTY_NAME="NetBSD";; @@ -91,12 +103,17 @@ function pretty_name() { oraclelinux) PRETTY_NAME="Oracle Linux";; peppermint) PRETTY_NAME="PeppermintOS";; popos) PRETTY_NAME="Pop!_OS";; + pureos) PRETTY_NAME="PureOS";; reactos) PRETTY_NAME="ReactOS";; rebornos) PRETTY_NAME="RebornOS";; rockylinux) PRETTY_NAME="Rocky Linux";; + slitaz) PRETTY_NAME="SliTaz GNU/Linux";; + sparkylinux) PRETTY_NAME="SparkyLinux";; + spiral) PRETTY_NAME="SpiralLinux";; tinycore) PRETTY_NAME="Tiny Core Linux";; truenas-core) PRETTY_NAME="TrueNAS Core";; truenas-scale) PRETTY_NAME="TrueNAS Scale";; + tuxedoos) PRETTY_NAME="TuxedoOS";; ubuntu-budgie) PRETTY_NAME="Ubuntu Budgie";; ubuntucinnamon) PRETTY_NAME="Ubuntu Cinnamon";; ubuntukylin) PRETTY_NAME="Ubuntu Kylin";; @@ -105,7 +122,9 @@ function pretty_name() { ubuntustudio) PRETTY_NAME="Ubuntu Studio";; ubuntu-unity) PRETTY_NAME="Ubuntu Unity";; vanillaos) PRETTY_NAME="Vanilla OS";; + ventoy) PRETTY_NAME="Ventoy";; void) PRETTY_NAME="Void Linux";; + voidpup) PRETTY_NAME="Void Puppy";; vxlinux) PRETTY_NAME="VX Linux";; xerolinux) PRETTY_NAME="XeroLinux";; zorin) PRETTY_NAME="Zorin OS";; @@ -203,22 +222,31 @@ function list_csv() { } function os_support() { - echo alma \ + echo agarimos \ + alma \ alpine \ android \ antix \ archlinux \ archcraft \ arcolinux \ + antix \ + artixlinux \ + athenaos \ batocera \ + bazzite \ + biglinux \ blendos \ bodhi \ bunsenlabs \ cachyos \ centos-stream \ + cereus \ + chimeralinux \ debian \ deepin \ devuan \ + dietpi \ dragonflybsd \ easyos \ edubuntu \ @@ -228,6 +256,8 @@ function os_support() { fedora \ freebsd \ freedos \ + fvoid \ + gabeeos \ garuda \ gentoo \ ghostbsd \ @@ -242,6 +272,7 @@ function os_support() { lmde \ mageia \ manjaro \ + miyo \ mxlinux \ netboot \ netbsd \ @@ -260,13 +291,17 @@ function os_support() { rockylinux \ siduction \ slackware \ + slax \ + slitaz \ solus \ + sparkylinux \ spiral \ tails \ tinycore \ trisquel \ truenas-core \ truenas-scale \ + tuxedoos \ ubuntu \ ubuntu-budgie \ ubuntucinnamon \ @@ -276,7 +311,9 @@ function os_support() { ubuntustudio \ ubuntu-unity \ vanillaos \ + ventoy \ void \ + voidpup \ vxlinux \ windows \ xerolinux \ @@ -289,6 +326,7 @@ function os_homepages(){ local HOMEPAGE="" SIMPLE_NAME="${1}" case ${SIMPLE_NAME} in + agarimos) HOMEPAGE="https://sourceforge.net/projects/agarimos/";; alma) HOMEPAGE="https://almalinux.org/";; alpine) HOMEPAGE="https://alpinelinux.org/";; android) HOMEPAGE="https://www.android-x86.org/";; @@ -296,15 +334,22 @@ function os_homepages(){ archlinux) HOMEPAGE="https://archlinux.org/";; archcraft) HOMEPAGE="https://archcraft.io/";; arcolinux) HOMEPAGE="https://arcolinux.com/";; + artixlinux) HOMEPAGE="https://artixlinux.com/";; + athenaos) HOMEPAGE="https://athenaos.org/";; batocera) HOMEPAGE="https://batocera.org/";; + bazzite) HOMEPAGE="https://bazzite.gg/";; + biglinux) HOMEPAGE="https://www.biglinux.com.br/";; blendos) HOMEPAGE="https://blendos.co/";; bodhi) HOMEPAGE="https://www.bodhilinux.com/";; bunsenlabs) HOMEPAGE="https://www.bunsenlabs.org/";; cachyos) HOMEPAGE="https://cachyos.org/";; centos-stream) HOMEPAGE="https://www.centos.org/centos-stream/";; + cereues) HOMEPAGE="https://cereus-linux.sourceforge.io/";; + chimeralinux) HOMEPAGE="https://chimera-linux.org/";; debian) HOMEPAGE="https://www.debian.org/";; deepin) HOMEPAGE="https://www.deepin.org/";; devuan) HOMEPAGE="https://www.devuan.org/";; + dietpi) HOMEPAGE="https://dietpi.com/";; dragonflybsd) HOMEPAGE="https://www.dragonflybsd.org/";; easyos) HOMEPAGE="https://easyos.org/";; edubuntu) HOMEPAGE="https://www.edubuntu.org/";; @@ -314,6 +359,8 @@ function os_homepages(){ fedora) HOMEPAGE="https://www.fedoraproject.org/";; freebsd) HOMEPAGE="https://www.freebsd.org/";; freedos) HOMEPAGE="https://freedos.org/";; + fvoid) HOMEPAGE="https://f-void.sourceforge.io/";; + gabeeos) HOMEPAGE="https://gabeeoslinux.sourceforge.io/";; garuda) HOMEPAGE="https://garudalinux.org/";; gentoo) HOMEPAGE="https://www.gentoo.org/";; ghostbsd) HOMEPAGE="https://www.ghostbsd.org/";; @@ -329,6 +376,7 @@ function os_homepages(){ mageia) HOMEPAGE="https://www.mageia.org/";; manjaro) HOMEPAGE="https://manjaro.org/";; mxlinux) HOMEPAGE="https://mxlinux.org/";; + miyo) HOMEPAGE="https://miyolinux.sourceforge.io/";; netboot) HOMEPAGE="https://netboot.xyz/";; netbsd) HOMEPAGE="https://www.netbsd.org/";; nixos) HOMEPAGE="https://nixos.org/";; @@ -346,13 +394,17 @@ function os_homepages(){ rockylinux) HOMEPAGE="https://rockylinux.org/";; siduction) HOMEPAGE="https://siduction.org/";; slackware) HOMEPAGE="http://www.slackware.com/";; + slax) HOMEPAGE="https://www.slax.org/";; + slitaz) HOMEPAGE="https://www.slitaz.org/";; solus) HOMEPAGE="https://getsol.us/";; + sparkylinux) HOMEPAGE="https://sparkylinux.org/";; spiral) HOMEPAGE="https://spirallinux.github.io/";; tails) HOMEPAGE="https://tails.net/";; tinycore) HOMEPAGE="http://www.tinycorelinux.net/";; trisquel) HOMEPAGE="https://trisquel.info/";; truenas-core) HOMEPAGE="https://www.truenas.com/truenas-core/";; truenas-scale) HOMEPAGE="https://www.truenas.com/truenas-scale/";; + tuxedoos) HOMEPAGE="https://www.tuxedocomputers.com/en/TUXEDO-OS_1.tuxedo";; ubuntu) HOMEPAGE="https://ubuntu.com/";; ubuntu-budgie) HOMEPAGE="https://ubuntubudgie.org/";; ubuntucinnamon) HOMEPAGE="https://ubuntucinnamon.org/";; @@ -362,7 +414,9 @@ function os_homepages(){ ubuntustudio) HOMEPAGE="https://ubuntustudio.org/";; ubuntu-unity) HOMEPAGE="https://ubuntuunity.org/";; vanillaos) HOMEPAGE="https://vanillaos.org/";; + ventoy) HOMEPAGE="https://www.ventoy.net/";; void) HOMEPAGE="https://voidlinux.org/";; + voidpup) HOMEPAGE="https://sourceforge.net/projects/vpup/";; vxlinux) HOMEPAGE="https://vxlinux.org/";; windows) HOMEPAGE="https://www.microsoft.com/en-us/windows/";; xerolinux) HOMEPAGE="https://xerolinux.xyz/";; @@ -372,6 +426,138 @@ function os_homepages(){ echo "${HOMEPAGE}" } +# Not in upstream +function releases_agarimos() { + echo latest +} + +function editions_agarimos() { + echo plasma xfce lxqt gnome +} + +function releases_artixlinux() { + echo stable +} + +function editions_artixlinux() { + echo base-dinit base-openrc base-runit base-s6 cinnamon-dinit cinnamon-openrc cinnamon-runit cinnamon-s6 lxde-dinit lxde-openrc lxde-runit lxde-s6 lxqt-dinit lxqt-openrc lxqt-runit lxqt-s6 mate-dinit mate-openrc mate-runit mate-s6 plasma-dinit plasma-openrc plasma-runit plasma-s6 xfce-dinit xfce-openrc xfce-runit xfce-s6 community-gtk-openrc community-qt-openrc +} + +function releases_athenaos() { + echo 23.06.23 +} + +function releases_batocera() { + echo latest +} + +function releases_bazzite() { + echo $(wget -q -O- "https://api.github.com/repos/ublue-os/bazzite/releases" | grep 'download_url' | grep 'sum' | cut -d '/' -f8 | cut -d'v' -f2 | tr '\n' ' ') +} + +function releases_biglinux() { + echo kde +} + +function releases_blendos() { +# Pull the rss feed +wget -q https://sourceforge.net/projects/blendos/rss?path=/ISOs/ -O- | grep -E -o 'https://.*blendOS\.iso.*/tmp/blendos-isos.rss + + local RLIST + RLIST=$(grep -E -o 'https://.*blendOS\.iso.*> "${CONF_FILE}" echo "ram=\"128M\"" >> "${CONF_FILE}" ;; + slitaz) + echo "boot=\"legacy\"" >> "${CONF_FILE}" + echo "disk_size=\"4G\"" >> "${CONF_FILE}" + echo "ram=\"512M\"" >> "${CONF_FILE}" + ;; truenas-scale|truenas-core) echo "boot=\"legacy\"" >> "${CONF_FILE}" # the rest is non-functional @@ -1153,6 +1344,366 @@ EOF exit 0 } +# QUICKEMU-EXTENDED ONLY DISTROS! + +function get_agarimos() { + local EDITION="${1:-}" + local HASH="" + local ISO="" + local URL="" + #local DATE="" + #local KERNEL="" + case ${EDITION} in + gnome) + URL="https://sourceforge.net/projects/agarimos/files/Gnome" + ISO="AgarimOS-Gnome-Catppuccin-Liv-x86_64-6.5.12_1-20231130.iso" + ;; + plasma) + URL="https://sourceforge.net/projects/agarimos/files/Plasma" + ISO="AgarimOS-Plasma-Dracula-Live-x86_64-6.5.11_1-20231120.iso" + ;; + xfce) + URL="https://sourceforge.net/projects/agarimos/files/XFCE4" + ISO="AgarimOS-XFCE4-Catppuccin-Live-x86_64-6.5.12_1-20231122.iso" + ;; + lxqt) + URL="https://sourceforge.net/projects/agarimos/files/LXQT-KWIN" + ISO="AgarimOS-LXQT-KWIN-Dracula-Live-x86_64-6.5.12_1-20231121.iso" + ;; + esac + + HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1) + echo "${URL}/${ISO} ${HASH}" +} + +function get_artixlinux() { + local EDITION="${1:-}" + local HASH="" + local ISO="" + local URL="https://iso.artixlinux.org/iso" + DATE=$(wget -q -O- ${URL}/sha256sums | cut -d'-' -f4 | head -1) + ISO="artix-${EDITION}-${DATE}-x86_64.iso" + HASH=$(wget -q -O- ${URL}/sha256sums | grep "${ISO}") + echo "${URL}/${ISO} ${HASH}" +} + +function get_athenaos() { + local HASH="" + local URL="" + local TMPURL="" + local ISO="athena-2023.06.23-x86_64.iso" + TMPURL=$(wget -q -S -O- --max-redirect=0 "https://sourceforge.net/projects/athena-iso/files/v23.06.23/${ISO}/download" 2>&1 | grep -i Location | cut -d' ' -f4) + URL=${TMPURL%\?*} + echo "${URL} ${HASH}" +} + +function get_batocera() { + local HASH="" + local URL="https://mirrors.o2switch.fr/batocera/x86_64/stable/last" + local ISO="$(curl -sl ${URL}/ | grep -e 'batocera.*img.gz'|cut -d\" -f2)" + echo "${URL}/${ISO} ${HASH}" +} + +function get_bazzite() { + local HASH="" + local ISO="" + local URL="https://github.com/ublue-os/bazzite/releases/download/v${RELEASE}" + + ISO=$(wget -q -O- "https://api.github.com/repos/ublue-os/bazzite/releases" | grep 'download_url' | grep 'sum' | cut -d '"' -f4 | cut -d'.' -f1-5 | grep "${RELEASE}" | cut -d'/' -f9) + HASH=$(wget -q -O- "${URL}/${ISO}.sha256sum" | grep 'SHA256' | cut -d' ' -f4) + echo "${URL}/${ISO} ${HASH}" +} + +function get_biglinux() { + local HASH="" + local ISO="" + local URL="https://iso.biglinux.com.br/" + ISO=$(grep -Eo 'biglinux_[0-9]{4}(-[0-9]{2}){2}_k[0-9]{2,3}.iso' <(wget -q -O- ${URL}) | sort -u | tail -n2 | head -n1) + HASH=$(curl -s ${URL}${ISO}.md5 | grep -Eo '[[:alnum:]]{32}') + echo "${URL}${ISO} ${HASH}" +} + +function get_cereus() { + local EDITION="${1:-}" + local HASH="" + local DATE="" + local ISO="" + local URL="https://sourceforge.net/projects/cereus-linux/files/isos/beta/latest/${EDITION}" + DATE=$(wget -q -O- https://sourceforge.net/projects/cereus-linux/files/isos/beta/latest/base/SHA256SUM | grep 'x86_64-base' | rev | cut -d'-' -f1 | rev | cut -d'.' -f1-3) + ISO="cereus-beta-live-x86_64-${EDITION}-${DATE}.iso" + case ${EDITION} in + base) HASH=$(wget -q -O- "${URL}/SHA256SUM" | grep "${ISO}" | cut -d' ' -f1);; + *) HASH=$(wget -q -O- "${URL}/SHA256" | grep "${ISO}" | cut -d' ' -f1);; + esac + echo "${URL}/${ISO} ${HASH}" +} + +function get_chimeralinux() { + local EDITION="${1:-}" + local HASH="" + local DATE="" + local ISO="" + local URL="https://repo.chimera-linux.org/live/${RELEASE}" + DATE=$(wget -q -O- "${URL}/sha256sums.txt" | head -n1 | cut -d'-' -f5) + ISO="chimera-linux-x86_64-LIVE-${DATE}-${EDITION}.iso" + HASH=$(wget -q -O- "${URL}/sha256sums.txt" | grep 'x86_64-LIVE' | grep "${EDITION}" | cut -d' ' -f1) + echo "${URL}/${ISO} ${HASH}" +} + +function get_dietpi() { + local HASH="" + local ISO="" + local URL="https://dietpi.com/downloads/images" + case ${RELEASE} in + bios) + case ${EDITION} in + bookworm) + local ISO="DietPi_NativePC-BIOS-x86_64-Bookworm.7z" + ;; + bullseye) + local ISO="DietPi_NativePC-BIOS-x86_64-Bullseye.7z" + ;; + bookworm-installer) + local ISO="DietPi_NativePC-BIOS-x86_64-Bookworm_Installer.7z" + ;; + bullseye-installer) + local ISO="DietPi_NativePC-BIOS-x86_64-Bullseye_Installer.7z" + ;; + esac + ;; + uefi) + case ${EDITION} in + bookworm-installer) + local ISO="DietPi_NativePC-UEFI-x86_64-Bookworm_Installer.7z" + ;; + bullseye-installer) + local ISO="DietPi_NativePC-UEFI-x86_64-Bullseye_Installer.7z" + ;; + esac + ;; + esac + HASH=$(wget -q -O- "${URL}/SHASUMS.txt" | grep "${ISO}" | cut -d' ' -f1) + echo "${URL}/${ISO} ${HASH}" +} + +function get_fvoid() { + local HASH="" + local URL="" + local TMPURL="" + TMPURL=$(wget -q -S -O- --max-redirect=0 "https://sourceforge.net/projects/f-void/files/latest/download" 2>&1 | grep -i Location | cut -d' ' -f4) + URL=${TMPURL%\?*} + echo "${URL} ${HASH}" +} + +function get_gabeeos() { + local HASH="" + local URL="" +# local TMPURL="" +# TMPURL=$(wget -q -S -O- --max-redirect=0 "https://sourceforge.net/projects/gabeeos/files/latest/download" 2>&1 | grep -i Location | cut -d' ' -f4) + case ${EDITION} in + openbox) + ISO="gabeeOSLinux-Openbox-Cherry-x86_64-6.1.25_1-20230502.iso" + URL="https://sourceforge.net/projects/gabeeoslinux/files/Distro/Openbox/beta" + HASH=$(wget -q -O- ${URL}/SHA256 | grep "${ISO}" | cut -d' ' -f2) + ;; + qtile) + ISO="gabeeOSLinux-Qtile-x86_64-6.1.25_1-20230508.iso" + URL="https://sourceforge.net/projects/gabeeoslinux/files/Distro/Qtile/beta" + HASH=$(wget -q -O- ${URL}/SHA256 | grep "${ISO}" | cut -d' ' -f4) + ;; + esac + echo "${URL}/${ISO} ${HASH}" +} + +function get_miyo() { + local EDITION="${1:-}" + local HASH="" + local URL="https://sourceforge.net/projects/miyolinux/files/${RELEASE}-Release/${EDITION}" + + case ${EDITION} in + Kwin) ISO="miyo-kwin-x86_64-BIOS-20220526.iso";; + Deboot-Ceres) ISO="Deboot-Ceres-x86-64-BIOS-20220415.iso";; + JWM) ISO="miyolinux-jwm-x86_64-BIOS-20220226.iso";; + Openbox) ISO="MiyoLinux-x86_64-BIOS-20220129.iso";; + MATE) ISO="mate-minimal-x86_64-BIOS-20220107.iso";; + esac + + HASH=$(wget -q -O- "${URL}/${ISO}.sha256" | cut -d' ' -f1) + echo "${URL}/${ISO} ${HASH}" +} + +function get_pureos() { + local EDITION="${1:-}" + local HASH="" + local ISO="" + local URL="" + case ${RELEASE} in + 9) + URL="https://downloads.puri.sm/9/live/${EDITION}/2020-08-06" + ISO="pureos-${RELEASE}-${EDITION}-live_20200806-amd64.hybrid.iso" + HASH=$(wget -q -O- "${URL}/checksums.sha256sum" | grep "${ISO}" | cut -d' ' -f1) + ;; + 10) + URL="https://downloads.puri.sm/10/${EDITION}/2023-06-14" + ISO="pureos-${RELEASE}-${EDITION}-live-20230614_amd64.iso" + HASH=$(wget -q -O- "${URL}/pureos-${RELEASE}-${EDITION}-live-20230614_amd64.checksums_sha256.txt" | head -1 | cut -d' ' -f1) + esac + echo "${URL}/${ISO} ${HASH}" +} + +function get_rebornos() { + local ISO=$(curl -s 'https://www.rebornos.org/download/' | grep -ohE 'https://pub-cb7a4d4f7a974896b3bf40c52d1defbc.r2.dev/RebornOS-ISO/(rebornos_xfce_minimal|rebornos_iso)-[0-9]{4}.[0-9]{2}.[0-9]{2}-x86_64.iso' | tail -n1) + local HASH=$(curl -s 'https://www.rebornos.org/download/' | grep -ozP 'Checksum MD5:.*[0-9a-fA-F]{32}' | grep -zoP '[0-9a-fA-F]{32}' | cut -d '' -f1) + echo "${ISO} ${HASH}" +} + +function get_slax() { + local HASH="" + local ISO="" + local URL="https://slax.org/download-slax.php?a=64bit&b=${EDITION}" + case ${EDITION} in + Debian) ISO="slax-64bit-11.6.0.iso" + HASH="b3771211c4485fec2e4f2418b06125f3e53424c5" + ;; + Slackware) ISO="slax-64bit-15.0.1.iso" + HASH="4ec9dff930251fbae847a56b18d53505147faf84" + ;; + esac + echo "${URL}/${ISO} ${HASH}" +} + +function get_slitaz() { + local HASH="" + local ISO="slitaz-rolling-${RELEASE}" + local URL="http://mirror.slitaz.org/iso/rolling" + case ${RELEASE} in + preferred) ISO="slitaz-rolling";; + *) ISO="slitaz-rolling-${RELEASE}";; + esac + HASH=$(wget -q -O- "${URL}/${ISO}.md5" | cut -d' ' -f1) + echo "${URL}/${ISO}.iso ${HASH}" +} + +function get_sparkylinux() { + local EDITION="${1:-}" + local HASH="" + local ISO="" + local URL="" + ISO="sparkylinux-${RELEASE}-x86_64-${EDITION}.iso" + case ${EDITION} in + minimalcli) URL="https://sourceforge.net/projects/sparkylinux/files/cli";; + minimalgui) URL="https://sourceforge.net/projects/sparkylinux/files/base";; + *) URL="https://sourceforge.net/projects/sparkylinux/files/${EDITION}";; + esac + HASH=$(wget -q -O- ${URL}/${ISO}.allsums.txt | head -2 | grep 'iso' | cut -d' ' -f1) + echo "${URL}/${ISO}" "${HASH}" +} + +function get_tuxedoos() { + local DATE="202309111354" + local HASH="" + local ISO="TUXEDO-OS-${RELEASE}-${DATE}.iso" + local URL="https://os.tuxedocomputers.com/" + HASH=$(wget -q -O- "${URL}/checksums" | grep "${ISO}" | cut -d' ' -f1) + echo "${URL}/${ISO} ${HASH}" +} + +function get_ventoy() { + local HASH="" + local ISO="ventoy-${RELEASE}-livecd.iso" + local URL="https://github.com/ventoy/Ventoy/releases/download/v${RELEASE}" + HASH="$(wget -q -O- "${URL}/sha256.txt" | grep "${ISO}" | cut -d' ' -f4)" + echo "${URL}/${ISO} ${HASH}" +} + +function get_voidpup() { + local HASH="" + local URL="" + local TMPURL="" + TMPURL=$(wget -q -S -O- --max-redirect=0 "https://sourceforge.net/projects/vpup/files/latest/download" 2>&1 | grep -i Location | cut -d' ' -f4) + URL=${TMPURL%\?*} + echo "${URL} ${HASH}" +} + +function get_slax() { + local HASH="" + local ISO="" + local URL="https://slax.org/download-slax.php?a=64bit&b=${EDITION}" + case ${EDITION} in + Debian) ISO="slax-64bit-11.6.0.iso" + HASH="b3771211c4485fec2e4f2418b06125f3e53424c5" + ;; + Slackware) ISO="slax-64bit-15.0.1.iso" + HASH="4ec9dff930251fbae847a56b18d53505147faf84" + ;; + esac + echo "${URL}/${ISO} ${HASH}" +} + +function get_slitaz() { + local HASH="" + local ISO="slitaz-rolling-${RELEASE}" + local URL="http://mirror.slitaz.org/iso/rolling" + case ${RELEASE} in + preferred) ISO="slitaz-rolling";; + *) ISO="slitaz-rolling-${RELEASE}";; + esac + HASH=$(wget -q -O- "${URL}/${ISO}.md5" | cut -d' ' -f1) + echo "${URL}/${ISO}.iso ${HASH}" +} + +function get_sparkylinux() { + local EDITION="${1:-}" + local HASH="" + local ISO="" + local URL="" + ISO="sparkylinux-${RELEASE}-x86_64-${EDITION}.iso" + case ${EDITION} in + minimalcli) URL="https://sourceforge.net/projects/sparkylinux/files/cli";; + minimalgui) URL="https://sourceforge.net/projects/sparkylinux/files/base";; + *) URL="https://sourceforge.net/projects/sparkylinux/files/${EDITION}";; + esac + HASH=$(wget -q -O- ${URL}/${ISO}.allsums.txt | head -2 | grep 'iso' | cut -d' ' -f1) + echo "${URL}/${ISO}" "${HASH}" +} + +function get_tuxedoos() { + local DATE="202309111354" + local HASH="" + local ISO="TUXEDO-OS-${RELEASE}-${DATE}.iso" + local URL="https://os.tuxedocomputers.com/" + HASH=$(wget -q -O- "${URL}/checksums" | grep "${ISO}" | cut -d' ' -f1) + echo "${URL}/${ISO} ${HASH}" +} + +function get_ventoy() { + local HASH="" + local ISO="ventoy-${RELEASE}-livecd.iso" + local URL="https://github.com/ventoy/Ventoy/releases/download/v${RELEASE}" + HASH="$(wget -q -O- "${URL}/sha256.txt" | grep "${ISO}" | cut -d' ' -f4)" + echo "${URL}/${ISO} ${HASH}" +} + +function get_voidpup() { + local HASH="" + local URL="" + local TMPURL="" + TMPURL=$(wget -q -S -O- --max-redirect=0 "https://sourceforge.net/projects/vpup/files/latest/download" 2>&1 | grep -i Location | cut -d' ' -f4) + URL=${TMPURL%\?*} + echo "${URL} ${HASH}" +} + +function get_vxlinux() { + local HASH="" + local ISO="vx-${RELEASE}.iso" + local URL="https://github.com/VX-Linux/main/releases/download/${RELEASE}" + + HASH=$(wget -q -O- "${URL}/vx-${RELEASE}.md5" | cut -d' ' -f1) + echo "${URL}/${ISO} ${HASH}" +} + +# QUICKEMU STANDARD + function get_alma() { local EDITION="${1:-}" local HASH="" @@ -2714,7 +3265,10 @@ create_vm() { bzip2 -d "${VM_PATH}/${ISO}" ISO="${ISO/.bz2/}" fi - + if [ ${OS} == "dietpi" ] && [[ $ISO =~ ".7z" ]]; then + 7zip x -o${VM_PATH} ${VM_PATH}/${ISO} + ISO=$(ls ${VM_PATH} | grep -i '.iso') + fi if [ ${OS} == "reactos" ] && [[ $ISO =~ ".zip" ]]; then unzip ${VM_PATH}/${ISO} -d ${VM_PATH} ISO=$(ls ${VM_PATH} | grep -i '.iso' | grep -v '.zip') @@ -2782,8 +3336,15 @@ if [ -n "${2}" ]; then exit 1 fi fi - - # Handle odd missing fedora cominations + # Handle odd missing dietpi combinations + if [[ $OS == dietpi ]] ; then + if [[ ${RELEASE} = "uefi" && ${EDITION} = "bookworm" ]] || [[ ${RELEASE} = "uefi" && ${EDITION} = "bullseye" ]] ; then + echo "ERROR! Unsupported combination" + echo "Only installers are supported for uefi, please choose another Release or Edition" + exit 1; + fi + fi + # 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"