diff --git a/bin/.archived/qbth.bash b/bin/.archived/qbth.bash new file mode 100755 index 0000000..690770b --- /dev/null +++ b/bin/.archived/qbth.bash @@ -0,0 +1,227 @@ +#!/usr/bin/env bash + +# qbth - qbittorrent helper + +# Dependency check +missing_deps=() +for bin in "gum" "jq" "lynx" "parallel" "qbt"; do + if ! test -x "$(command -v $bin)"; then + missing_deps+=("$bin") + fi +done + +if (( "${#missing_deps[@]}" != 0 )); then + echo "Missing dependencies:" "${missing_deps[@]}" + exit 1 +fi + +# Add torrent +function add_torrents() { + torrents=("$@") + + if ! parallel qbt torrent add url --category "distro" ::: "${torrents[@]}"; then + gum log -l error "Error adding torrents" + exit 1 + fi + + for url in "${torrents[@]}"; do gum log -l info "Added" "$(basename "$url")"; done +} + +function delete_torrents() { + if test -n "$1"; then + echo "$1" | parallel "qbt torrent delete --with-files {}" + echo "$1" | xargs -I _ gum log -l info "Deleted" _ + else + gum log -l warn "Nothing to do." + fi +} + +export -f add_torrents +export -f delete_torrents + +distro_selection=$(gum choose --limit=1 --header="Available torrents" --height=13 "AlmaLinux" "Debian" "Devuan" "Fedora" "FreeBSD" "Kali Linux" "NetBSD" "NixOS" "Qubes" "Rocky Linux" "Tails") +action=$(gum choose --limit=1 --header="Choose an action: Add, Delete" "Add" "Delete") +relver=$(gum input --placeholder="Enter $distro_selection release version") + +case "$distro_selection" in + "AlmaLinux") + case "$action" in + "Add") + urls=( + "https://almalinux-mirror.dal1.hivelocity.net/${relver}/isos/aarch64/AlmaLinux-${relver}-aarch64.torrent" + "https://almalinux-mirror.dal1.hivelocity.net/${relver}/isos/ppc64le/AlmaLinux-${relver}-ppc64le.torrent" + "https://almalinux-mirror.dal1.hivelocity.net/${relver}/isos/s390x/AlmaLinux-${relver}-s390x.torrent" + "https://almalinux-mirror.dal1.hivelocity.net/${relver}/isos/x86_64/AlmaLinux-${relver}-x86_64.torrent" + ) + + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hashes=$(qbt torrent list -F csv | awk -v pat="AlmaLinux-$relver" -F, '$0~pat{print $1}') + delete_torrents "$torrent_hashes" + ;; + esac + ;; + + "Debian") + case "$action" in + "Add") + urls=( + "https://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/debian-${relver}-amd64-DVD-1.iso.torrent" + "https://cdimage.debian.org/debian-cd/current/arm64/bt-dvd/debian-${relver}-arm64-DVD-1.iso.torrent" + "https://cdimage.debian.org/debian-cd/current/armel/bt-dvd/debian-${relver}-armel-DVD-1.iso.torrent" + "https://cdimage.debian.org/debian-cd/current/armhf/bt-dvd/debian-${relver}-armhf-DVD-1.iso.torrent" + "https://cdimage.debian.org/debian-cd/current/mips64el/bt-dvd/debian-${relver}-mips64el-DVD-1.iso.torrent" + "https://cdimage.debian.org/debian-cd/current/mipsel/bt-dvd/debian-${relver}-mipsel-DVD-1.iso.torrent" + "https://cdimage.debian.org/debian-cd/current/ppc64el/bt-dvd/debian-${relver}-ppc64el-DVD-1.iso.torrent" + "https://cdimage.debian.org/debian-cd/current/s390x/bt-dvd/debian-${relver}-s390x-DVD-1.iso.torrent" + ) + + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hashes=$(qbt torrent list -F csv | awk -v pat="debian-$relver" -F, '$0~pat{print $1}') + delete_torrents "$torrent_hashes" + ;; + esac + ;; + + "Devuan") + case "$action" in + "Add") + urls=("https://files.devuan.org/devuan_${relver}.torrent") + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hash=$(qbt torrent list -F csv | awk -v pat="devuan_$relver" -F, '$0~pat{print $1}') + delete_torrents "$torrent_hash" + ;; + esac + ;; + + "Fedora") + case "$action" in + "Add") + mapfile -t urls < <(lynx -dump -listonly=on -nonumbers "https://torrent.fedoraproject.org/" | grep "${relver}.torrent") + add_torrents "${urls[@]}" + ;; + + "Delete") + # TODO: Fix this. I suspect it has to do with the $relver not expanding in the jq input. + torrent_hashes=$(qbt torrent list -F json | jq '.[] | select(.name | startswith("Fedora") and endswith("$relver")) | .hash' | tr -d '"') + delete_torrents "$torrent_hashes" + ;; + esac + ;; + + "FreeBSD") + case "$action" in + "Add") + mapfile -t urls < <(curl -sSL "https://people.freebsd.org/~jmg/FreeBSD-${relver}-R-magnet.txt" | grep "magnet:") + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hashes=$(qbt torrent list -F csv | awk -v pat="FreeBSD-$relver" -F, '$0~pat{print $1}') + delete_torrents "$torrent_hashes" + ;; + esac + ;; + + "Kali Linux") + case "$action" in + "Add") + mapfile -t urls < <(lynx -dump -listonly=on -nonumbers https://kali.download/base-images/current/ | grep ".torrent") + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hashes=$(qbt torrent list -F json | jq '.[] | select(.name | contains("kali")) | .hash' | tr -d '"') + delete_torrents "$torrent_hashes" + ;; + esac + ;; + + "NetBSD") + case "$action" in + "Add") + mapfile -t urls < <(lynx -dump -listonly=on -nonumbers "https://cdn.netbsd.org/pub/NetBSD/NetBSD-${relver}/images/" | grep ".torrent") + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hashes=$(qbt torrent list -F csv | awk -v pat="NetBSD-$relver" -F, '$0~pat{print $1}') + delete_torrents "$torrent_hashes" + ;; + esac + ;; + + "NixOS") + case "$action" in + "Add") + mapfile -t urls < <(curl -sSL https://api.github.com/repos/AnimMouse/NixOS-ISO-Torrents/releases/latest | jq '.assets[].browser_download_url' | tr -d '"') + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hashes=$(qbt torrent list -F json | jq '.[] | select(.name | contains("nixos")) | .hash' | tr -d '"') + delete_torrents "$torrent_hashes" + ;; + esac + ;; + + "Qubes") + case "$action" in + "Add") + urls=("https://mirrors.edge.kernel.org/qubes/iso/Qubes-R${relver}-x86_64.torrent") + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hash=$(qbt torrent list -F csv | awk -v pat="Qubes-R$relver" -F, '$0~pat{print $1}') + delete_torrents "$torrent_hash" + ;; + esac + ;; + + "Rocky Linux") + case "$action" in + "Add") + urls=( + "https://download.rockylinux.org/pub/rocky/${relver}/isos/aarch64/Rocky-${relver}-aarch64-dvd.torrent" + "https://download.rockylinux.org/pub/rocky/${relver}/isos/ppc64le/Rocky-${relver}-ppc64le-dvd.torrent" + "https://download.rockylinux.org/pub/rocky/${relver}/isos/s390x/Rocky-${relver}-s390x-dvd.torrent" + "https://download.rockylinux.org/pub/rocky/${relver}/isos/x86_64/Rocky-${relver}-x86_64-dvd.torrent" + ) + + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hashes=$(qbt torrent list -F csv | awk -v pat="Rocky-$relver" -F, '$0~pat{print $1}') + delete_torrents "$torrent_hashes" + ;; + esac + ;; + + "Tails") + case "$action" in + "Add") + urls=( + "https://tails.net/torrents/files/tails-amd64-${relver}.img.torrent" + "https://tails.net/torrents/files/tails-amd64-${relver}.iso.torrent" + ) + + add_torrents "${urls[@]}" + ;; + + "Delete") + torrent_hashes=$(qbt torrent list -F json | jq '.[] | select(.name | contains("tails")) | .hash' | tr -d '"') + delete_torrents "$torrent_hashes" + ;; + esac + ;; +esac diff --git a/bin/qbth b/bin/qbth index 690770b..e3bd5c8 100755 --- a/bin/qbth +++ b/bin/qbth @@ -1,227 +1,294 @@ -#!/usr/bin/env bash +#!/usr/bin/env python3 -# qbth - qbittorrent helper +import json +import os +import subprocess -# Dependency check -missing_deps=() -for bin in "gum" "jq" "lynx" "parallel" "qbt"; do - if ! test -x "$(command -v $bin)"; then - missing_deps+=("$bin") - fi -done +import requests +from bs4 import BeautifulSoup +from qbittorrent import Client -if (( "${#missing_deps[@]}" != 0 )); then - echo "Missing dependencies:" "${missing_deps[@]}" - exit 1 -fi +qb = Client("http://localhost:8080/") +qb.login() -# Add torrent -function add_torrents() { - torrents=("$@") - if ! parallel qbt torrent add url --category "distro" ::: "${torrents[@]}"; then - gum log -l error "Error adding torrents" - exit 1 - fi +def add_torrents(urls): + for url in urls: + qb.download_from_link(url, category="distro") + print(f"Added {os.path.basename(url)}") - for url in "${torrents[@]}"; do gum log -l info "Added" "$(basename "$url")"; done -} -function delete_torrents() { - if test -n "$1"; then - echo "$1" | parallel "qbt torrent delete --with-files {}" - echo "$1" | xargs -I _ gum log -l info "Deleted" _ - else - gum log -l warn "Nothing to do." - fi -} +def add_torrents_from_html(webpage_url: str, torrent_substring: str): + reqs = requests.get(webpage_url) + soup = BeautifulSoup(reqs.text, "html.parser") + for link in soup.find_all("a"): + if torrent_substring in link.get("href"): + url = f"{webpage_url}/{link.get("href")}" + qb.download_from_link(url, category="distro") + print(f"Added {link.get("href")}") -export -f add_torrents -export -f delete_torrents -distro_selection=$(gum choose --limit=1 --header="Available torrents" --height=13 "AlmaLinux" "Debian" "Devuan" "Fedora" "FreeBSD" "Kali Linux" "NetBSD" "NixOS" "Qubes" "Rocky Linux" "Tails") -action=$(gum choose --limit=1 --header="Choose an action: Add, Delete" "Add" "Delete") -relver=$(gum input --placeholder="Enter $distro_selection release version") +def remove_torrents(distro_substring: str): + torrents = qb.torrents() + for torrent in torrents: + if distro_substring in torrent["name"]: + qb.delete_permanently(torrent["hash"]) + print(f"Removed {torrent["name"]}") -case "$distro_selection" in - "AlmaLinux") - case "$action" in - "Add") - urls=( - "https://almalinux-mirror.dal1.hivelocity.net/${relver}/isos/aarch64/AlmaLinux-${relver}-aarch64.torrent" - "https://almalinux-mirror.dal1.hivelocity.net/${relver}/isos/ppc64le/AlmaLinux-${relver}-ppc64le.torrent" - "https://almalinux-mirror.dal1.hivelocity.net/${relver}/isos/s390x/AlmaLinux-${relver}-s390x.torrent" - "https://almalinux-mirror.dal1.hivelocity.net/${relver}/isos/x86_64/AlmaLinux-${relver}-x86_64.torrent" - ) - add_torrents "${urls[@]}" - ;; +def add_almalinux(relver: str): + urls = [ + f"https://almalinux-mirror.dal1.hivelocity.net/{relver}/isos/aarch64/AlmaLinux-{relver}-aarch64.torrent", + f"https://almalinux-mirror.dal1.hivelocity.net/{relver}/isos/ppc64le/AlmaLinux-{relver}-ppc64le.torrent", + f"https://almalinux-mirror.dal1.hivelocity.net/{relver}/isos/s390x/AlmaLinux-{relver}-s390x.torrent", + f"https://almalinux-mirror.dal1.hivelocity.net/{relver}/isos/x86_64/AlmaLinux-{relver}-x86_64.torrent", + ] - "Delete") - torrent_hashes=$(qbt torrent list -F csv | awk -v pat="AlmaLinux-$relver" -F, '$0~pat{print $1}') - delete_torrents "$torrent_hashes" - ;; - esac - ;; + add_torrents(urls) - "Debian") - case "$action" in - "Add") - urls=( - "https://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/debian-${relver}-amd64-DVD-1.iso.torrent" - "https://cdimage.debian.org/debian-cd/current/arm64/bt-dvd/debian-${relver}-arm64-DVD-1.iso.torrent" - "https://cdimage.debian.org/debian-cd/current/armel/bt-dvd/debian-${relver}-armel-DVD-1.iso.torrent" - "https://cdimage.debian.org/debian-cd/current/armhf/bt-dvd/debian-${relver}-armhf-DVD-1.iso.torrent" - "https://cdimage.debian.org/debian-cd/current/mips64el/bt-dvd/debian-${relver}-mips64el-DVD-1.iso.torrent" - "https://cdimage.debian.org/debian-cd/current/mipsel/bt-dvd/debian-${relver}-mipsel-DVD-1.iso.torrent" - "https://cdimage.debian.org/debian-cd/current/ppc64el/bt-dvd/debian-${relver}-ppc64el-DVD-1.iso.torrent" - "https://cdimage.debian.org/debian-cd/current/s390x/bt-dvd/debian-${relver}-s390x-DVD-1.iso.torrent" - ) - add_torrents "${urls[@]}" - ;; +def remove_almalinux(relver: str): + remove_torrents(f"AlmaLinux-{relver}") - "Delete") - torrent_hashes=$(qbt torrent list -F csv | awk -v pat="debian-$relver" -F, '$0~pat{print $1}') - delete_torrents "$torrent_hashes" - ;; - esac - ;; - "Devuan") - case "$action" in - "Add") - urls=("https://files.devuan.org/devuan_${relver}.torrent") - add_torrents "${urls[@]}" - ;; +def add_debian(relver: str): + urls = [ + f"https://cdimage.debian.org/debian-cd/current/amd64/bt-dvd/debian-{relver}-amd64-DVD-1.iso.torrent", + f"https://cdimage.debian.org/debian-cd/current/arm64/bt-dvd/debian-{relver}-arm64-DVD-1.iso.torrent", + f"https://cdimage.debian.org/debian-cd/current/armel/bt-dvd/debian-{relver}-armel-DVD-1.iso.torrent", + f"https://cdimage.debian.org/debian-cd/current/armhf/bt-dvd/debian-{relver}-armhf-DVD-1.iso.torrent", + f"https://cdimage.debian.org/debian-cd/current/mips64el/bt-dvd/debian-{relver}-mips64el-DVD-1.iso.torrent", + f"https://cdimage.debian.org/debian-cd/current/mipsel/bt-dvd/debian-{relver}-mipsel-DVD-1.iso.torrent", + f"https://cdimage.debian.org/debian-cd/current/ppc64el/bt-dvd/debian-{relver}-ppc64el-DVD-1.iso.torrent", + f"https://cdimage.debian.org/debian-cd/current/s390x/bt-dvd/debian-{relver}-s390x-DVD-1.iso.torrent", + ] - "Delete") - torrent_hash=$(qbt torrent list -F csv | awk -v pat="devuan_$relver" -F, '$0~pat{print $1}') - delete_torrents "$torrent_hash" - ;; - esac - ;; + add_torrents(urls) - "Fedora") - case "$action" in - "Add") - mapfile -t urls < <(lynx -dump -listonly=on -nonumbers "https://torrent.fedoraproject.org/" | grep "${relver}.torrent") - add_torrents "${urls[@]}" - ;; - "Delete") - # TODO: Fix this. I suspect it has to do with the $relver not expanding in the jq input. - torrent_hashes=$(qbt torrent list -F json | jq '.[] | select(.name | startswith("Fedora") and endswith("$relver")) | .hash' | tr -d '"') - delete_torrents "$torrent_hashes" - ;; - esac - ;; +def remove_debian(relver: str): + remove_torrents(f"debian-{relver}") - "FreeBSD") - case "$action" in - "Add") - mapfile -t urls < <(curl -sSL "https://people.freebsd.org/~jmg/FreeBSD-${relver}-R-magnet.txt" | grep "magnet:") - add_torrents "${urls[@]}" - ;; - "Delete") - torrent_hashes=$(qbt torrent list -F csv | awk -v pat="FreeBSD-$relver" -F, '$0~pat{print $1}') - delete_torrents "$torrent_hashes" - ;; - esac - ;; +def add_devuan(relver: str): + url = f"https://files.devuan.org/devuan_{relver}.torrent" + qb.download_from_link(url, category="distro") + print(f"Added {os.path.basename(url)}") - "Kali Linux") - case "$action" in - "Add") - mapfile -t urls < <(lynx -dump -listonly=on -nonumbers https://kali.download/base-images/current/ | grep ".torrent") - add_torrents "${urls[@]}" - ;; - "Delete") - torrent_hashes=$(qbt torrent list -F json | jq '.[] | select(.name | contains("kali")) | .hash' | tr -d '"') - delete_torrents "$torrent_hashes" - ;; - esac - ;; +def remove_devuan(relver: str): + remove_torrents(f"devuan_{relver}") - "NetBSD") - case "$action" in - "Add") - mapfile -t urls < <(lynx -dump -listonly=on -nonumbers "https://cdn.netbsd.org/pub/NetBSD/NetBSD-${relver}/images/" | grep ".torrent") - add_torrents "${urls[@]}" - ;; - "Delete") - torrent_hashes=$(qbt torrent list -F csv | awk -v pat="NetBSD-$relver" -F, '$0~pat{print $1}') - delete_torrents "$torrent_hashes" - ;; - esac - ;; +def add_fedora(relver: str): + webpage_url = "https://torrent.fedoraproject.org/torrents" + torrent_substring = f"{relver}.torrent" + add_torrents_from_html(webpage_url, torrent_substring) - "NixOS") - case "$action" in - "Add") - mapfile -t urls < <(curl -sSL https://api.github.com/repos/AnimMouse/NixOS-ISO-Torrents/releases/latest | jq '.assets[].browser_download_url' | tr -d '"') - add_torrents "${urls[@]}" - ;; - "Delete") - torrent_hashes=$(qbt torrent list -F json | jq '.[] | select(.name | contains("nixos")) | .hash' | tr -d '"') - delete_torrents "$torrent_hashes" - ;; - esac - ;; +def remove_fedora(relver: str): + remove_torrents(f"{relver}.torrent") - "Qubes") - case "$action" in - "Add") - urls=("https://mirrors.edge.kernel.org/qubes/iso/Qubes-R${relver}-x86_64.torrent") - add_torrents "${urls[@]}" - ;; - "Delete") - torrent_hash=$(qbt torrent list -F csv | awk -v pat="Qubes-R$relver" -F, '$0~pat{print $1}') - delete_torrents "$torrent_hash" - ;; - esac - ;; +def add_freebsd(relver: str): + url = f"https://people.freebsd.org/~jmg/FreeBSD-{relver}-R-magnet.txt" + reqs = requests.get(url) + data = reqs.text.split("\n") - "Rocky Linux") - case "$action" in - "Add") - urls=( - "https://download.rockylinux.org/pub/rocky/${relver}/isos/aarch64/Rocky-${relver}-aarch64-dvd.torrent" - "https://download.rockylinux.org/pub/rocky/${relver}/isos/ppc64le/Rocky-${relver}-ppc64le-dvd.torrent" - "https://download.rockylinux.org/pub/rocky/${relver}/isos/s390x/Rocky-${relver}-s390x-dvd.torrent" - "https://download.rockylinux.org/pub/rocky/${relver}/isos/x86_64/Rocky-${relver}-x86_64-dvd.torrent" - ) + for line in data: + if line.startswith("magnet:"): + qb.download_from_link(line, category="distro") + print(f"Added {line.split("=")[2]}") - add_torrents "${urls[@]}" - ;; - "Delete") - torrent_hashes=$(qbt torrent list -F csv | awk -v pat="Rocky-$relver" -F, '$0~pat{print $1}') - delete_torrents "$torrent_hashes" - ;; - esac - ;; +def remove_freebsd(relver: str): + remove_torrents(f"FreeBSD-{relver}") - "Tails") - case "$action" in - "Add") - urls=( - "https://tails.net/torrents/files/tails-amd64-${relver}.img.torrent" - "https://tails.net/torrents/files/tails-amd64-${relver}.iso.torrent" - ) - add_torrents "${urls[@]}" - ;; +def add_kali(): + webpage_url = "https://kali.download/base-images/current" + torrent_substring = ".torrent" + add_torrents_from_html(webpage_url, torrent_substring) - "Delete") - torrent_hashes=$(qbt torrent list -F json | jq '.[] | select(.name | contains("tails")) | .hash' | tr -d '"') - delete_torrents "$torrent_hashes" - ;; - esac - ;; -esac + +def remove_kali(): + remove_torrents(f"kali-linux") + + +def add_netbsd(relver: str): + webpage_url = f"https://cdn.netbsd.org/pub/NetBSD/NetBSD-{relver}/images/" + torrent_substring = f".torrent" + add_torrents_from_html(webpage_url, torrent_substring) + + +def remove_netbsd(relver: str): + remove_torrents(f"NetBSD-{relver}") + + +def add_nixos(): + url = "https://api.github.com/repos/AnimMouse/NixOS-ISO-Torrents/releases/latest" + reqs = requests.get(url) + json_data = json.loads(reqs.text) + for item in json_data["assets"]: + qb.download_from_link(item["browser_download_url"], category="distro") + print(f"Added {os.path.basename(item["browser_download_url"])}") + + +def remove_nixos(): + remove_torrents("nixos") + + +def add_qubes(relver: str): + url = f"https://mirrors.edge.kernel.org/qubes/iso/Qubes-R{relver}-x86_64.torrent" + qb.download_from_link(url, category="distro") + print(f"Added {os.path.basename(url)}") + + +def remove_qubes(relver: str): + remove_torrents(f"Qubes-R{relver}") + + +def add_rockylinux(relver: str): + urls = [ + f"https://download.rockylinux.org/pub/rocky/{relver}/isos/aarch64/Rocky-{relver}-aarch64-dvd.torrent", + f"https://download.rockylinux.org/pub/rocky/{relver}/isos/ppc64le/Rocky-{relver}-ppc64le-dvd.torrent", + f"https://download.rockylinux.org/pub/rocky/{relver}/isos/s390x/Rocky-{relver}-s390x-dvd.torrent", + f"https://download.rockylinux.org/pub/rocky/{relver}/isos/x86_64/Rocky-{relver}-x86_64-dvd.torrent", + ] + + add_torrents(urls) + + +def remove_rockylinux(relver: str): + remove_torrents(f"Rocky-{relver}") + + +def add_tails(relver: str): + urls = [ + f"https://tails.net/torrents/files/tails-amd64-{relver}.img.torrent", + f"https://tails.net/torrents/files/tails-amd64-{relver}.iso.torrent", + ] + + add_torrents(urls) + + +def remove_tails(relver: str): + remove_torrents(f"tails-amd64-{relver}") + + +if __name__ == "__main__": + distro_selection = subprocess.run( + [ + "gum", + "choose", + "--limit=1", + "--header='Available torrents'", + "--height=13", + "AlmaLinux", + "Debian", + "Devuan", + "Fedora", + "FreeBSD", + "Kali Linux", + "NetBSD", + "NixOS", + "Qubes", + "Rocky Linux", + "Tails", + ], + stdout=subprocess.PIPE, + text=True, + ).stdout.strip() + + action_selection = subprocess.run( + ["gum", "choose", "--limit=1", "--header='Choose:'", "Add", "Remove"], + stdout=subprocess.PIPE, + text=True, + ).stdout.strip() + + relver = subprocess.run( + ["gum", "input", f"--placeholder='Enter {distro_selection} release version'"], + stdout=subprocess.PIPE, + text=True, + ).stdout.strip() + + match distro_selection: + case "AlmaLinux": + if action_selection == "Add": + add_almalinux(relver) + + if action_selection == "Remove": + remove_almalinux(relver) + + case "Debian": + if action_selection == "Add": + add_debian(relver) + + if action_selection == "Remove": + remove_debian(relver) + + case "Devuan": + if action_selection == "Add": + add_devuan(relver) + + if action_selection == "Remove": + remove_devuan(relver) + + case "Fedora": + if action_selection == "Add": + add_fedora(relver) + + if action_selection == "Remove": + remove_fedora(relver) + + case "FreeBSD": + if action_selection == "Add": + add_freebsd(relver) + + if action_selection == "Remove": + remove_freebsd(relver) + + case "Kali Linux": + if action_selection == "Add": + add_kali() + + if action_selection == "Remove": + remove_kali() + + case "NetBSD": + if action_selection == "Add": + add_netbsd(relver) + + if action_selection == "Remove": + remove_netbsd(relver) + + case "NixOS": + if action_selection == "Add": + add_nixos() + + if action_selection == "Remove": + remove_nixos() + + case "Qubes": + if action_selection == "Add": + add_qubes(relver) + + if action_selection == "Remove": + remove_qubes(relver) + + case "Rocky Linux": + if action_selection == "Add": + add_rockylinux(relver) + + if action_selection == "Remove": + remove_rockylinux(relver) + + case "Tails": + if action_selection == "Add": + add_tails(relver) + + if action_selection == "Remove": + remove_tails(relver) + + case _: + print("Nothing to do.")