From f81e41b92cd3603011faa65c9df91bd0461ce810 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Fri, 13 Nov 2026 21:18:17 -0500 Subject: [PATCH 01/14] feat: add Alpine Linux support via apk Add Alpine and postmarketOS as a supported distro family: - detect Alpine via ID, ID_LIKE and apk auto-detection - implement apk handlers for the pkg_* wrappers, system updates, fix broken packages and the mount tasks - add a sudo shim that falls back to doas or su, since Alpine ships without sudo - add svc_* helpers so services work under both systemd and OpenRC - offer to install the GNU grep, sed, gawk, coreutils and findutils that BusyBox lacks on first run - install XEN Guest Utilities from the release's own repository instead of edge, and enable and verify the OpenRC service - add Alpine to the CI distro-detection matrix - add tests, and update the README, CONTRIBUTING and CHANGELOG --- .github/workflows/ci.yml | 9 +- CHANGELOG.md | 21 +++ CONTRIBUTING.md | 1 + README.md | 8 ++ lib/installers.sh | 3 + lib/installers/alpine_packages.sh | 190 ++++++++++++++++++++++++++ lib/installers/fix_broken_packages.sh | 15 ++ lib/installers/mount_local_drive.sh | 2 + lib/installers/mount_nfs_share.sh | 1 + lib/installers/mount_smb_share.sh | 1 + lib/installers/system_updates.sh | 5 + lib/installers/xen_guest_utilities.sh | 20 +-- lib/pkg_manager.sh | 59 +++++++- lib/shim/sudo | 44 ++++++ lib/system.sh | 51 +++++++ linux_util.sh | 18 ++- tests/test_linux_util.sh | 114 +++++++++++++++- 17 files changed, 544 insertions(+), 18 deletions(-) create mode 100644 lib/installers/alpine_packages.sh create mode 100755 lib/shim/sudo diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fa7d4c..b8fec0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,6 +104,10 @@ jobs: name: openSUSE Tumbleweed family: suse pkg_mgr: zypper + - image: alpine:3.24 + name: Alpine 3.24 + family: alpine + pkg_mgr: apk container: image: ${{ matrix.image }} steps: @@ -119,8 +123,11 @@ jobs: suse) zypper --non-interactive install -y gawk ;; + alpine) + apk add bash gawk grep sed coreutils findutils util-linux curl wget tar + ;; esac - useradd -m testuser + if [ "${{ matrix.family }}" = alpine ]; then adduser -D testuser; else useradd -m testuser; fi chown -R testuser:testuser "$GITHUB_WORKSPACE" - name: Run detect_distro as a non-root user diff --git a/CHANGELOG.md b/CHANGELOG.md index 255c4e0..6d3be53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,27 @@ when a release is cut. ## [Unreleased] +### Added + +- **Alpine Linux support** (#90). `./linux_util.sh` now runs on Alpine and + postmarketOS using `apk`, instead of stopping with "No supported package + manager found". System Updates, Full System Upgrade, Fix Broken Packages, the + mount tasks, XEN Guest Utilities and about 70 utilities that Alpine ships as + packages (browsers, editors, file managers, window managers, containers, + media and office apps) are listed; anything that needs glibc or a + `.deb`/`.rpm` is not offered, as on other distros. Alpine has no `sudo`, so + root commands use `sudo` or `doas` when installed and otherwise `su` with the + root password. On first run it offers to install the GNU `grep`, `sed`, + `gawk`, `coreutils` and `findutils` that BusyBox lacks. Services are started + through OpenRC. Alpine joins the CI distro-detection matrix. + +### Fixed + +- **XEN Guest Utilities** on Alpine installed from the `edge` repository, which + can break a stable release, and then checked its service with `systemctl`. + It now installs from the release's own repository, enables the OpenRC + service and verifies it with OpenRC. + ## [1.12.0] - 2026-11-12 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 96bd4eb..94ed31f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,6 +98,7 @@ install_() { *) warn " installation not implemented for ${DISTRO_NAME}." warn "Supported distros: Debian/Ubuntu, Fedora/RHEL, Arch/Manjaro, openSUSE." + warn "(Alpine utilities are listed in lib/installers/alpine_packages.sh, not here.)" return 1 ;; esac diff --git a/README.md b/README.md index 43cd3f7..55a1940 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,14 @@ Tab-completion for bash and zsh ships in `completions/` — setup is in | RHEL | RHEL, CentOS, Rocky Linux, AlmaLinux, Oracle Linux | `dnf` / `yum` | | Arch | Arch Linux, Manjaro, EndeavourOS, Garuda, Artix, CachyOS | `pacman` + AUR | | openSUSE | openSUSE Leap, Tumbleweed, SLES | `zypper` | +| Alpine | Alpine Linux, postmarketOS | `apk` | + +On Alpine only the utilities Alpine's own repositories carry are listed; anything +that needs glibc or a `.deb`/`.rpm` is not offered there. Alpine has no `sudo` by +default: linux_util uses `sudo` or `doas` if installed and otherwise `su`, which +asks for the root password for every root command (`su -c 'apk add doas'` once +makes that a single prompt). On first run it offers to install the GNU versions +of `grep`, `sed`, `gawk`, `coreutils` and `findutils` that BusyBox lacks. Unrecognised distributions are matched via `ID_LIKE` in `/etc/os-release`, then by auto-detecting the available package manager. diff --git a/lib/installers.sh b/lib/installers.sh index 4a5aad5..edd0380 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -1289,3 +1289,6 @@ mark_upstream_latest \ # Utilities whose own run is a complete system upgrade, so the pre-flight package # refresh must not upgrade ahead of them -- see mark_full_upgrade in utilities.sh. mark_full_upgrade "System Updates" + +# Alpine: keep only the utilities that have an Alpine path (lib/installers/alpine_packages.sh). +apply_alpine_registry diff --git a/lib/installers/alpine_packages.sh b/lib/installers/alpine_packages.sh new file mode 100644 index 0000000..543d067 --- /dev/null +++ b/lib/installers/alpine_packages.sh @@ -0,0 +1,190 @@ +#!/bin/bash +# Alpine Linux: the utilities that install from Alpine's own repositories. +# +# Alpine is not covered by the per-distro case blocks in the other installer +# files, and most utilities there are built on .deb/.rpm/glibc downloads that +# do not run on Alpine (musl). Instead of adding an alpine arm to ~100 files, +# the utilities that Alpine carries as ordinary packages are listed here once, +# and installers.sh calls apply_alpine_registry at the end of registration to: +# - give each listed utility generic apk install/uninstall/update/check +# handlers, and +# - drop every registered utility that has no Alpine path, so nothing is +# offered that would run an installer with no Alpine branch and report +# success having done nothing. +# Utilities with their own Alpine branch in their own file are in +# _ALPINE_OWN_HANDLERS below. +# +# Do not add a second copy of this table elsewhere: new Alpine utilities go +# in _ALPINE_TABLE. + +# "Registered name|apk packages|binary for the quick installed check|OpenRC services|post-install function" +# Binary, services and post-install function may be empty. +_ALPINE_TABLE=( + "Ansible|ansible|ansible||" + "Btop|btop|btop||" + "bat|bat|bat||" + "ClamAV|clamav|clamscan||" + "Docker|docker|docker|docker|_alpine_post_docker" + "Distrobox|distrobox|distrobox||" + "Fastfetch|fastfetch|fastfetch||" + "FileZilla|filezilla|filezilla||" + "Firefox|firefox|firefox||" + "UFW Firewall|ufw|ufw|ufw|" + "GIMP|gimp|gimp||" + "GitHub CLI|github-cli|gh||" + "Go SDK|go|go||" + "Inkscape|inkscape|inkscape||" + "kubectl|kubectl|kubectl||" + "k9s|k9s|k9s||" + "Krita|krita|krita||" + "LibreOffice|libreoffice|soffice||" + "Neovim|neovim|nvim||" + "Node.js|nodejs npm|node||" + "OpenSSH Server|openssh-server|sshd|sshd|" + "tmux|tmux|tmux||" + "OpenTofu|opentofu|tofu||" + "Podman|podman|podman||" + "QBittorrent|qbittorrent|qbittorrent||" + "Remmina|remmina|remmina||" + "ripgrep|ripgrep|rg||" + "Rustup|rustup||||" + "Syncthing|syncthing|syncthing||" + "Tailscale|tailscale|tailscale|tailscale|" + "Thunderbird|thunderbird|thunderbird||" + "VLC|vlc|vlc||" + "Ranger|ranger|ranger||" + "nnn|nnn|nnn||" + "Midnight Commander|mc|mc||" + "Nautilus|nautilus|nautilus||" + "Thunar|thunar|thunar||" + "Dolphin|dolphin|dolphin||" + "Nemo|nemo|nemo||" + "Caja|caja|caja||" + "PCManFM-Qt|pcmanfm-qt|pcmanfm-qt||" + "Krusader|krusader|krusader||" + "awesome|awesome|awesome||" + "bspwm|bspwm sxhkd|bspwm||" + "dwm|dwm|dwm||" + "i3|i3wm|i3||" + "Openbox|openbox|openbox||" + "Sway|sway|sway||" + "Hyprland|hyprland|Hyprland||" + "Chromium|chromium|chromium||" + "Flameshot|flameshot|flameshot||" + "Kdenlive|kdenlive|kdenlive||" + "OBS Studio|obs-studio|obs||" + "Audacity|audacity|audacity||" + "HandBrake|handbrake||||" + "Wine|wine|wine||" + "NeoMutt|neomutt|neomutt||" + "Claws Mail|claws-mail|claws-mail||" + "Evolution|evolution|evolution||" + "Geary|geary|geary||" + "KMail|kmail|kmail||" + "Zotero|zotero|zotero||" + "Virt-Manager|virt-manager|virt-manager||" + "GParted|gparted|gparted||" + "Filelight|filelight|filelight||" + "Nextcloud Desktop|nextcloud-client|nextcloud||" + "MangoHud|mangohud|mangohud||" + "Feral Gamemode|gamemode|gamemoded||" +) + +# Registered utilities whose own installer file has an Alpine branch. +_ALPINE_OWN_HANDLERS=( + "Full System Upgrade" + "System Updates" + "Mount Local Drive" + "Mount NFS Share" + "Mount SMB Share" + "Fix Broken Packages" + "Delete Default Cloud-Init User" + "XEN Guest Utilities" +) + +# Docker: the daemon only accepts the current user once they are in the docker group. +_alpine_post_docker() { + sudo addgroup "$USER" docker 2>/dev/null || true + info "Log out and back in so the docker group applies to your user." +} + +# _alpine_field NAME N — field N (1-5) of NAME's table row. +_alpine_field() { + local row + for row in "${_ALPINE_TABLE[@]}"; do + [[ "${row%%|*}" == "$1" ]] && { cut -d'|' -f"$2" <<<"$row"; return 0; } + done + return 1 +} + +_alpine_install() { + local name="$1" pkgs svc post + pkgs=$(_alpine_field "$name" 2); svc=$(_alpine_field "$name" 4); post=$(_alpine_field "$name" 5) + info "Installing ${name}..." + # shellcheck disable=SC2086 + pkg_install $pkgs || { error "${name}: apk could not install ${pkgs}."; return 1; } + local s + for s in $svc; do svc_enable_now "$s" || warn "Could not enable the ${s} service."; done + [[ -n "$post" ]] && "$post" + info "${name} installed." +} + +_alpine_uninstall() { + local name="$1" pkgs svc s + pkgs=$(_alpine_field "$name" 2); svc=$(_alpine_field "$name" 4) + info "Uninstalling ${name}..." + for s in $svc; do svc_disable_now "$s" 2>/dev/null || true; done + # shellcheck disable=SC2086 + pkg_remove $pkgs +} + +_alpine_update() { + local name="$1" pkgs + pkgs=$(_alpine_field "$name" 2) + info "Updating ${name}..." + # shellcheck disable=SC2086 + pkg_upgrade $pkgs +} + +_alpine_check() { + local name="$1" pkgs bin + pkgs=$(_alpine_field "$name" 2); bin=$(_alpine_field "$name" 3) + _check_standard "$bin" "${pkgs%% *}" "" +} + +_alpine_version() { + local pkgs + pkgs=$(_alpine_field "$1" 2) + _ver_from_pkg "${pkgs%% *}" || echo "" +} + +# apply_alpine_registry — see the header. Call once, after every register_*. +apply_alpine_registry() { + [[ "${DISTRO_FAMILY:-}" == "alpine" ]] || return 0 + local row name id + declare -A _keep=() + for name in "${_ALPINE_OWN_HANDLERS[@]}"; do _keep["$name"]=1; done + for row in "${_ALPINE_TABLE[@]}"; do + name="${row%%|*}" + # Only utilities the registry already lists are rebound; a name that is + # in the table but not registered is simply not offered. + [[ -n "${INSTALL_FUNCS[$name]:-}" ]] || continue + _keep["$name"]=1 + id="${name//[^A-Za-z0-9]/_}" + eval "_alpine_install_${id}() { _alpine_install $(printf '%q' "$name"); }" + eval "_alpine_uninstall_${id}() { _alpine_uninstall $(printf '%q' "$name"); }" + eval "_alpine_update_${id}() { _alpine_update $(printf '%q' "$name"); }" + eval "_alpine_check_${id}() { _alpine_check $(printf '%q' "$name"); }" + eval "_alpine_version_${id}() { _alpine_version $(printf '%q' "$name"); }" + INSTALL_FUNCS["$name"]="_alpine_install_${id}" + UNINSTALL_FUNCS["$name"]="_alpine_uninstall_${id}" + UPDATE_FUNCS["$name"]="_alpine_update_${id}" + CHECK_FUNCS["$name"]="_alpine_check_${id}" + VERSION_FUNCS["$name"]="_alpine_version_${id}" + done + local -a _utils=() _tasks=() + for name in "${UTILITIES[@]}"; do [[ -n "${_keep[$name]:-}" ]] && _utils+=("$name"); done + for name in "${SYSTEM_TASKS[@]}"; do [[ -n "${_keep[$name]:-}" ]] && _tasks+=("$name"); done + UTILITIES=("${_utils[@]}") + SYSTEM_TASKS=("${_tasks[@]}") +} diff --git a/lib/installers/fix_broken_packages.sh b/lib/installers/fix_broken_packages.sh index e7a7fb2..9cd999a 100644 --- a/lib/installers/fix_broken_packages.sh +++ b/lib/installers/fix_broken_packages.sh @@ -85,6 +85,21 @@ setup_fix_broken_packages() { sudo zypper verify ;; + apk) + # A simulated fix lists what apk would reinstall or repair; an + # intact system lists nothing. + local out + out=$(sudo apk fix --simulate 2>&1) + grep -qE '\((Re)?[Ii]nstalling|Purging|Upgrading' <<<"$out" && { issues=1; warn "Packages apk would repair:"; printf '%s\n' "$out" | tail -n 20; } + + _repair_gate "$issues" || return 3 + + info "Refreshing the package index (apk update)..." + sudo apk update + info "Repairing installed packages (apk fix)..." + sudo apk fix + ;; + *) error "Unsupported package manager: ${PKG_MGR:-unknown}" return 1 diff --git a/lib/installers/mount_local_drive.sh b/lib/installers/mount_local_drive.sh index 0c82902..19c0343 100644 --- a/lib/installers/mount_local_drive.sh +++ b/lib/installers/mount_local_drive.sh @@ -122,6 +122,7 @@ _mld_ensure_fs_tools() { rhel) pkg_install ntfs-3g ;; arch) pkg_install ntfs-3g ;; suse) pkg_install ntfs-3g ;; + alpine) pkg_install ntfs-3g ;; *) warn "Cannot auto-install ntfs-3g on this distro. Install it manually."; return 1 ;; esac fi @@ -136,6 +137,7 @@ _mld_ensure_fs_tools() { rhel) pkg_install exfatprogs 2>/dev/null || true ;; arch) pkg_install exfatprogs ;; suse) pkg_install exfatprogs 2>/dev/null || true ;; + alpine) pkg_install exfatprogs ;; *) warn "Cannot auto-install exfat support on this distro. Install it manually."; return 1 ;; esac fi diff --git a/lib/installers/mount_nfs_share.sh b/lib/installers/mount_nfs_share.sh index 79ebd7f..1480500 100644 --- a/lib/installers/mount_nfs_share.sh +++ b/lib/installers/mount_nfs_share.sh @@ -25,6 +25,7 @@ _mns_ensure_nfs_tools() { rhel) pkg_install nfs-utils ;; arch) pkg_install nfs-utils ;; suse) pkg_install nfs-client ;; + alpine) pkg_install nfs-utils ;; *) warn "Cannot auto-install NFS tools on this distro. Install nfs-common or nfs-utils manually." return 1 diff --git a/lib/installers/mount_smb_share.sh b/lib/installers/mount_smb_share.sh index 1047951..9bc571e 100644 --- a/lib/installers/mount_smb_share.sh +++ b/lib/installers/mount_smb_share.sh @@ -25,6 +25,7 @@ _msb_ensure_smb_tools() { rhel) pkg_install cifs-utils samba-client ;; arch) pkg_install cifs-utils smbclient ;; suse) pkg_install cifs-utils samba-client ;; + alpine) pkg_install cifs-utils samba-client ;; *) warn "Cannot auto-install SMB tools on this distro. Install cifs-utils and smbclient manually." return 1 diff --git a/lib/installers/system_updates.sh b/lib/installers/system_updates.sh index 174120a..03dd492 100644 --- a/lib/installers/system_updates.sh +++ b/lib/installers/system_updates.sh @@ -233,6 +233,11 @@ get_version_system_updates() { zypper) total=$(zypper --non-interactive list-updates 2>/dev/null | grep -cE '^\s*v\s*\|' || true) ;; + apk) + # "-l '<'" lists installed packages that have a newer version in the + # already-downloaded index; no network call, no root. + total=$(apk version -l '<' 2>/dev/null | grep -c '<' || true) + ;; esac # Count pending device firmware updates (fwupd/LVFS). Reads whatever diff --git a/lib/installers/xen_guest_utilities.sh b/lib/installers/xen_guest_utilities.sh index 2bc3cf3..d20da64 100644 --- a/lib/installers/xen_guest_utilities.sh +++ b/lib/installers/xen_guest_utilities.sh @@ -10,9 +10,8 @@ uninstall_xen_guest_utilities() { info "Uninstalling XEN Guest Utilities..." # Stop and disable known XEN guest services - for svc in xe-linux-distribution xe-daemon; do - sudo systemctl stop "$svc" 2>/dev/null || true - sudo systemctl disable "$svc" 2>/dev/null || true + for svc in xe-linux-distribution xe-daemon xe-guest-utilities; do + svc_disable_now "$svc" 2>/dev/null || true done # Remove all known package variants @@ -255,15 +254,14 @@ _install_from_iso_tgz() { # Verify that XEN guest services are running after installation. # The ISO installs xe-linux-distribution; the apt package installs xe-daemon. _verify_xen_services() { - local services=("xe-linux-distribution" "xe-daemon") + local services=("xe-linux-distribution" "xe-daemon" "xe-guest-utilities") local max_attempts=6 local wait_seconds=5 # Find which service exists on this system local svc="" for s in "${services[@]}"; do - if systemctl list-unit-files "${s}.service" &>/dev/null && \ - systemctl list-unit-files "${s}.service" 2>/dev/null | grep -q "${s}"; then + if svc_exists "$s"; then svc="$s" break fi @@ -277,7 +275,7 @@ _verify_xen_services() { info "Verifying ${svc} service started..." local attempt=0 while (( attempt < max_attempts )); do - if systemctl is-active --quiet "${svc}"; then + if svc_is_active "$svc"; then info "${svc} service is running." return 0 fi @@ -289,7 +287,7 @@ _verify_xen_services() { warn "${svc} service failed to start within $(( max_attempts * wait_seconds )) seconds." warn "Service status:" - systemctl status "${svc}" --no-pager 2>&1 | head -20 + svc_status "$svc" return 1 } @@ -356,7 +354,11 @@ _install_from_repository() { alpine) info "Installing xe-guest-utilities via apk..." - if run_as_root apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/community xe-guest-utilities; then + # The release's own repositories carry it; edge is only a fallback + # for a release that does not. + if run_as_root apk add xe-guest-utilities xe-guest-utilities-openrc \ + || run_as_root apk add -X http://dl-cdn.alpinelinux.org/alpine/edge/community xe-guest-utilities xe-guest-utilities-openrc; then + svc_enable_now xe-guest-utilities || warn "Failed to enable xe-guest-utilities" if _verify_xen_services; then info "XEN Guest Utilities installed and services are running." else diff --git a/lib/pkg_manager.sh b/lib/pkg_manager.sh index d82ee09..b1f8de5 100644 --- a/lib/pkg_manager.sh +++ b/lib/pkg_manager.sh @@ -74,6 +74,10 @@ detect_distro() { DISTRO_FAMILY="suse" PKG_MGR="zypper" ;; + alpine|postmarketos) + DISTRO_FAMILY="alpine" + PKG_MGR="apk" + ;; *) # Try ID_LIKE for derivatives case "$DISTRO_ID_LIKE" in @@ -87,9 +91,11 @@ detect_distro() { DISTRO_FAMILY="arch"; PKG_MGR="pacman" ;; *suse*) DISTRO_FAMILY="suse"; PKG_MGR="zypper" ;; + *alpine*) + DISTRO_FAMILY="alpine"; PKG_MGR="apk" ;; *) echo "Warning: Unrecognized distribution '${DISTRO_NAME}' (${DISTRO_ID})." - echo "Supported: Debian/Ubuntu, Fedora/RHEL, Arch, openSUSE" + echo "Supported: Debian/Ubuntu, Fedora/RHEL, Arch, openSUSE, Alpine" # Auto-detect by available package manager if command -v apt &>/dev/null; then DISTRO_FAMILY="debian"; PKG_MGR="apt" @@ -101,6 +107,8 @@ detect_distro() { DISTRO_FAMILY="arch"; PKG_MGR="pacman" elif command -v zypper &>/dev/null; then DISTRO_FAMILY="suse"; PKG_MGR="zypper" + elif command -v apk &>/dev/null; then + DISTRO_FAMILY="alpine"; PKG_MGR="apk" else echo "Error: No supported package manager found." exit 1 @@ -195,6 +203,9 @@ pkg_refresh() { zypper) "$_run" "Refreshing package cache" \ timeout "$PKG_REFRESH_TIMEOUT_SECS" sudo zypper refresh ;; + apk) + "$_run" "Refreshing package cache" \ + timeout "$PKG_REFRESH_TIMEOUT_SECS" sudo apk update ;; esac _PKG_REFRESHED=true } @@ -206,6 +217,7 @@ pkg_install() { dnf|yum) run_with_spinner "$_label" sudo "$PKG_MGR" install -y "$@" ;; pacman) run_with_spinner "$_label" sudo pacman -S --noconfirm "$@" ;; zypper) run_with_spinner "$_label" sudo zypper install -y "$@" ;; + apk) run_with_spinner "$_label" sudo apk add "$@" ;; esac } @@ -217,6 +229,7 @@ pkg_remove() { dnf|yum) run_with_spinner "$_label" sudo "$PKG_MGR" remove -y "$@" ;; pacman) run_with_spinner "$_label" sudo pacman -Rs --noconfirm "$@" ;; zypper) run_with_spinner "$_label" sudo zypper remove -y "$@" ;; + apk) run_with_spinner "$_label" sudo apk del "$@" ;; esac } @@ -228,6 +241,8 @@ pkg_upgrade() { dnf|yum) run_with_spinner "$_label" sudo "$PKG_MGR" upgrade -y "$@" ;; pacman) run_with_spinner "$_label" sudo pacman -S --noconfirm "$@" ;; zypper) run_with_spinner "$_label" sudo zypper update -y "$@" ;; + apk) run_with_spinner "Refreshing package cache" sudo apk update && + run_with_spinner "$_label" sudo apk add --upgrade "$@" ;; esac } @@ -237,6 +252,7 @@ pkg_check_installed() { dnf|yum) rpm -q "$1" &>/dev/null ;; pacman) pacman -Q "$1" &>/dev/null ;; zypper) rpm -q "$1" &>/dev/null ;; + apk) apk info -e "$1" &>/dev/null ;; esac } @@ -247,6 +263,7 @@ pkg_install_local() { dnf|yum) run_with_spinner "$_label" sudo "$PKG_MGR" install -y "$1" ;; pacman) run_with_spinner "$_label" sudo pacman -U --noconfirm "$1" ;; zypper) run_with_spinner "$_label" sudo zypper install -y --allow-unsigned-rpm "$1" ;; + apk) run_with_spinner "$_label" sudo apk add --allow-untrusted "$1" ;; esac } @@ -283,6 +300,7 @@ pkg_autoremove() { pacman) "$_run" "Removing orphaned packages" \ bash -c "pkgs=\$(pacman -Qdtq 2>/dev/null); [[ -n \"\$pkgs\" ]] && sudo pacman -Rs $_nc \$pkgs || true" ;; zypper) true ;; + apk) true ;; # apk has no orphan list: packages are removed with `apk del` esac } @@ -381,6 +399,7 @@ pkg_full_upgrade() { "$_run" "Upgrading installed packages (pacman only)" sudo pacman -Syu $_nc fi ;; zypper) "$_run" "Upgrading installed packages" sudo zypper update $_y ;; + apk) "$_run" "Upgrading installed packages" sudo apk upgrade ;; esac } @@ -397,6 +416,7 @@ pkg_clean() { pacman) "$_run" "Cleaning package cache" \ bash -c "sudo find /var/cache/pacman/pkg -maxdepth 1 -name 'download-*' -delete 2>/dev/null; sudo pacman -Sc $_nc" ;; zypper) "$_run" "Cleaning package cache" sudo zypper clean -a ;; + apk) "$_run" "Cleaning package cache" sudo apk cache clean ;; esac } @@ -1816,6 +1836,11 @@ pkg_get_version() { fi ;; pacman) pacman -Q "$pkg" 2>/dev/null | awk '{print $2}' || echo "unknown" ;; + apk) + # "curl-8.23.0-r0 x86_64 {curl} (curl) [installed]" -> "8.23.0-r0" + v=$(apk list -I "$pkg" 2>/dev/null | sed -n -E "s/^${pkg}-([0-9][^ ]*) .*/\1/p" | head -1) + printf '%s\n' "${v:-unknown}" + ;; esac } @@ -2142,9 +2167,40 @@ ensure_tools() { sudo zypper install -y gpg2 curl wget 2>/dev/null || true fi ;; + apk) + if ! command -v gpg &>/dev/null || ! command -v curl &>/dev/null || ! command -v wget &>/dev/null; then + sudo apk add gnupg curl wget 2>/dev/null || true + fi + ;; esac } +# Alpine ships BusyBox versions of grep, sed, find and friends. The project's +# modules use GNU-only options (grep -P, sed -r extensions, find -printf, ...), +# so the GNU tools are installed once before the menu opens. Does nothing on +# other distros, or on Alpine once the tools are present. +ensure_alpine_prereqs() { + [[ "$PKG_MGR" == "apk" ]] || return 0 + local -a _need=() + grep --version 2>&1 | grep -q 'GNU grep' || _need+=(grep) + sed --version 2>&1 | grep -q 'GNU sed' || _need+=(sed) + awk --version 2>&1 | grep -q 'GNU Awk' || _need+=(gawk) + date --version 2>&1 | grep -q 'GNU coreutils' || _need+=(coreutils) + find --version 2>&1 | grep -q 'GNU findutils' || _need+=(findutils) + command -v flock &>/dev/null || _need+=(util-linux) + command -v curl &>/dev/null || _need+=(curl) + command -v wget &>/dev/null || _need+=(wget) + command -v tar &>/dev/null || _need+=(tar) + [[ ${#_need[@]} -eq 0 ]] && return 0 + info "Alpine ships BusyBox tools; linux_util needs the GNU versions of: ${_need[*]}" + if [[ -t 0 ]]; then + local _ans + read -r -p "Install them now with apk? [Y/n] " _ans + [[ "${_ans,,}" == "n" ]] && { error "Cannot continue without: ${_need[*]}"; return 1; } + fi + sudo apk add "${_need[@]}" || { error "Could not install: ${_need[*]}"; return 1; } +} + # Check for internet connectivity; warns but does not abort (best-effort). check_internet() { if ! { curl -fsS --max-time 5 https://1.1.1.1 || ping -c1 -W3 8.8.8.8; } &>/dev/null; then @@ -2185,6 +2241,7 @@ pkg_snapshot() { dnf|yum) _native=$(rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' 2>/dev/null | sort | md5sum | awk '{print $1}') ;; pacman) _native=$(pacman -Q 2>/dev/null | md5sum | awk '{print $1}') ;; zypper) _native=$(rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' 2>/dev/null | sort | md5sum | awk '{print $1}') ;; + apk) _native=$(apk info -v 2>/dev/null | sort | md5sum | awk '{print $1}') ;; esac # Include Flatpak commit state so Flatpak-only updates count as a change. if command -v flatpak &>/dev/null; then diff --git a/lib/shim/sudo b/lib/shim/sudo new file mode 100755 index 0000000..6cd0ae7 --- /dev/null +++ b/lib/shim/sudo @@ -0,0 +1,44 @@ +#!/bin/sh +# sudo stand-in for systems that ship without it (Alpine). linux_util puts this +# directory on PATH only when no real sudo exists. It runs the command as root +# through doas when that is installed, otherwise through su, so every +# "sudo ..." call in lib/ works unchanged, including through timeout, xargs and +# "bash -c". +# +# Understood: -v (check the login), -n (never prompt), -u USER (run as USER). +# -E, -H, -S and -k are accepted and ignored. su cannot remember a password, so +# with su every root command asks for the root password; -v then succeeds +# without asking and -n always fails. + +validate=0; noninteractive=0; user="" +while [ $# -gt 0 ]; do + case "$1" in + --) shift; break ;; + -v) validate=1 ;; + -n) noninteractive=1 ;; + -u) user="${2:-}"; shift ;; + -*) ;; + *) break ;; + esac + shift +done + +if command -v doas >/dev/null 2>&1; then + if [ "$validate" = 1 ]; then set -- true; fi + if [ "$noninteractive" = 1 ] && [ -n "$user" ]; then exec doas -n -u "$user" "$@"; fi + if [ "$noninteractive" = 1 ]; then exec doas -n "$@"; fi + if [ -n "$user" ]; then exec doas -u "$user" "$@"; fi + exec doas "$@" +fi + +[ "$validate" = 1 ] && exit 0 +[ "$noninteractive" = 1 ] && exit 1 +[ $# -gt 0 ] || exit 0 + +# Single-quote every argument for the shell su starts. +cmd="" +for arg in "$@"; do + esc=$(printf '%s' "$arg" | sed "s/'/'\\\\''/g") + cmd="${cmd:+$cmd }'$esc'" +done +exec su -c "$cmd" "${user:-root}" diff --git a/lib/system.sh b/lib/system.sh index d6cb262..f9acccf 100644 --- a/lib/system.sh +++ b/lib/system.sh @@ -5,6 +5,57 @@ # Provides system helper functions used across all modules # ============================================================================ +# --- Root access when sudo is not installed (Alpine ships without it) -------- +# LU_ROOT_METHOD says how this run gets root: sudo, doas, or su. When sudo is +# missing, lib/shim/sudo (a stand-in program) goes on PATH, so every existing +# "sudo ..." call in lib/ works unchanged -- including through timeout, xargs +# and "bash -c". See that file for the flags it understands. +if command -v sudo &>/dev/null; then + LU_ROOT_METHOD="sudo" +else + if command -v doas &>/dev/null; then LU_ROOT_METHOD="doas"; else LU_ROOT_METHOD="su"; fi + export PATH="${SCRIPT_DIR}/lib/shim:${PATH}" +fi +export LU_ROOT_METHOD + +# --- Services: systemd or OpenRC (Alpine) ----------------------------------- +# One set of helpers so an installer does not hard-code systemctl. The unit / +# init-script name is the same on both for the services this project manages. +has_systemd() { [[ -d /run/systemd/system ]]; } + +# svc_exists NAME — is there a service called NAME? +svc_exists() { + if has_systemd; then + systemctl list-unit-files "${1}.service" 2>/dev/null | grep -q "^${1}\.service" + else + [[ -x "/etc/init.d/$1" ]] + fi +} + +# svc_is_active NAME — is NAME running right now? +svc_is_active() { + if has_systemd; then systemctl is-active --quiet "$1" + else rc-service "$1" status &>/dev/null; fi +} + +# svc_enable_now NAME — start at boot and start it now. +svc_enable_now() { + if has_systemd; then sudo systemctl enable --now "$1" + else sudo rc-update add "$1" default && sudo rc-service "$1" start; fi +} + +# svc_disable_now NAME — stop it and do not start it at boot. +svc_disable_now() { + if has_systemd; then sudo systemctl disable --now "$1" + else sudo rc-service "$1" stop; sudo rc-update del "$1" default; fi +} + +# svc_status NAME — human-readable status, for error messages. +svc_status() { + if has_systemd; then systemctl status "$1" --no-pager 2>&1 | head -20 + else rc-service "$1" status 2>&1 | head -20; fi +} + # Helper functions for system setup # run_as_root executes a command with sudo using argument-vector semantics. # Each argument is passed directly to sudo without shell re-parsing. diff --git a/linux_util.sh b/linux_util.sh index 87fa04b..c7441f0 100755 --- a/linux_util.sh +++ b/linux_util.sh @@ -3,7 +3,7 @@ # ============================================================================ # Linux Utilities Installer & System Setup # Interactive multi-select installer combining system setup and utility management -# Compatible with: Debian/Ubuntu, Fedora/RHEL/CentOS, Arch/Manjaro, openSUSE +# Compatible with: Debian/Ubuntu, Fedora/RHEL/CentOS, Arch/Manjaro, openSUSE, Alpine # ============================================================================ # Prevent running as root @@ -37,6 +37,7 @@ if (( ${#_lu_missing_core[@]} > 0 )); then *debian*|*ubuntu*) _lu_pkg="gawk"; _lu_install="sudo apt install -y $_lu_pkg" ;; *arch*) _lu_pkg="gawk"; _lu_install="sudo pacman -S --noconfirm $_lu_pkg" ;; *suse*) _lu_pkg="gawk"; _lu_install="sudo zypper install -y $_lu_pkg" ;; + *alpine*) _lu_pkg="gawk grep sed"; _lu_install="su -c 'apk add $_lu_pkg'" ;; *) _lu_pkg=""; _lu_install="" ;; esac if [[ -n "$_lu_install" ]]; then @@ -181,6 +182,7 @@ echo "" # Continue sourcing remaining library modules source "${SCRIPT_DIR}/lib/aur.sh" || { echo "Error: Failed to source aur.sh"; exit 1; } source "${SCRIPT_DIR}/lib/system.sh" || { echo "Error: Failed to source system.sh"; exit 1; } +ensure_alpine_prereqs || exit 1 source "${SCRIPT_DIR}/lib/verify.sh" || { echo "Error: Failed to source verify.sh"; exit 1; } source "${SCRIPT_DIR}/lib/snapshot.sh" || { echo "Error: Failed to source snapshot.sh"; exit 1; } source "${SCRIPT_DIR}/lib/utilities.sh" || { echo "Error: Failed to source utilities.sh"; exit 1; } @@ -226,10 +228,16 @@ fi # Only run when stdin is a terminal (skip during non-interactive/test invocations # so that child processes cannot inherit the lock fd and block subsequent runs). if [[ -t 0 ]]; then - sudo -v 9>&- - ( exec 9>&-; while true; do sudo -n true; sleep 50; done ) 2>/dev/null & - SUDO_KEEPALIVE_PID=$! - echo "$SUDO_KEEPALIVE_PID" > "$SUDO_PID_FILE" + if [[ "$LU_ROOT_METHOD" == "su" ]]; then + # su cannot remember a password: there is nothing to cache or keep alive. + warn "Neither sudo nor doas is installed, so root commands use su and ask for the root password each time." + warn "To be asked once, install doas: su -c 'apk add doas'" + else + sudo -v 9>&- || { echo "Error: could not get root access with $LU_ROOT_METHOD."; exit 1; } + ( exec 9>&-; while true; do sudo -n true; sleep 50; done ) 2>/dev/null & + SUDO_KEEPALIVE_PID=$! + echo "$SUDO_KEEPALIVE_PID" > "$SUDO_PID_FILE" + fi fi # Initialize Timeshift integration (Debian/Ubuntu only — silent no-op otherwise) diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index fd71a43..52e9f18 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -588,14 +588,14 @@ test_detect_distro_valid_values() { _mgr=$(echo "$_out" | grep '^_RESULT_MGR=' | cut -d= -f2) case "$_fam" in - debian|fedora|rhel|arch|suse) + debian|fedora|rhel|arch|suse|alpine) _pass "detect_distro sets DISTRO_FAMILY to a known value ('${_fam}')" ;; *) _fail "detect_distro sets DISTRO_FAMILY to a known value (got: '${_fam}')" ;; esac case "$_mgr" in - apt|dnf|yum|pacman|zypper) + apt|dnf|yum|pacman|zypper|apk) _pass "detect_distro sets PKG_MGR to a known value ('${_mgr}')" ;; *) _fail "detect_distro sets PKG_MGR to a known value (got: '${_mgr}')" ;; @@ -5226,6 +5226,116 @@ test_front_end_quiet_reads test_front_end_sudo_bash_keeps_read test_front_end_gate_in_main_script +# ============================================================================ +# Test: Alpine Linux support +# ============================================================================ +echo "" +echo "=== Alpine Linux Tests ===" + +test_alpine_detect() { + local _out + _out=$(_run_detect_mock "alpine" "" "Alpine Linux" "3.24.4") + assert_eq "alpine" "$(echo "$_out" | grep '^_FAMILY=' | cut -d= -f2)" "Mock alpine → DISTRO_FAMILY=alpine" + assert_eq "apk" "$(echo "$_out" | grep '^_MGR=' | cut -d= -f2)" "Mock alpine → PKG_MGR=apk" + _out=$(_run_detect_mock "someunknown" "alpine" "SomeDistro" "1.0") + assert_eq "apk" "$(echo "$_out" | grep '^_MGR=' | cut -d= -f2)" "ID_LIKE=alpine derivative → PKG_MGR=apk" +} + +# Each pkg_* wrapper must run the apk command, not fall through the case silently. +test_alpine_pkg_wrappers() { + local _out + _out=$( + PKG_MGR=apk + source "${SCRIPT_DIR}/lib/pkg_manager.sh" 2>/dev/null + run_with_spinner() { shift; "$@"; } + sudo() { echo "sudo $*"; } + pkg_install tmux git + pkg_remove tmux + pkg_upgrade tmux + pkg_install_local /tmp/x.apk + pkg_clean + PKG_REFRESH_TIMEOUT_SECS=5 pkg_refresh 2>&1 + ) + assert_contains "$_out" "sudo apk add tmux git" "Alpine: pkg_install runs apk add" + assert_contains "$_out" "sudo apk del tmux" "Alpine: pkg_remove runs apk del" + assert_contains "$_out" "sudo apk add --upgrade tmux" "Alpine: pkg_upgrade upgrades the named package" + assert_contains "$_out" "sudo apk add --allow-untrusted /tmp/x.apk" "Alpine: pkg_install_local runs apk add --allow-untrusted" + assert_contains "$_out" "sudo apk cache clean" "Alpine: pkg_clean cleans the apk cache" +} + +# The sudo stand-in: with doas it hands the same flags to doas; with only su it +# quotes the command for su and cannot cache a login. +test_alpine_sudo_shim() { + local _bin _out _rc + _bin=$(mktemp -d) + ln -s "$(command -v sh)" "$_bin/sh"; ln -s "$(command -v sed)" "$_bin/sed" + printf '#!/bin/sh\necho "doas $*"\n' > "$_bin/doas"; chmod +x "$_bin/doas" + _out=$(PATH="$_bin" "${SCRIPT_DIR}/lib/shim/sudo" -n -u bob echo hi) + assert_eq "doas -n -u bob echo hi" "$_out" "sudo shim: flags and command reach doas" + _out=$(PATH="$_bin" "${SCRIPT_DIR}/lib/shim/sudo" -v) + assert_eq "doas true" "$_out" "sudo shim: -v asks doas to validate the login" + rm -f "$_bin/doas" + printf '#!/bin/sh\nfor a in "$@"; do echo "[$a]"; done\n' > "$_bin/su"; chmod +x "$_bin/su" + _out=$(PATH="$_bin" "${SCRIPT_DIR}/lib/shim/sudo" sh -c "it's here") + assert_eq $'[-c]\n['"'sh' '-c' 'it'\\''s here'"$']\n[root]' "$_out" "sudo shim: su receives one quoted command for root" + PATH="$_bin" "${SCRIPT_DIR}/lib/shim/sudo" -v; _rc=$? + assert_eq "0" "$_rc" "sudo shim: -v succeeds without a password when only su exists" + PATH="$_bin" "${SCRIPT_DIR}/lib/shim/sudo" -n true; _rc=$? + assert_eq "1" "$_rc" "sudo shim: -n fails when only su exists (no cached login)" + rm -rf "$_bin" +} + +# On Alpine only utilities with an Alpine path stay registered, and the generic +# apk handlers replace the original ones. +test_alpine_registry_filter() { + local _out + _out=$( + DISTRO_FAMILY=alpine + declare -a UTILITIES=(Chrome tmux "System Updates" Steam) SYSTEM_TASKS=("System Updates") + declare -A INSTALL_FUNCS=([Chrome]=i1 [tmux]=i2 ["System Updates"]=i3 [Steam]=i4) + declare -A UNINSTALL_FUNCS CHECK_FUNCS UPDATE_FUNCS VERSION_FUNCS + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + apply_alpine_registry + echo "utils=${UTILITIES[*]}" + echo "tasks=${SYSTEM_TASKS[*]}" + echo "tmux=${INSTALL_FUNCS[tmux]} ${CHECK_FUNCS[tmux]}" + echo "sys=${INSTALL_FUNCS["System Updates"]}" + ) + assert_contains "$_out" "utils=tmux System Updates" "Alpine: utilities without an Alpine path are dropped" + assert_contains "$_out" "tasks=System Updates" "Alpine: system tasks with their own Alpine handling stay" + assert_contains "$_out" "tmux=_alpine_install_tmux _alpine_check_tmux" "Alpine: listed utilities get the generic apk handlers" + assert_contains "$_out" "sys=i3" "Alpine: utilities with their own handlers keep them" + _out=$( + DISTRO_FAMILY=debian + declare -a UTILITIES=(Chrome tmux) SYSTEM_TASKS=() + declare -A INSTALL_FUNCS=([Chrome]=i1 [tmux]=i2) + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + apply_alpine_registry + echo "utils=${UTILITIES[*]}" + ) + assert_eq "utils=Chrome tmux" "$_out" "Non-Alpine: the registry is left untouched" +} + +# A typo in the table would silently hide a utility on Alpine. +test_alpine_table_names_registered() { + local _row _name _missing="" + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + for _row in "${_ALPINE_TABLE[@]}" ; do + _name="${_row%%|*}" + grep -qF "\"${_name}\"" "${SCRIPT_DIR}/lib/installers.sh" || _missing+=" $_name" + done + for _name in "${_ALPINE_OWN_HANDLERS[@]}"; do + grep -qF "\"${_name}\"" "${SCRIPT_DIR}/lib/installers.sh" || _missing+=" $_name" + done + assert_eq "" "$_missing" "Alpine table: every name is registered in installers.sh" +} + +test_alpine_detect +test_alpine_pkg_wrappers +test_alpine_sudo_shim +test_alpine_registry_filter +test_alpine_table_names_registered + echo "" echo "════════════════════════════════════════════════════════════════" echo "Test Results: ${_TESTS_PASSED} passed, ${_TESTS_FAILED} failed, ${_TESTS_SKIPPED} skipped" From 57541ffb87332b2c004bf7a1e1e8d42c1409b548 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Fri, 13 Nov 2026 21:26:58 -0500 Subject: [PATCH 02/14] feat(alpine): support apk preflight checks and non-systemd reboot Add apk to the package manager conflict and repository checks in preflight_checks, and make do_reboot run `sudo reboot` when systemd is absent, since OpenRC hosts such as Alpine have no systemctl. Add a test for the non-systemd path and note the change in the changelog. --- CHANGELOG.md | 3 ++- lib/system.sh | 15 ++++++++++++++- tests/test_linux_util.sh | 13 +++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d3be53..f69e94d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,8 @@ when a release is cut. root commands use `sudo` or `doas` when installed and otherwise `su` with the root password. On first run it offers to install the GNU `grep`, `sed`, `gawk`, `coreutils` and `findutils` that BusyBox lacks. Services are started - through OpenRC. Alpine joins the CI distro-detection matrix. + through OpenRC, and the reboot offered after an update runs `reboot` where + there is no `systemctl`. Alpine joins the CI distro-detection matrix. ### Fixed diff --git a/lib/system.sh b/lib/system.sh index f9acccf..e2073ab 100644 --- a/lib/system.sh +++ b/lib/system.sh @@ -143,6 +143,7 @@ preflight_checks() { yum) pm_names=(yum rpm) ;; pacman) pm_names=(pacman) ;; zypper) pm_names=(zypper rpm) ;; + apk) pm_names=(apk) ;; esac if [[ ${#pm_names[@]} -gt 0 ]]; then local _pm_conflict=false @@ -193,6 +194,12 @@ preflight_checks() { repo_ok=true fi ;; + apk) + # At least one active (non-comment) repository line. + if grep -qv '^[[:space:]]*\(#\|$\)' /etc/apk/repositories 2>/dev/null; then + repo_ok=true + fi + ;; esac if [[ "$repo_ok" == "true" ]]; then verbose "Package repositories accessible" @@ -243,8 +250,14 @@ setup_logrotate() { } # do_reboot reboots the system. +# systemd hosts use systemctl; OpenRC hosts (Alpine) have no systemctl, so +# they use the reboot command. do_reboot() { - sudo systemctl reboot + if has_systemd; then + sudo systemctl reboot + else + sudo reboot + fi } # ============================================================================ diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 52e9f18..4742c47 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -1470,6 +1470,7 @@ echo "=== Reboot Tests ===" test_do_reboot_host_uses_systemctl() { local out out=$( + has_systemd() { return 0; } sudo() { echo "SUDO:$*"; } do_reboot 2>&1 ) @@ -1478,6 +1479,18 @@ test_do_reboot_host_uses_systemctl() { } test_do_reboot_host_uses_systemctl +# Without systemd (Alpine/OpenRC) there is no systemctl: it must run reboot. +test_do_reboot_without_systemd_uses_reboot() { + local out + out=$( + has_systemd() { return 1; } + sudo() { echo "SUDO:$*"; } + do_reboot 2>&1 + ) + assert_eq "SUDO:reboot" "$out" "do_reboot runs sudo reboot when systemd is absent" +} +test_do_reboot_without_systemd_uses_reboot + # ---------------------------------------------------------------------------- # System info gatherer: Packages / WM / DE fields (lib/menu.sh) # ---------------------------------------------------------------------------- From 142ad00af54e8452c07575b95f85465e5a3a4fab Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 09:27:12 -0500 Subject: [PATCH 03/14] refactor: remove individual Craft app entries, keep ArtCraft Launcher Drop the CADCraft, DeckCraft, DesignCraft, EffectCraft, FilmCraft, GridCraft, LightCraft, PdfCraft, PhotoCraft, SoundCraft, VectorCraft and WordCraft entries, along with craft_apps.sh. The Craft apps are now installed from the ArtCraft Launcher instead. The launcher is listed directly under Productivity rather than in an "ArtCraft" subfolder. Previously installed copies are no longer listed or updated by System Updates. Update completions, docs, changelog and tests to match. --- CHANGELOG.md | 9 +++++ README.md | 2 +- completions/_linux_util | 12 ------ completions/linux_util.bash | 12 ------ docs/utilities.md | 3 +- lib/installers.sh | 64 +----------------------------- lib/installers/artcraft.sh | 20 ++++------ lib/installers/craft_apps.sh | 77 ------------------------------------ tests/test_linux_util.sh | 13 +++--- 9 files changed, 26 insertions(+), 186 deletions(-) delete mode 100644 lib/installers/craft_apps.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index f69e94d..8bfacec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,15 @@ when a release is cut. through OpenRC, and the reboot offered after an update runs `reboot` where there is no `systemctl`. Alpine joins the CI distro-detection matrix. +### Changed + +- **ArtCraft Launcher** is now listed directly under Productivity instead of an + "ArtCraft" folder, and the separate CADCraft, DeckCraft, DesignCraft, + EffectCraft, FilmCraft, GridCraft, LightCraft, PdfCraft, PhotoCraft, + SoundCraft, VectorCraft and WordCraft entries are gone: install the Craft apps + from the launcher. Copies this tool installed earlier are no longer listed or + updated by System Updates. + ### Fixed - **XEN Guest Utilities** on Alpine installed from the `edge` repository, which diff --git a/README.md b/README.md index 55a1940..f361e6f 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ selection rules and the profile table: [docs/menu.md](docs/menu.md). | **Gaming** | Steam, Lutris, Heroic, Bottles, Xodus Nexus, Wine, ProtonUp-Qt, MangoHud, Gamemode, Boxflat | | **Internet** | Browsers (Firefox, Brave, Chrome, Chromium, Vivaldi, LibreWolf, Zen, Thorium, Tor), email clients, messaging, and VPNs (ProtonVPN, PIA, Tailscale, WireGuard) | | **Package Managers** | Flatpak, Homebrew, Nix, Snap, deb-get, Pacstall, yay, paru — added alongside the native manager, never replacing it | -| **Productivity** | ArtCraft Launcher and the Craft App Suite, LibreOffice, OnlyOffice, WPS, GIMP, Inkscape, Krita, Kdenlive, OBS, VLC, Multimedia Codecs, Obsidian, Joplin, Logseq, Bitwarden, Nextcloud, NVIDIA PAIR, WinApps | +| **Productivity** | ArtCraft Launcher, LibreOffice, OnlyOffice, WPS, GIMP, Inkscape, Krita, Kdenlive, OBS, VLC, Multimedia Codecs, Obsidian, Joplin, Logseq, Bitwarden, Nextcloud, NVIDIA PAIR, WinApps | | **Remote Admin** | Cockpit, Enable RDP (xrdp or krdp), OpenSSH, Remmina, RustDesk, AnyDesk, Termius, Devolutions RDM, OpenRSAT | | **File Managers** | Nautilus, Dolphin, Thunar, Nemo, Caja, PCManFM-Qt, Krusader, and the terminal managers (Midnight Commander, Ranger, nnn, Superfile) | | **Firewalls** | UFW and firewalld, each with its GUI front end (Gufw, firewall-config) | diff --git a/completions/_linux_util b/completions/_linux_util index 3788584..160f45c 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -17,7 +17,6 @@ _linux_util_utilities=( 'Btop' 'Budgie Desktop' 'CachyOS Kernel Manager' - 'CADCraft' 'Chromium' 'Cinnamon Desktop' 'Claude Code' @@ -30,20 +29,16 @@ _linux_util_utilities=( 'Create Snapshot' 'Cursor IDE' 'DBeaver' - 'DeckCraft' 'Deepin Desktop' - 'DesignCraft' 'Devolutions RDM' 'Discord' 'Docker' - 'EffectCraft' 'Enable RDP' 'Evolution' 'Fastfetch' 'Fedora Mainline Kernel' 'Feral Gamemode' 'FileZilla' - 'FilmCraft' 'Firecracker' 'Firefox' 'Flatpak Setup' @@ -54,7 +49,6 @@ _linux_util_utilities=( 'GNOME Desktop' 'Google Chrome' 'GPU Task Manager' - 'GridCraft' 'GTK Window Fix' 'Hermes Agent' 'Heroic Games Launcher' @@ -66,7 +60,6 @@ _linux_util_utilities=( 'KDiskMark' 'KMail' 'LibreOffice' - 'LightCraft' 'linux-tkg' 'Local Time Zone / Locale' 'LM Studio' @@ -88,9 +81,6 @@ _linux_util_utilities=( 'OnlyOffice' 'OpenLogi' 'OpenSSH Server' - 'PdfCraft' - 'PhotoCraft' - 'SoundCraft' 'tmux' 'tmux Resurrect' 'Pantheon Desktop' @@ -123,7 +113,6 @@ _linux_util_utilities=( 'Toolbx' 'Trojita' 'UFW Firewall' - 'VectorCraft' 'Visual Studio Code' 'VSCodium' 'Vivaldi Browser' @@ -131,7 +120,6 @@ _linux_util_utilities=( 'Wine' 'WireGuard Client' 'WireGuard Server' - 'WordCraft' 'WPS Office' 'XEN Guest Utilities' 'Xfce Desktop' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index 87ecf65..f8bffd2 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -15,7 +15,6 @@ Brave Browser Btop Budgie Desktop CachyOS Kernel Manager -CADCraft Chromium Cinnamon Desktop Claude Code @@ -28,13 +27,10 @@ COSMIC Desktop Create Snapshot Cursor IDE DBeaver -DeckCraft Deepin Desktop -DesignCraft Devolutions RDM Discord Docker -EffectCraft Enable RDP Euro-Office Evolution @@ -42,7 +38,6 @@ Fastfetch Fedora Mainline Kernel Feral Gamemode FileZilla -FilmCraft Firecracker Firefox Flatpak Setup @@ -53,7 +48,6 @@ GitHub CLI GNOME Desktop Google Chrome GPU Task Manager -GridCraft GTK Window Fix Hermes Agent Heroic Games Launcher @@ -65,7 +59,6 @@ KDE Desktop KDiskMark KMail LibreOffice -LightCraft linux-tkg Local Time Zone / Locale LM Studio @@ -86,9 +79,6 @@ Obsidian OnlyOffice OpenLogi OpenSSH Server -PdfCraft -PhotoCraft -SoundCraft tmux tmux Resurrect Pantheon Desktop @@ -122,7 +112,6 @@ Toolbx Trojita Num Lock at Boot UFW Firewall -VectorCraft Visual Studio Code VSCodium Vivaldi Browser @@ -130,7 +119,6 @@ WinApps Wine WireGuard Client WireGuard Server -WordCraft WPS Office XEN Guest Utilities Xfce Desktop diff --git a/docs/utilities.md b/docs/utilities.md index b2a39b4..f436f02 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -234,8 +234,7 @@ Additional, cross-distro managers that run alongside the native package manager | Utility | Description | |---------|-------------| -| **ArtCraft Launcher** *(ArtCraft folder)* | The launcher app that installs and updates the Craft apps — `.deb` / `.rpm` / AppImage with menu entry (Arch family) | -| **CADCraft, DeckCraft, DesignCraft, EffectCraft, FilmCraft, GridCraft, LightCraft, PdfCraft, PhotoCraft, SoundCraft, VectorCraft, WordCraft** *(ArtCraft folder)* | The open-source Craft App Suite, each installed on its own from its latest GitHub release — `.deb` / `.rpm` / AppImage with menu entry (Arch family) | +| **ArtCraft Launcher** | The launcher app that installs and updates the Craft apps — `.deb` / `.rpm` / AppImage with menu entry (Arch family) | | **NVIDIA PAIR** | NVIDIA's Personal AI Router, which links home-network machines into one local AI inference cluster (Ollama, llama.cpp, LM Studio). Upstream ships a `.deb` only: installed as-is on Debian/Ubuntu, unpacked into `/opt/PAIR` elsewhere | | **Audacity** | Open-source audio editor and recorder | | **Bitwarden Client** | Open-source password manager — `.deb` / `.rpm` / AUR / snap / flatpak | diff --git a/lib/installers.sh b/lib/installers.sh index edd0380..bf42175 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -128,20 +128,7 @@ register_utility "AMD CPU Microcode & Firmware" install_amd_chipset_drivers c register_utility "Angry IP Scanner" install_angry_ip_scanner check_angry_ip_scanner uninstall_angry_ip_scanner update_angry_ip_scanner get_version_angry_ip_scanner register_utility "Ansible" install_ansible check_ansible uninstall_ansible update_ansible get_version_ansible register_utility "AnyDesk" install_anydesk check_anydesk uninstall_anydesk update_anydesk get_version_anydesk -# ArtCraft launcher and the Craft apps: one entry each, in the "ArtCraft" folder register_utility "ArtCraft Launcher" install_artcraft check_artcraft uninstall_artcraft update_artcraft get_version_artcraft -register_utility "CADCraft" install_cadcraft check_cadcraft uninstall_cadcraft update_cadcraft get_version_cadcraft -register_utility "DeckCraft" install_deckcraft check_deckcraft uninstall_deckcraft update_deckcraft get_version_deckcraft -register_utility "DesignCraft" install_designcraft check_designcraft uninstall_designcraft update_designcraft get_version_designcraft -register_utility "EffectCraft" install_effectcraft check_effectcraft uninstall_effectcraft update_effectcraft get_version_effectcraft -register_utility "FilmCraft" install_filmcraft check_filmcraft uninstall_filmcraft update_filmcraft get_version_filmcraft -register_utility "GridCraft" install_gridcraft check_gridcraft uninstall_gridcraft update_gridcraft get_version_gridcraft -register_utility "LightCraft" install_lightcraft check_lightcraft uninstall_lightcraft update_lightcraft get_version_lightcraft -register_utility "PdfCraft" install_pdfcraft check_pdfcraft uninstall_pdfcraft update_pdfcraft get_version_pdfcraft -register_utility "PhotoCraft" install_photocraft check_photocraft uninstall_photocraft update_photocraft get_version_photocraft -register_utility "SoundCraft" install_soundcraft check_soundcraft uninstall_soundcraft update_soundcraft get_version_soundcraft -register_utility "VectorCraft" install_vectorcraft check_vectorcraft uninstall_vectorcraft update_vectorcraft get_version_vectorcraft -register_utility "WordCraft" install_wordcraft check_wordcraft uninstall_wordcraft update_wordcraft get_version_wordcraft register_utility "Audacity" install_audacity check_audacity uninstall_audacity update_audacity get_version_audacity register_utility "Bitwarden Client" install_bitwarden check_bitwarden uninstall_bitwarden update_bitwarden get_version_bitwarden register_utility "GRUB" install_grub check_grub uninstall_grub update_grub get_version_grub @@ -694,18 +681,6 @@ UTILITY_CATEGORY["Ansible"]="Development" UTILITY_CATEGORY["AnyDesk"]="Remote Admin Tools" UTILITY_CATEGORY["Audacity"]="Productivity" UTILITY_CATEGORY["ArtCraft Launcher"]="Productivity" -UTILITY_CATEGORY["CADCraft"]="Productivity" -UTILITY_CATEGORY["DeckCraft"]="Productivity" -UTILITY_CATEGORY["DesignCraft"]="Productivity" -UTILITY_CATEGORY["EffectCraft"]="Productivity" -UTILITY_CATEGORY["FilmCraft"]="Productivity" -UTILITY_CATEGORY["GridCraft"]="Productivity" -UTILITY_CATEGORY["LightCraft"]="Productivity" -UTILITY_CATEGORY["PdfCraft"]="Productivity" -UTILITY_CATEGORY["PhotoCraft"]="Productivity" -UTILITY_CATEGORY["SoundCraft"]="Productivity" -UTILITY_CATEGORY["VectorCraft"]="Productivity" -UTILITY_CATEGORY["WordCraft"]="Productivity" UTILITY_CATEGORY["ClamAV"]="System Tools" UTILITY_CATEGORY["Element (Matrix)"]="Internet" UTILITY_CATEGORY["Euro-Office"]="Productivity" @@ -798,19 +773,6 @@ UTILITY_SUBCATEGORY["WireGuard Server"]="VPN" UTILITY_SUBCATEGORY["LibreOffice"]="Office Suites" UTILITY_SUBCATEGORY["OnlyOffice"]="Office Suites" UTILITY_SUBCATEGORY["WPS Office"]="Office Suites" -UTILITY_SUBCATEGORY["ArtCraft Launcher"]="ArtCraft" -UTILITY_SUBCATEGORY["CADCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["DeckCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["DesignCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["EffectCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["FilmCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["GridCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["LightCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["PdfCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["PhotoCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["SoundCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["VectorCraft"]="ArtCraft" -UTILITY_SUBCATEGORY["WordCraft"]="ArtCraft" UTILITY_SUBCATEGORY["Obsidian"]="Notes" UTILITY_SUBCATEGORY["Standard Notes"]="Notes" UTILITY_SUBCATEGORY["Joplin Client"]="Notes" @@ -1096,19 +1058,7 @@ UTILITY_DESCRIPTION["WireGuard Server"]="Sets up a WireGuard VPN server for secu UTILITY_DESCRIPTION["Zoom"]="Video conferencing platform for meetings, webinars, and team collaboration." # Productivity -UTILITY_DESCRIPTION["ArtCraft Launcher"]="The ArtCraft Launcher app: one place to install, update, and open the Craft App Suite (PhotoCraft, PdfCraft, and the rest). The Craft apps below can also be installed on their own." -UTILITY_DESCRIPTION["CADCraft"]="Open-source, clean-room AutoCAD-style computer-aided design and drafting app, written in Rust." -UTILITY_DESCRIPTION["DeckCraft"]="Open-source, clean-room PowerPoint-style presentation app, written in Rust." -UTILITY_DESCRIPTION["DesignCraft"]="Open-source page layout and publishing app (InDesign-style), written in Rust." -UTILITY_DESCRIPTION["EffectCraft"]="Open-source motion graphics and visual effects app (After Effects-style), written in Rust." -UTILITY_DESCRIPTION["FilmCraft"]="Open-source video editor (Premiere Pro-style), written in Rust." -UTILITY_DESCRIPTION["GridCraft"]="Open-source, clean-room Excel-style spreadsheet, written in Rust." -UTILITY_DESCRIPTION["LightCraft"]="Open-source photo library and raw developer (Lightroom-style), written in Rust." -UTILITY_DESCRIPTION["PdfCraft"]="Open-source PDF workbench (Acrobat-style) for reading, organizing, combining, splitting, and securing PDFs, written in Rust." -UTILITY_DESCRIPTION["PhotoCraft"]="Open-source image editor (Photoshop-style), written in Rust." -UTILITY_DESCRIPTION["SoundCraft"]="Open-source, clean-room Pro Tools-style audio workstation, written in Rust." -UTILITY_DESCRIPTION["VectorCraft"]="Open-source vector illustration app (Illustrator-style), written in Rust." -UTILITY_DESCRIPTION["WordCraft"]="Open-source, clean-room Word-style word processor, written in Rust." +UTILITY_DESCRIPTION["ArtCraft Launcher"]="The ArtCraft Launcher app: one place to install, update, and open the Craft App Suite (PhotoCraft, PdfCraft, and the rest)." UTILITY_DESCRIPTION["Audacity"]="Free, open-source multi-track audio editor and recorder for recording, editing, and exporting audio files." UTILITY_DESCRIPTION["Bitwarden Client"]="Open-source password manager for securely storing and auto-filling credentials." UTILITY_DESCRIPTION["Flameshot"]="Powerful, customizable screenshot tool with built-in annotation and markup capabilities." @@ -1254,18 +1204,6 @@ mark_upstream_binary \ "PowerShell=/opt/microsoft/powershell" \ "Libation=/usr/lib/libation" \ "ArtCraft Launcher=$HOME/Applications/artcraft-launcher.AppImage" \ - "CADCraft=$HOME/Applications/cadcraft.AppImage" \ - "DeckCraft=$HOME/Applications/deckcraft.AppImage" \ - "DesignCraft=$HOME/Applications/designcraft.AppImage" \ - "EffectCraft=$HOME/Applications/effectcraft.AppImage" \ - "FilmCraft=$HOME/Applications/filmcraft.AppImage" \ - "GridCraft=$HOME/Applications/gridcraft.AppImage" \ - "LightCraft=$HOME/Applications/lightcraft.AppImage" \ - "PdfCraft=$HOME/Applications/pdfcraft.AppImage" \ - "PhotoCraft=$HOME/Applications/photocraft.AppImage" \ - "SoundCraft=$HOME/Applications/soundcraft.AppImage" \ - "VectorCraft=$HOME/Applications/vectorcraft.AppImage" \ - "WordCraft=$HOME/Applications/wordcraft.AppImage" \ "Claude Desktop=$_CLAUDE_DESKTOP_BOX_VERSION_FILE" \ "Xodus Nexus=$_XN_APPIMAGE" \ "Hermes Agent=$HOME/.hermes/hermes-agent" \ diff --git a/lib/installers/artcraft.sh b/lib/installers/artcraft.sh index f80ea6f..76f0d05 100644 --- a/lib/installers/artcraft.sh +++ b/lib/installers/artcraft.sh @@ -1,19 +1,15 @@ #!/bin/bash -# ArtCraft installer functions -# ArtCraft Launcher, plus the helpers shared with the individual Craft apps -# (lib/installers/craft_apps.sh). +# ArtCraft Launcher installer functions # --- ArtCraft --- -# Every Craft app, and the launcher, publishes the same release layout on -# GitHub: --linux-.{deb,rpm,AppImage,flatpak} -# with a SHA256SUMS.txt beside them, and the .deb/.rpm package is named after -# the app. That is why one set of helpers serves all of them. The main ArtCraft -# desktop app (storytold/artcraft) is deliberately not what "ArtCraft" installs: -# it publishes Windows and macOS builds only. -# -# This is deliberately the only copy of the download/install logic for these -# apps -- craft_apps.sh calls it, so do not add a second one. +# The launcher publishes its releases on GitHub as +# --linux-.{deb,rpm,AppImage,flatpak} with a +# SHA256SUMS.txt beside them, and the .deb/.rpm package is named after the app. +# The Craft apps it installs (PhotoCraft, PdfCraft, ...) are left to the +# launcher; they are not separate entries here. The main ArtCraft desktop app +# (storytold/artcraft) is deliberately not what "ArtCraft" installs: it +# publishes Windows and macOS builds only. _craft_arch() { case "$(uname -m)" in diff --git a/lib/installers/craft_apps.sh b/lib/installers/craft_apps.sh deleted file mode 100644 index 7085534..0000000 --- a/lib/installers/craft_apps.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# Craft App Suite installer functions (PhotoCraft, VectorCraft, ...). -# Each app is a thin wrapper over the shared helpers in artcraft.sh. - -# --- Craft apps --- - -check_photocraft() { _craft_check photocraft; } -install_photocraft() { _craft_install photocraft photocraft "PhotoCraft"; } -uninstall_photocraft() { _craft_uninstall photocraft "PhotoCraft"; } -update_photocraft() { _craft_update photocraft photocraft "PhotoCraft"; } -get_version_photocraft() { _craft_version photocraft; } - -check_vectorcraft() { _craft_check vectorcraft; } -install_vectorcraft() { _craft_install vectorcraft vectorcraft "VectorCraft"; } -uninstall_vectorcraft() { _craft_uninstall vectorcraft "VectorCraft"; } -update_vectorcraft() { _craft_update vectorcraft vectorcraft "VectorCraft"; } -get_version_vectorcraft() { _craft_version vectorcraft; } - -check_filmcraft() { _craft_check filmcraft; } -install_filmcraft() { _craft_install filmcraft filmcraft "FilmCraft"; } -uninstall_filmcraft() { _craft_uninstall filmcraft "FilmCraft"; } -update_filmcraft() { _craft_update filmcraft filmcraft "FilmCraft"; } -get_version_filmcraft() { _craft_version filmcraft; } - -check_lightcraft() { _craft_check lightcraft; } -install_lightcraft() { _craft_install lightcraft lightcraft "LightCraft"; } -uninstall_lightcraft() { _craft_uninstall lightcraft "LightCraft"; } -update_lightcraft() { _craft_update lightcraft lightcraft "LightCraft"; } -get_version_lightcraft() { _craft_version lightcraft; } - -check_pdfcraft() { _craft_check pdfcraft; } -install_pdfcraft() { _craft_install pdfcraft pdfcraft "PdfCraft"; } -uninstall_pdfcraft() { _craft_uninstall pdfcraft "PdfCraft"; } -update_pdfcraft() { _craft_update pdfcraft pdfcraft "PdfCraft"; } -get_version_pdfcraft() { _craft_version pdfcraft; } - -check_effectcraft() { _craft_check effectcraft; } -install_effectcraft() { _craft_install effectcraft effectcraft "EffectCraft"; } -uninstall_effectcraft() { _craft_uninstall effectcraft "EffectCraft"; } -update_effectcraft() { _craft_update effectcraft effectcraft "EffectCraft"; } -get_version_effectcraft() { _craft_version effectcraft; } - -check_designcraft() { _craft_check designcraft; } -install_designcraft() { _craft_install designcraft designcraft "DesignCraft"; } -uninstall_designcraft() { _craft_uninstall designcraft "DesignCraft"; } -update_designcraft() { _craft_update designcraft designcraft "DesignCraft"; } -get_version_designcraft() { _craft_version designcraft; } - -check_wordcraft() { _craft_check wordcraft; } -install_wordcraft() { _craft_install wordcraft wordcraft "WordCraft"; } -uninstall_wordcraft() { _craft_uninstall wordcraft "WordCraft"; } -update_wordcraft() { _craft_update wordcraft wordcraft "WordCraft"; } -get_version_wordcraft() { _craft_version wordcraft; } - -check_deckcraft() { _craft_check deckcraft; } -install_deckcraft() { _craft_install deckcraft deckcraft "DeckCraft"; } -uninstall_deckcraft() { _craft_uninstall deckcraft "DeckCraft"; } -update_deckcraft() { _craft_update deckcraft deckcraft "DeckCraft"; } -get_version_deckcraft() { _craft_version deckcraft; } - -check_gridcraft() { _craft_check gridcraft; } -install_gridcraft() { _craft_install gridcraft gridcraft "GridCraft"; } -uninstall_gridcraft() { _craft_uninstall gridcraft "GridCraft"; } -update_gridcraft() { _craft_update gridcraft gridcraft "GridCraft"; } -get_version_gridcraft() { _craft_version gridcraft; } - -check_cadcraft() { _craft_check cadcraft; } -install_cadcraft() { _craft_install cadcraft cadcraft "CADCraft"; } -uninstall_cadcraft() { _craft_uninstall cadcraft "CADCraft"; } -update_cadcraft() { _craft_update cadcraft cadcraft "CADCraft"; } -get_version_cadcraft() { _craft_version cadcraft; } - -check_soundcraft() { _craft_check soundcraft; } -install_soundcraft() { _craft_install soundcraft soundcraft "SoundCraft"; } -uninstall_soundcraft() { _craft_uninstall soundcraft "SoundCraft"; } -update_soundcraft() { _craft_update soundcraft soundcraft "SoundCraft"; } -get_version_soundcraft() { _craft_version soundcraft; } diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 4742c47..606b9e6 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -5060,21 +5060,20 @@ test_bat_batcat_link echo "" echo "=== ArtCraft / Craft apps ===" -test_craft_apps_registered_in_artcraft_subcategory() { +test_artcraft_launcher_registered_in_productivity() { local name fn slug gaps=0 - for name in "ArtCraft Launcher" CADCraft DeckCraft DesignCraft EffectCraft FilmCraft GridCraft \ - LightCraft PdfCraft PhotoCraft SoundCraft VectorCraft WordCraft; do + for name in "ArtCraft Launcher"; do slug=$(printf '%s' "${name%% Launcher}" | tr '[:upper:]' '[:lower:]') grep -q "^register_utility \"${name}\" install_${slug} " "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q "^UTILITY_CATEGORY\[\"${name}\"\]=\"Productivity\"" "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 - grep -q "^UTILITY_SUBCATEGORY\[\"${name}\"\]=\"ArtCraft\"" "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + grep -q "^UTILITY_SUBCATEGORY\[\"${name}\"\]" "${SCRIPT_DIR}/lib/installers.sh" && gaps=1 grep -q "^UTILITY_DESCRIPTION\[\"${name}\"\]=" "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 for fn in install check uninstall update; do grep -qE "^${fn}_${slug}\(\)|^${fn}_${slug}[[:space:]]*\(\)" \ - "${SCRIPT_DIR}/lib/installers/artcraft.sh" "${SCRIPT_DIR}/lib/installers/craft_apps.sh" 2>/dev/null || gaps=1 + "${SCRIPT_DIR}/lib/installers/artcraft.sh" 2>/dev/null || gaps=1 done done - assert_eq "0" "$gaps" "all 13 ArtCraft entries are registered with category, subcategory, description and functions" + assert_eq "0" "$gaps" "ArtCraft Launcher is registered in Productivity (no subcategory) with description and functions" } test_craft_asset_url_picks_package_not_sidecar() { @@ -5098,7 +5097,7 @@ test_craft_asset_url_picks_package_not_sidecar() { "$out" "_craft_asset_url selects the exact package for this architecture, not a sidecar or the CLI tarball" } -test_craft_apps_registered_in_artcraft_subcategory +test_artcraft_launcher_registered_in_productivity test_craft_asset_url_picks_package_not_sidecar # ============================================================================ From a05713c0e38002b3c01e33e6ab9da44ea2cd8ad7 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 09:33:29 -0500 Subject: [PATCH 04/14] ci: add Alpine 3.22/3.23 and openSUSE Leap 16.0 to distro matrix Add Alpine 3.23, Alpine 3.22 and openSUSE Leap 16.0 to the distro-smoke matrix, so every still-supported release of those distros is checked. Annotate each matrix entry with its EOL date from endoflife.date and add a note on the next release due to be dropped (Fedora 43, 2026-12-01) and the upcoming releases to add. This makes matrix upkeep easier. Update the README and CHANGELOG to list the newly covered distros. --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++++++++ CHANGELOG.md | 3 ++- README.md | 7 ++++--- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8fec0b..c1a69eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,54 +45,68 @@ jobs: # Every release still supported by its distro (https://endoflife.date), # so keep this list current: add a release when it ships, drop it at # end of life. Arch and Tumbleweed are rolling, so one image each. + # Each entry carries its EOL date; next due: Fedora 43 on 2026-12-01. + # Also add Debian 14 / Fedora 46 / Ubuntu 27.04 / Alpine 3.25 when they ship. include: - image: debian:13 + # EOL 2030-06-30 (endoflife.date): drop this entry on or just after that day name: Debian 13 family: debian pkg_mgr: apt - image: debian:12 + # EOL 2028-06-30 (endoflife.date): drop this entry on or just after that day name: Debian 12 family: debian pkg_mgr: apt - image: ubuntu:26.10 + # EOL 2027-07-01 (endoflife.date): drop this entry on or just after that day name: Ubuntu 26.10 family: debian pkg_mgr: apt - image: ubuntu:26.04 + # EOL 2031-05-29 (endoflife.date): drop this entry on or just after that day name: Ubuntu 26.04 family: debian pkg_mgr: apt - image: ubuntu:24.04 + # EOL 2029-05-31 (endoflife.date): drop this entry on or just after that day name: Ubuntu 24.04 family: debian pkg_mgr: apt - image: ubuntu:22.04 + # EOL 2027-06-01 (endoflife.date): drop this entry on or just after that day name: Ubuntu 22.04 family: debian pkg_mgr: apt - image: fedora:45 + # EOL 2027-12-08 (endoflife.date): drop this entry on or just after that day name: Fedora 45 family: fedora pkg_mgr: dnf - image: fedora:44 + # EOL 2027-06-02 (endoflife.date): drop this entry on or just after that day name: Fedora 44 family: fedora pkg_mgr: dnf - image: fedora:43 + # EOL 2026-12-01 (endoflife.date): drop this entry on or just after that day name: Fedora 43 family: fedora pkg_mgr: dnf # Rocky 10 is published only under rockylinux/rockylinux, not the # Docker Official Images name used for Rocky 8 and 9. - image: rockylinux/rockylinux:10 + # EOL 2035-05-31 (endoflife.date): drop this entry on or just after that day name: Rocky Linux 10 family: rhel pkg_mgr: dnf - image: rockylinux:9 + # EOL 2032-05-31 (endoflife.date): drop this entry on or just after that day name: Rocky Linux 9 family: rhel pkg_mgr: dnf - image: rockylinux:8 + # EOL 2029-05-31 (endoflife.date): drop this entry on or just after that day name: Rocky Linux 8 family: rhel pkg_mgr: dnf @@ -104,10 +118,26 @@ jobs: name: openSUSE Tumbleweed family: suse pkg_mgr: zypper + - image: opensuse/leap:16.0 + # EOL 2027-10-31 (endoflife.date): drop this entry on or just after that day + name: openSUSE Leap 16.0 + family: suse + pkg_mgr: zypper - image: alpine:3.24 + # EOL 2028-06-01 (endoflife.date): drop this entry on or just after that day name: Alpine 3.24 family: alpine pkg_mgr: apk + - image: alpine:3.23 + # EOL 2027-11-01 (endoflife.date): drop this entry on or just after that day + name: Alpine 3.23 + family: alpine + pkg_mgr: apk + - image: alpine:3.22 + # EOL 2027-05-01 (endoflife.date): drop this entry on or just after that day + name: Alpine 3.22 + family: alpine + pkg_mgr: apk container: image: ${{ matrix.image }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bfacec..41ac431 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,8 @@ when a release is cut. root password. On first run it offers to install the GNU `grep`, `sed`, `gawk`, `coreutils` and `findutils` that BusyBox lacks. Services are started through OpenRC, and the reboot offered after an update runs `reboot` where - there is no `systemctl`. Alpine joins the CI distro-detection matrix. + there is no `systemctl`. Alpine 3.22, 3.23 and 3.24 and openSUSE Leap 16.0 + join the CI distro-detection matrix. ### Changed diff --git a/README.md b/README.md index f361e6f..89dc45d 100644 --- a/README.md +++ b/README.md @@ -206,9 +206,10 @@ of `grep`, `sed`, `gawk`, `coreutils` and `findutils` that BusyBox lacks. Unrecognised distributions are matched via `ID_LIKE` in `/etc/os-release`, then by auto-detecting the available package manager. -CI checks distro detection on every release of Debian, Ubuntu, Fedora and Rocky -Linux that is still supported, plus Arch Linux and openSUSE Tumbleweed (see the -`distro-smoke` job in [ci.yml](.github/workflows/ci.yml)). +CI checks distro detection on every release of Debian, Ubuntu, Fedora, Rocky +Linux, openSUSE Leap and Alpine that is still supported, plus Arch Linux and +openSUSE Tumbleweed (see the `distro-smoke` job in +[ci.yml](.github/workflows/ci.yml)). --- From 0b54c7d037c42f42757533a9028424c633260948 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 09:35:48 -0500 Subject: [PATCH 05/14] chore(ci): add weekly distro EOL check workflow Add a scheduled workflow that compares the CI distro matrix with endoflife.date and keeps a single issue open while a release needs dropping (end of life) or adding (newly supported). Document the change in the changelog. --- .github/scripts/check_distro_eol.py | 77 +++++++++++++++++++++++++++++ .github/workflows/distro-eol.yml | 38 ++++++++++++++ CHANGELOG.md | 3 ++ 3 files changed, 118 insertions(+) create mode 100644 .github/scripts/check_distro_eol.py create mode 100644 .github/workflows/distro-eol.yml diff --git a/.github/scripts/check_distro_eol.py b/.github/scripts/check_distro_eol.py new file mode 100644 index 0000000..7f5c868 --- /dev/null +++ b/.github/scripts/check_distro_eol.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +"""Compare the distro-smoke matrix in ci.yml with endoflife.date. + +Writes a Markdown report to the path given as argv[2] when the matrix needs +attention (an entry is past end of life, or a supported release is missing) and +leaves the file absent otherwise. Always exits 0 unless the API is unreachable. +""" +import datetime +import json +import re +import sys +import urllib.request + +# image repository -> (endoflife.date product, label) +PRODUCTS = { + "debian": "debian", + "ubuntu": "ubuntu", + "fedora": "fedora", + "rockylinux": "rocky-linux", + "rockylinux/rockylinux": "rocky-linux", + "opensuse/leap": "opensuse", + "alpine": "alpine", +} +# Rolling releases (archlinux:base, opensuse/tumbleweed) are not in PRODUCTS. + + +def fetch(product): + url = f"https://endoflife.date/api/{product}.json" + with urllib.request.urlopen(url, timeout=30) as resp: + return json.load(resp) + + +def main(ci_path, report_path): + today = datetime.date.today().isoformat() + text = open(ci_path, encoding="utf-8").read() + used = {} # product -> {cycle: image} + for image in re.findall(r"^\s*- image:\s*(\S+)", text, re.M): + repo, _, tag = image.partition(":") + if repo in PRODUCTS: + used.setdefault(PRODUCTS[repo], {})[tag] = image + + drop, add = [], [] + for product, cycles in sorted(used.items()): + releases = {str(r["cycle"]): r for r in fetch(product)} + for cycle, image in sorted(cycles.items()): + rel = releases.get(cycle) + if rel is None: + drop.append(f"- `{image}`: `{cycle}` is not listed on endoflife.date for {product}; check the tag") + continue + eol = rel.get("eol") + if eol is True or (isinstance(eol, str) and eol <= today): + drop.append(f"- `{image}`: end of life ({eol}); remove it from the matrix and the README if named there") + for cycle, rel in releases.items(): + eol = rel.get("eol") + if eol is True or (isinstance(eol, str) and eol <= today): + continue + released = rel.get("releaseDate") + if cycle not in cycles and isinstance(released, str) and released <= today: + add.append(f"- {product} `{cycle}` (released {released}, supported until {eol}) has no matrix entry") + + if not drop and not add: + print("Matrix is current.") + return + lines = [f"Checked against https://endoflife.date on {today}.", ""] + if drop: + lines += ["### Drop (end of life)", *drop, ""] + if add: + lines += ["### Add (supported, not tested)", *add, ""] + lines += ["Edit the `distro-smoke` matrix in `.github/workflows/ci.yml` and its EOL comments, then update the " + "README and CHANGELOG. This issue is kept up to date by `distro-eol.yml` and closes itself once the " + "matrix is current."] + open(report_path, "w", encoding="utf-8").write("\n".join(lines) + "\n") + print("\n".join(lines)) + + +if __name__ == "__main__": + main(sys.argv[1], sys.argv[2]) diff --git a/.github/workflows/distro-eol.yml b/.github/workflows/distro-eol.yml new file mode 100644 index 0000000..3e72bb3 --- /dev/null +++ b/.github/workflows/distro-eol.yml @@ -0,0 +1,38 @@ +name: Distro EOL check + +# Weekly: compare the distro-smoke matrix in ci.yml with endoflife.date and keep +# one issue open while a release needs dropping or adding. +on: + schedule: + - cron: "17 6 * * 1" + workflow_dispatch: + +permissions: + contents: read + issues: write + +jobs: + check: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ github.token }} + TITLE: "CI distro matrix needs updating (EOL / new releases)" + steps: + - uses: actions/checkout@v4 + + - name: Compare matrix with endoflife.date + run: python3 .github/scripts/check_distro_eol.py .github/workflows/ci.yml "$RUNNER_TEMP/report.md" + + - name: Open, update or close the tracking issue + run: | + existing=$(gh issue list --state open --search "\"$TITLE\" in:title" --json number,title \ + --jq "map(select(.title == \"$TITLE\"))[0].number // empty") + if [ -f "$RUNNER_TEMP/report.md" ]; then + if [ -n "$existing" ]; then + gh issue edit "$existing" --body-file "$RUNNER_TEMP/report.md" + else + gh issue create --title "$TITLE" --body-file "$RUNNER_TEMP/report.md" + fi + elif [ -n "$existing" ]; then + gh issue close "$existing" --comment "Matrix is current again." + fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 41ac431..6772fc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,9 @@ when a release is cut. ### Changed +- **Weekly distro EOL check.** A scheduled workflow compares the CI distro + matrix with endoflife.date and keeps one issue open while a release needs + dropping (end of life) or adding (newly supported). - **ArtCraft Launcher** is now listed directly under Productivity instead of an "ArtCraft" folder, and the separate CADCraft, DeckCraft, DesignCraft, EffectCraft, FilmCraft, GridCraft, LightCraft, PdfCraft, PhotoCraft, From 875cbe49785e3acf36e3bbbc44798b0152b4fa2b Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 09:54:59 -0500 Subject: [PATCH 06/14] docs: complete utilities catalogue with missing categories and entries Add File Managers, Firewalls, Login Screens and Window Managers tables to docs/utilities.md, along with the previously missing entries (Angry IP Scanner, Brave Debloat, LocalSend, PowerShell, Snapper GUI, fail2ban, Unattended Upgrades, Configure Syncthing Folders). Replace the "Incomplete" notice with a pointer to `./linux_util.sh --list` and note the change in the CHANGELOG. --- CHANGELOG.md | 5 ++++ docs/utilities.md | 76 ++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 73 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6772fc3..5634c2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,11 @@ when a release is cut. ### Changed +- **Utility catalogue is complete.** `docs/utilities.md` now lists every + utility and system task the menu offers, including the File Managers, + Firewalls, Login Screens and Window Managers categories and the entries that + were missing (Angry IP Scanner, Brave Debloat, LocalSend, PowerShell, + Snapper GUI, fail2ban, Unattended Upgrades, Configure Syncthing Folders). - **Weekly distro EOL check.** A scheduled workflow compares the CI distro matrix with endoflife.date and keeps one issue open while a release needs dropping (end of life) or adding (newly supported). diff --git a/docs/utilities.md b/docs/utilities.md index f436f02..6d52d3c 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -14,15 +14,12 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | [Desktop Environments](#desktop-environments) | [Backup](#backup) | [Disk Utilities](#disk-utilities) | | [Development](#development) | [Gaming](#gaming) | [Internet](#internet) | | [Package Managers](#package-managers) | [Productivity](#productivity) | [Remote Admin Tools](#remote-admin-tools) | -| [System Tools](#system-tools) | | | +| [File Managers](#file-managers) | [Firewalls](#firewalls) | [Login Screens](#login-screens) | +| [System Tools](#system-tools) | [Window Managers](#window-managers) | | -> **Incomplete:** 249 utilities and system tasks are registered in -> `lib/installers.sh`; 204 are listed below. The **File Managers**, **Firewalls**, -> **Login Screens** and **Window Managers** categories have no table here at all, -> and a handful of entries in the documented categories are missing too (Angry IP -> Scanner, Brave Debloat, LocalSend, PowerShell, Snapper GUI, fail2ban, -> Unattended Upgrades). Run `./linux_util.sh --list` for the -> authoritative list. +Run `./linux_util.sh --list` for the live list on your own machine. Entries +that depend on the distribution (for example the Debian/Ubuntu-only tasks) only +appear when it applies. ## System Tasks @@ -42,7 +39,11 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | **UFW Firewall** | Installs and configures Uncomplicated Firewall with sensible defaults | | **Num Lock at Boot** | Enables Num Lock on TTY consoles and the display manager login screen | | **Parallel Downloads** | Raises parallel package downloads to 10 — `max_parallel_downloads` in `/etc/dnf/dnf.conf` or `ParallelDownloads` in `/etc/pacman.conf`; backs up the file first and is reversible *(Fedora/RHEL/Arch only)* | +| **Configure Syncthing Folders** | Wizard that picks which folders Syncthing syncs, following Linux best practice — nothing changes without your confirmation | | **Local Time Zone / Locale** | Interactive wizard to set system time zone, locale, or both | +| **Unattended Upgrades** | Enables the `unattended-upgrades` package so security (and optionally other) updates install automatically in the background, using the package's own debconf setup *(Debian/Ubuntu only)* | +| **Configure Unattended Upgrades** | Opens `/etc/apt/apt.conf.d/50unattended-upgrades` in your editor to choose update origins, blacklist packages and set auto-reboot and notifications; only shown once the package is installed *(Debian/Ubuntu only)* | +| **Install fail2ban** | Installs fail2ban and enables its service, banning IPs that repeatedly fail logins *(Debian/Ubuntu only)* | | **GTK Window Fix** | Restores minimize/maximize/close on window title bars for GTK apps (GNOME/Cinnamon/MATE/Xfce); GNOME's default window-manager button layout omits them | | **Command-Not-Found Prompt** | Enables auto-suggestion to install missing command packages *(Ubuntu/Kubuntu/KDE Neon only)* | | **Fix Grub on BTRFS** | Fixes GRUB boot entries after BTRFS snapshot restores *(Ubuntu/Kubuntu/KDE Neon only)* | @@ -104,6 +105,7 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | **Create Snapshot (Snapper)** | Creates a Snapper snapshot with a user-provided description | | **Restore Snapshot (Snapper)** | Restores from a Snapper snapshot | | **Delete Snapshot (Snapper)** | Lists and deletes existing Snapper snapshots | +| **Snapper GUI** | GTK graphical interface for Snapper — browse, create, delete and compare snapshots on any filesystem Snapper supports; Btrfs is not required | | **Déjà Dup** | Simple GNOME backup tool with cloud and local storage support | | **Kup** | KDE backup tool — incremental (bup) or synchronized (rsync) backups via System Settings | | **Vorta** | Borg Backup GUI — deduplicating, encrypted backups | @@ -148,6 +150,7 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | **NVM** | Node Version Manager — install and switch Node.js versions | | **OpenTofu** | Open-source Terraform-compatible infrastructure-as-code tool | | **Podman** | Daemonless OCI container engine | +| **PowerShell** | Microsoft's cross-platform automation shell built on .NET — Microsoft's apt repo where available, otherwise the GitHub release `.deb` | | **Postman** | API development and testing platform | | **pyenv** | Python version manager | | **Rustup** | Rust toolchain installer and version manager | @@ -177,10 +180,12 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | Utility | Description | |---------|-------------| +| **Angry IP Scanner** | Network scanner that pings IP ranges, resolves hostnames, scans ports and exports CSV, TXT or XML; needs Java | | **Betterbird** | Thunderbird fork with extra fixes and features — Flatpak / AUR | | **Bitwarden Extension** | Bitwarden browser extension installer | | **Brave Browser** | Privacy-focused Chromium browser with built-in ad blocking | | **Brave Origin** | Streamlined Brave build without Rewards, Wallet, VPN, and Leo AI | +| **Brave Debloat** | Turns off Brave's Rewards, Wallet, VPN, Leo AI, News, Talk and Tor through enterprise policy, and disables telemetry *(Web Browser Tweaks)* | | **Chromium** | Open-source browser, upstream base for Chrome | | **Claws Mail** | Fast, lightweight GTK email client with a plugin system | | **Discord** | Voice, video, and text communication platform | @@ -193,6 +198,7 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | **Joplin Web Clipper** | Browser extension for saving web content to Joplin | | **KMail** | KDE's email client with PGP encryption | | **LibreWolf** | Privacy-hardened Firefox fork | +| **LocalSend** | Open-source AirDrop alternative — sends files and text between devices on the same network with no account or cloud; uses port 53317. Official `.deb` on Debian/Ubuntu, Flathub elsewhere *(File Transfer)* | | **NeoMutt** | Terminal email client, a maintained fork of Mutt | | **PIA VPN** | Private Internet Access VPN client | | **Proton Mail Bridge** | Local IMAP/SMTP gateway for Proton Mail — needs a paid plan | @@ -277,6 +283,48 @@ Additional, cross-distro managers that run alongside the native package manager | **Termius SSH Client** | Modern SSH client with cross-device sync *(Remote Access)* | | **OpenRSAT** | Active Directory management console (Microsoft RSAT-like) from Tranquil IT — installs the latest GitHub release as a `.deb` (Debian/Ubuntu), `.rpm` (Fedora/RHEL x86_64), or standalone binary (openSUSE); not available on Arch | +## File Managers + +| Utility | Description | +|---------|-------------| +| **Nautilus** | GNOME's default file manager (Files) — simple GTK interface with sidebar and network browsing *(Graphical)* | +| **Dolphin** | KDE Plasma's default file manager — split views, tabs, embedded terminal and KIO protocols (`sftp://`, `smb://`) *(Graphical)* | +| **Thunar** | Xfce's fast, lightweight file manager with bulk rename and custom actions *(Graphical)* | +| **Nemo** | Cinnamon's file manager, a Nautilus fork with dual-pane view and an editable address bar *(Graphical)* | +| **Caja** | MATE's file manager, a GNOME 2-era fork with dual-pane view and plugins *(Graphical)* | +| **PCManFM-Qt** | LXQt's very lightweight file manager with tabs, dual panes and trash *(Graphical)* | +| **Krusader** | Twin-panel file manager for KDE in the style of Total Commander — archives, batch rename, comparison and sync *(Graphical)* | +| **Midnight Commander** | Classic text-mode twin-panel file manager (`mc`) with built-in editor and FTP/SFTP *(Terminal)* | +| **Ranger** | Vim-style terminal file manager with Miller columns and previews *(Terminal)* | +| **nnn** | Tiny, fast terminal file manager with optional previews and plugins *(Terminal)* | +| **Superfile** | Modern terminal file manager (`spf`) with multiple panes, previews, fuzzy search and themes *(Terminal)* | + +Any of these runs on any desktop; the desktop-named ones pull in that desktop's libraries. + +## Firewalls + +| Utility | Description | +|---------|-------------| +| **Gufw (Firewall GUI)** | Graphical front-end for UFW — status, rules and app profiles; installs UFW first if needed | +| **firewalld** | Zone-based firewall daemon, the default on Fedora, RHEL and openSUSE; disables UFW first if it is active | +| **firewall-config (GUI)** | Graphical tool for firewalld zones, services, ports and rich rules; installs firewalld first if needed | + +UFW Firewall is listed under [System Tasks](#system-tasks). + +## Login Screens + +| Utility | Description | +|---------|-------------| +| **SDDM** | Qt display manager used by KDE Plasma and LXQt; enabled when no login screen is active, otherwise asks first. Reboot to use it *(Display Managers)* | +| **GDM** | GNOME's GTK display manager (`gdm3` on Debian/Ubuntu, `gdm` elsewhere) *(Display Managers)* | +| **LightDM** | Lightweight cross-desktop display manager, installed with a GTK greeter *(Display Managers)* | +| **ly** | Minimal text-mode display manager that needs no X/Wayland greeter; packaged on Arch and openSUSE only *(Display Managers)* | +| **LXDM** | Lightweight GTK display manager from LXDE *(Display Managers)* | +| **SDDM Breeze Theme** | Sets KDE's Breeze as the SDDM login theme through an `/etc/sddm.conf.d` drop-in *(SDDM Themes)* | +| **SDDM Sugar Candy** | Configurable QtQuick SDDM theme with a blurred background, downloaded from GitHub *(SDDM Themes)* | +| **SDDM Astronaut** | QtQuick SDDM theme bundle in several sci-fi styles, downloaded from GitHub *(SDDM Themes)* | +| **LightDM Slick Greeter** | The themeable GTK greeter used by Linux Mint, selected for LightDM through a drop-in *(LightDM Greeters)* | + ## System Tools | Utility | Description | @@ -303,3 +351,15 @@ Grouped under a **Kernel Managers** folder inside the System Tools tab — tools | **CachyOS Kernel Manager** | GUI to install/build/swap kernels on Arch (also configures sched-ext). Ships only in the CachyOS repo, not the AUR; installs where that repo is enabled | | **Fedora Mainline Kernel** | Enables the `@kernel-vanilla/mainline` Copr and installs the latest upstream mainline kernel. Fedora only (requires Secure Boot disabled) | | **linux-tkg** | Frogging-Family custom-kernel **builder** — compiles a kernel from source with your choice of scheduler (BORE/EEVDF/PDS), compiler, and config. Cross-distro (Arch via makepkg; Debian/Ubuntu, Fedora, openSUSE via `install.sh`). Interactive, long compile | + +## Window Managers + +| Utility | Description | +|---------|-------------| +| **awesome** | Highly configurable X11 window manager with dynamic tiling, configured in Lua | +| **bspwm** | X11 tiling window manager that arranges windows as a binary tree, controlled by `bspc`; installs `sxhkd` for keybindings | +| **dwm** | Suckless dynamic X11 window manager; the packaged build is stock, changes need editing `config.h` and recompiling | +| **Hyprland** | Animated Wayland tiling compositor — Arch, Fedora, openSUSE Tumbleweed and Ubuntu 24.04+; not RHEL or Debian stable | +| **i3** | Classic X11 tiling window manager with simple text configuration | +| **Openbox** | Minimal, fast X11 stacking window manager with XML configuration | +| **Sway** | Wayland tiling compositor, a drop-in replacement for i3 that reads i3 configs | From fbc946853c86a0065b3bcf587791d8417ca0f068 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 10:31:29 -0500 Subject: [PATCH 07/14] feat: add 16 Productivity apps and sort them into folders Add 1Password, KeePassXC, Cryptomator, VeraCrypt, mpv, Kodi, Spotify, Blender, Darktable, RawTherapee, Shotcut, Scribus, Calibre, Anki, Okular and Xournal++ (#91). - Add shared native_or_flatpak helpers and pkg_in_repo: use the distro package when its repository has one, otherwise Flathub - 1Password uses its signed vendor repository (AUR on Arch); VeraCrypt installs the GitHub release after checking its signature against the pinned key - Spotify and Cryptomator always use Flathub - Offer the apps Alpine packages and hide the rest there - Group Productivity into Office Suites, Notes, Password Managers, Encryption, Documents & Reading, Graphics & Photo, Video & Audio and Media subcategories - Update completions, README, docs, changelog and tests --- CHANGELOG.md | 17 ++ README.md | 2 +- completions/_linux_util | 16 ++ completions/linux_util.bash | 16 ++ docs/utilities.md | 58 ++++--- lib/installers.sh | 84 +++++++++- lib/installers/_shared.sh | 94 +++++++++++ lib/installers/alpine_packages.sh | 11 ++ lib/installers/anki.sh | 26 +++ lib/installers/blender.sh | 26 +++ lib/installers/calibre.sh | 26 +++ lib/installers/cryptomator.sh | 31 ++++ lib/installers/darktable.sh | 26 +++ lib/installers/keepassxc.sh | 26 +++ lib/installers/kodi.sh | 36 ++++ lib/installers/mpv.sh | 26 +++ lib/installers/okular.sh | 26 +++ lib/installers/onepassword.sh | 100 ++++++++++++ lib/installers/rawtherapee.sh | 26 +++ lib/installers/scribus.sh | 26 +++ lib/installers/shotcut.sh | 26 +++ lib/installers/spotify.sh | 32 ++++ lib/installers/veracrypt.sh | 163 +++++++++++++++++++ lib/installers/xournalpp.sh | 26 +++ tests/test_linux_util.sh | 262 ++++++++++++++++++++++++++++++ 25 files changed, 1184 insertions(+), 24 deletions(-) create mode 100644 lib/installers/anki.sh create mode 100644 lib/installers/blender.sh create mode 100644 lib/installers/calibre.sh create mode 100644 lib/installers/cryptomator.sh create mode 100644 lib/installers/darktable.sh create mode 100644 lib/installers/keepassxc.sh create mode 100644 lib/installers/kodi.sh create mode 100644 lib/installers/mpv.sh create mode 100644 lib/installers/okular.sh create mode 100644 lib/installers/onepassword.sh create mode 100644 lib/installers/rawtherapee.sh create mode 100644 lib/installers/scribus.sh create mode 100644 lib/installers/shotcut.sh create mode 100644 lib/installers/spotify.sh create mode 100644 lib/installers/veracrypt.sh create mode 100644 lib/installers/xournalpp.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 5634c2f..891f44f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,23 @@ when a release is cut. ### Added +- **16 more Productivity apps** (part of #91). Password managers and + encryption: 1Password, KeePassXC, Cryptomator and VeraCrypt. Media: mpv, + Kodi and Spotify. Creative: Blender, Darktable, RawTherapee, Shotcut and + Scribus. Documents and notes: Calibre, Anki, Okular and Xournal++. Each uses + the distro's own package where its repositories have one and Flathub where + they do not (Spotify and Cryptomator always use Flathub). 1Password adds + 1Password's own signed repository on Debian, Ubuntu, Fedora, RHEL clones and + openSUSE, and VeraCrypt installs the package from its GitHub release after + checking the signature against VeraCrypt's published key (Arch uses its + repository package). Uninstall keeps your vaults, databases and accounts. + Alpine offers the ones its repositories carry; Spotify, 1Password, VeraCrypt, + Cryptomator and Calibre are hidden there. Productivity is now sorted into folders: **Office Suites** (now + including Euro-Office), **Notes** (Obsidian, Standard Notes, Joplin, Anki, + Xournal++, Logseq, Mark Text), **Password Managers**, **Encryption**, + **Documents & Reading**, **Graphics & Photo**, **Video & Audio** and + **Media**. ArtCraft Launcher, Flameshot, Nextcloud Desktop, NVIDIA PAIR and + WinApps stay at the top level. - **Alpine Linux support** (#90). `./linux_util.sh` now runs on Alpine and postmarketOS using `apk`, instead of stopping with "No supported package manager found". System Updates, Full System Upgrade, Fix Broken Packages, the diff --git a/README.md b/README.md index 89dc45d..17339d8 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ selection rules and the profile table: [docs/menu.md](docs/menu.md). | **Gaming** | Steam, Lutris, Heroic, Bottles, Xodus Nexus, Wine, ProtonUp-Qt, MangoHud, Gamemode, Boxflat | | **Internet** | Browsers (Firefox, Brave, Chrome, Chromium, Vivaldi, LibreWolf, Zen, Thorium, Tor), email clients, messaging, and VPNs (ProtonVPN, PIA, Tailscale, WireGuard) | | **Package Managers** | Flatpak, Homebrew, Nix, Snap, deb-get, Pacstall, yay, paru — added alongside the native manager, never replacing it | -| **Productivity** | ArtCraft Launcher, LibreOffice, OnlyOffice, WPS, GIMP, Inkscape, Krita, Kdenlive, OBS, VLC, Multimedia Codecs, Obsidian, Joplin, Logseq, Bitwarden, Nextcloud, NVIDIA PAIR, WinApps | +| **Productivity** | ArtCraft Launcher, LibreOffice, OnlyOffice, WPS, GIMP, Inkscape, Krita, Kdenlive, OBS, VLC, Multimedia Codecs, Obsidian, Joplin, Logseq, Bitwarden, 1Password, KeePassXC, Cryptomator, VeraCrypt, Nextcloud, NVIDIA PAIR, WinApps, and more: media (mpv, Kodi, Spotify), creative (Blender, Darktable, RawTherapee, Shotcut, Scribus) and documents (Calibre, Anki, Okular, Xournal++) | | **Remote Admin** | Cockpit, Enable RDP (xrdp or krdp), OpenSSH, Remmina, RustDesk, AnyDesk, Termius, Devolutions RDM, OpenRSAT | | **File Managers** | Nautilus, Dolphin, Thunar, Nemo, Caja, PCManFM-Qt, Krusader, and the terminal managers (Midnight Commander, Ranger, nnn, Superfile) | | **Firewalls** | UFW and firewalld, each with its GUI front end (Gufw, firewall-config) | diff --git a/completions/_linux_util b/completions/_linux_util index 160f45c..ab9a8f4 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -5,18 +5,22 @@ # or source this file directly. _linux_util_utilities=( + '1Password' 'AMD Drivers' + 'Anki' 'ArtCraft Launcher' 'bat' 'Betterbird' 'Bitwarden Client' 'Bitwarden Extension' + 'Blender' 'Bottles' 'Boxflat' 'Brave Browser' 'Btop' 'Budgie Desktop' 'CachyOS Kernel Manager' + 'Calibre' 'Chromium' 'Cinnamon Desktop' 'Claude Code' @@ -27,7 +31,9 @@ _linux_util_utilities=( 'Command-Not-Found Prompt' 'COSMIC Desktop' 'Create Snapshot' + 'Cryptomator' 'Cursor IDE' + 'Darktable' 'DBeaver' 'Deepin Desktop' 'Devolutions RDM' @@ -58,7 +64,9 @@ _linux_util_utilities=( 'Joplin Web Clipper' 'KDE Desktop' 'KDiskMark' + 'KeePassXC' 'KMail' + 'Kodi' 'LibreOffice' 'linux-tkg' 'Local Time Zone / Locale' @@ -69,6 +77,7 @@ _linux_util_utilities=( 'Mainline' 'MangoHud' 'MATE Desktop' + 'mpv' 'Multimedia Codecs' 'NeoMutt' 'Nextcloud Desktop' @@ -78,9 +87,14 @@ _linux_util_utilities=( 'NVM' 'OBS Studio' 'Obsidian' + 'Okular' 'OnlyOffice' 'OpenLogi' 'OpenSSH Server' + 'RawTherapee' + 'Scribus' + 'Shotcut' + 'Spotify' 'tmux' 'tmux Resurrect' 'Pantheon Desktop' @@ -113,6 +127,7 @@ _linux_util_utilities=( 'Toolbx' 'Trojita' 'UFW Firewall' + 'VeraCrypt' 'Visual Studio Code' 'VSCodium' 'Vivaldi Browser' @@ -124,6 +139,7 @@ _linux_util_utilities=( 'XEN Guest Utilities' 'Xfce Desktop' 'Xodus Nexus' + 'Xournal++' 'Zsh + Oh My Zsh' ) diff --git a/completions/linux_util.bash b/completions/linux_util.bash index f8bffd2..7185241 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -3,18 +3,22 @@ _linux_util_utilities() { cat <<'EOF' +1Password AMD Drivers +Anki ArtCraft Launcher bat Betterbird Bitwarden Client Bitwarden Extension +Blender Bottles Boxflat Brave Browser Btop Budgie Desktop CachyOS Kernel Manager +Calibre Chromium Cinnamon Desktop Claude Code @@ -25,7 +29,9 @@ Codex Command-Not-Found Prompt COSMIC Desktop Create Snapshot +Cryptomator Cursor IDE +Darktable DBeaver Deepin Desktop Devolutions RDM @@ -57,7 +63,9 @@ Joplin Client Joplin Web Clipper KDE Desktop KDiskMark +KeePassXC KMail +Kodi LibreOffice linux-tkg Local Time Zone / Locale @@ -68,6 +76,7 @@ LXQt Desktop Mainline MangoHud MATE Desktop +mpv Multimedia Codecs NeoMutt Nextcloud Desktop @@ -76,9 +85,14 @@ NVIDIA PAIR NVM OBS Studio Obsidian +Okular OnlyOffice OpenLogi OpenSSH Server +RawTherapee +Scribus +Shotcut +Spotify tmux tmux Resurrect Pantheon Desktop @@ -112,6 +126,7 @@ Toolbx Trojita Num Lock at Boot UFW Firewall +VeraCrypt Visual Studio Code VSCodium Vivaldi Browser @@ -123,6 +138,7 @@ WPS Office XEN Guest Utilities Xfce Desktop Xodus Nexus +Xournal++ Zsh + Oh My Zsh EOF } diff --git a/docs/utilities.md b/docs/utilities.md index 6d52d3c..d1551ec 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -242,30 +242,46 @@ Additional, cross-distro managers that run alongside the native package manager |---------|-------------| | **ArtCraft Launcher** | The launcher app that installs and updates the Craft apps — `.deb` / `.rpm` / AppImage with menu entry (Arch family) | | **NVIDIA PAIR** | NVIDIA's Personal AI Router, which links home-network machines into one local AI inference cluster (Ollama, llama.cpp, LM Studio). Upstream ships a `.deb` only: installed as-is on Debian/Ubuntu, unpacked into `/opt/PAIR` elsewhere | -| **Audacity** | Open-source audio editor and recorder | -| **Bitwarden Client** | Open-source password manager — `.deb` / `.rpm` / AUR / snap / flatpak | -| **Euro-Office** | European community fork of ONLYOFFICE — **built from source**, since upstream ships no desktop binaries. Runs their `docker buildx bake` build and installs the resulting `.deb`/`.rpm` (AUR on Arch). Needs Docker + Buildx; the compile takes hours and tens of GB | +| **Audacity** | Open-source audio editor and recorder *(Video & Audio)* | +| **1Password** | Password manager and secrets vault. 1Password's own signed repository on Debian/Ubuntu, Fedora, RHEL clones and openSUSE (updates arrive with the system); AUR on Arch, only with AUR support enabled. Needs a 1Password account; not on Alpine. Uninstall keeps your account data *(Password Managers)* | +| **Anki** | Spaced-repetition flashcards with sync. Distro package on Arch and Alpine, otherwise Flathub. Uninstall keeps your decks *(Notes)* | +| **Bitwarden Client** | Open-source password manager — `.deb` / `.rpm` / AUR / snap / flatpak *(Password Managers)* | +| **Blender** | Free 3D creation suite — modelling, sculpting, animation, rendering and video editing. Distro package, Flathub where the repository has none *(Graphics & Photo)* | +| **Calibre** | E-book library manager and reader with format conversion and e-reader sync. Distro package, Flathub on RHEL clones; not on Alpine *(Documents & Reading)* | +| **Cryptomator** | Client-side encryption for cloud storage — vaults are ordinary folders your sync tool uploads. Flathub on every distro; not on Alpine. Uninstall keeps your vaults *(Encryption)* | +| **Darktable** | Open-source raw photo workflow and editor. Distro package, Flathub where the repository has none *(Graphics & Photo)* | +| **Euro-Office** | European community fork of ONLYOFFICE — **built from source**, since upstream ships no desktop binaries. Runs their `docker buildx bake` build and installs the resulting `.deb`/`.rpm` (AUR on Arch). Needs Docker + Buildx; the compile takes hours and tens of GB *(Office Suites)* | | **Flameshot** | Feature-rich screenshot tool with annotation support | -| **GIMP** | GNU Image Manipulation Program | -| **HandBrake** | Open-source video transcoder | -| **Inkscape** | Professional vector graphics editor | -| **Joplin Client** | Note-taking app with Markdown and sync (AppImage) | -| **Kdenlive** | Open-source video editor by KDE | -| **Krita** | Professional digital painting application | -| **Libation** | Audible audiobook manager — `.deb` / `.rpm` / AUR | -| **LibreOffice** | Open-source office suite — direct download / native packages / flatpak | -| **Logseq** | Privacy-first knowledge management and outliner | -| **Mark Text** | Simple and elegant Markdown editor | -| **Multimedia Codecs** | Full audio and video codecs (H.264, HEVC, AAC and more) for FFmpeg and GStreamer apps. Fedora: enables RPM Fusion, replaces `ffmpeg-free` with the full `ffmpeg` and installs the `multimedia` group; RHEL clones: RPM Fusion for EL (with EPEL and CRB); Debian/Ubuntu and Arch: `ffmpeg` and the GStreamer plugin sets (Ubuntu needs universe); openSUSE: Packman through `opi codecs`. Uninstall is not offered, since media apps link against the codecs | +| **GIMP** | GNU Image Manipulation Program *(Graphics & Photo)* | +| **HandBrake** | Open-source video transcoder *(Video & Audio)* | +| **Inkscape** | Professional vector graphics editor *(Graphics & Photo)* | +| **Joplin Client** | Note-taking app with Markdown and sync (AppImage) *(Notes)* | +| **Kdenlive** | Open-source video editor by KDE *(Video & Audio)* | +| **KeePassXC** | Offline password manager that keeps passwords in an encrypted file you control, with browser integration and TOTP. Distro package, Flathub where the repository has none. Uninstall keeps your database *(Password Managers)* | +| **Kodi** | Home-theater media center for local and network media. Distro package on Debian/Ubuntu and Arch, RPM Fusion Free on Fedora and RHEL clones, Flathub on openSUSE *(Media)* | +| **Krita** | Professional digital painting application *(Graphics & Photo)* | +| **Libation** | Audible audiobook manager — `.deb` / `.rpm` / AUR *(Media)* | +| **LibreOffice** | Open-source office suite — direct download / native packages / flatpak *(Office Suites)* | +| **Logseq** | Privacy-first knowledge management and outliner *(Notes)* | +| **Mark Text** | Simple and elegant Markdown editor *(Notes)* | +| **mpv** | Minimal, scriptable media player for nearly every video and audio format. Distro package, Flathub where the repository has none *(Media)* | +| **Multimedia Codecs** | Full audio and video codecs (H.264, HEVC, AAC and more) for FFmpeg and GStreamer apps. Fedora: enables RPM Fusion, replaces `ffmpeg-free` with the full `ffmpeg` and installs the `multimedia` group; RHEL clones: RPM Fusion for EL (with EPEL and CRB); Debian/Ubuntu and Arch: `ffmpeg` and the GStreamer plugin sets (Ubuntu needs universe); openSUSE: Packman through `opi codecs`. Uninstall is not offered, since media apps link against the codecs *(Media)* | | **Nextcloud Desktop** | Sync client for self-hosted Nextcloud cloud storage | -| **OBS Studio** | Video recording and live streaming | -| **Obsidian** | Markdown-based knowledge base with graphs and plugins | -| **OnlyOffice** | Office suite with MS Office format compatibility | -| **Standard Notes** | End-to-end encrypted notes with cross-platform sync | -| **VLC** | Versatile media player supporting virtually all formats | +| **OBS Studio** | Video recording and live streaming *(Video & Audio)* | +| **Obsidian** | Markdown-based knowledge base with graphs and plugins *(Notes)* | +| **Okular** | KDE's document viewer — PDF, ePub, comics, annotations and signatures; works on any desktop. Distro package, Flathub where the repository has none *(Documents & Reading)* | +| **OnlyOffice** | Office suite with MS Office format compatibility *(Office Suites)* | +| **RawTherapee** | Open-source raw photo developer. Distro package, Flathub where the repository has none (RHEL clones) *(Graphics & Photo)* | +| **Scribus** | Desktop publishing — page layout and print-ready PDFs. Distro package, Flathub where the repository has none *(Graphics & Photo)* | +| **Shotcut** | Cross-platform video editor with a multi-track timeline. Distro package, Flathub where the repository has none (RHEL clones) *(Video & Audio)* | +| **Spotify** | Spotify music streaming client — Flathub on every distro; not on Alpine. Needs a Spotify account. Uninstall keeps your login and cache *(Media)* | +| **Standard Notes** | End-to-end encrypted notes with cross-platform sync *(Notes)* | +| **VeraCrypt** | Disk and file encryption — containers, partitions and hidden volumes. Arch repository package; on Debian/Ubuntu (12/13, 22.04+), Fedora, RHEL clones and openSUSE the package from VeraCrypt's GitHub release, signature checked against its pinned key; not on Alpine *(Encryption)* | +| **VLC** | Versatile media player supporting virtually all formats *(Media)* | | **WinApps** | Run Windows apps as native-feeling windows via a Windows VM + FreeRDP RemoteApp — installs prerequisites, writes a config template, and optionally creates the Windows VM via Docker/Podman (needs KVM; Windows licensed separately) | -| **WPS Office** | MS Office-compatible office suite | -| **Zotero** | Reference manager and research tool | +| **WPS Office** | MS Office-compatible office suite *(Office Suites)* | +| **Xournal++** | Handwriting notebook and PDF annotator for pen tablets and touchscreens. Distro package, Flathub where the repository has none *(Notes)* | +| **Zotero** | Reference manager and research tool *(Documents & Reading)* | ## Remote Admin Tools diff --git a/lib/installers.sh b/lib/installers.sh index bf42175..6fd9c8e 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -124,20 +124,35 @@ NO_RETRY["DistroShelf"]=1 NO_RETRY["Kontainer"]=1 # --- Utilities (alphabetical order) --- +register_utility "1Password" install_onepassword check_onepassword uninstall_onepassword update_onepassword get_version_onepassword register_utility "AMD CPU Microcode & Firmware" install_amd_chipset_drivers check_amd_chipset_drivers uninstall_amd_chipset_drivers update_amd_chipset_drivers get_version_amd_chipset_drivers register_utility "Angry IP Scanner" install_angry_ip_scanner check_angry_ip_scanner uninstall_angry_ip_scanner update_angry_ip_scanner get_version_angry_ip_scanner +register_utility "Anki" install_anki check_anki uninstall_anki update_anki get_version_anki register_utility "Ansible" install_ansible check_ansible uninstall_ansible update_ansible get_version_ansible register_utility "AnyDesk" install_anydesk check_anydesk uninstall_anydesk update_anydesk get_version_anydesk register_utility "ArtCraft Launcher" install_artcraft check_artcraft uninstall_artcraft update_artcraft get_version_artcraft register_utility "Audacity" install_audacity check_audacity uninstall_audacity update_audacity get_version_audacity register_utility "Bitwarden Client" install_bitwarden check_bitwarden uninstall_bitwarden update_bitwarden get_version_bitwarden +register_utility "Blender" install_blender check_blender uninstall_blender update_blender get_version_blender +register_utility "Calibre" install_calibre check_calibre uninstall_calibre update_calibre get_version_calibre +register_utility "Cryptomator" install_cryptomator check_cryptomator uninstall_cryptomator update_cryptomator get_version_cryptomator +register_utility "Darktable" install_darktable check_darktable uninstall_darktable update_darktable get_version_darktable register_utility "GRUB" install_grub check_grub uninstall_grub update_grub get_version_grub +register_utility "KeePassXC" install_keepassxc check_keepassxc uninstall_keepassxc update_keepassxc get_version_keepassxc +register_utility "Kodi" install_kodi check_kodi uninstall_kodi update_kodi get_version_kodi register_utility "Limine" install_limine check_limine uninstall_limine update_limine get_version_limine +register_utility "mpv" install_mpv check_mpv uninstall_mpv update_mpv get_version_mpv +register_utility "Okular" install_okular check_okular uninstall_okular update_okular get_version_okular +register_utility "RawTherapee" install_rawtherapee check_rawtherapee uninstall_rawtherapee update_rawtherapee get_version_rawtherapee +register_utility "Scribus" install_scribus check_scribus uninstall_scribus update_scribus get_version_scribus +register_utility "Shotcut" install_shotcut check_shotcut uninstall_shotcut update_shotcut get_version_shotcut +register_utility "Spotify" install_spotify check_spotify uninstall_spotify update_spotify get_version_spotify register_utility "systemd-boot" install_systemd_boot check_systemd_boot uninstall_systemd_boot update_systemd_boot get_version_systemd_boot register_utility "Switch Bootloader" setup_switch_bootloader check_always_false noop_switch_bootloader update_switch_bootloader get_version_switch_bootloader register_utility "Configure Bootloader" setup_configure_bootloader check_always_false noop_function update_configure_bootloader get_version_configure_bootloader register_utility "GRUB Theme Selector" install_grubtheme_selector check_always_false noop_function update_grubtheme_selector get_version_grubtheme_selector register_utility "Distro GRUB Themes" install_grubtheme_distro check_grubtheme_distro uninstall_grubtheme_distro update_grubtheme_distro get_version_grubtheme_distro +register_utility "VeraCrypt" install_veracrypt check_veracrypt uninstall_veracrypt update_veracrypt get_version_veracrypt register_utility "vinceliuice GRUB Themes" install_grubtheme_vinceliuice check_grubtheme_vinceliuice uninstall_grubtheme_vinceliuice update_grubtheme_vinceliuice get_version_grubtheme_vinceliuice register_utility "Catppuccin GRUB Theme" install_grubtheme_catppuccin check_grubtheme_catppuccin uninstall_grubtheme_catppuccin update_grubtheme_catppuccin get_version_grubtheme_catppuccin register_utility "HyperFluent GRUB Theme" install_grubtheme_hyperfluent check_grubtheme_hyperfluent uninstall_grubtheme_hyperfluent update_grubtheme_hyperfluent get_version_grubtheme_hyperfluent @@ -338,6 +353,7 @@ register_utility "WireGuard Client" install_wireguard_client check_wireguard_ register_utility "WireGuard Server" install_wireguard_server check_wireguard_server uninstall_wireguard_server update_wireguard_server get_version_wireguard_server register_utility "WPS Office" install_wps_office check_wps_office uninstall_wps_office update_wps_office get_version_wps_office register_utility "Xodus Nexus" install_xodus_nexus check_xodus_nexus uninstall_xodus_nexus update_xodus_nexus get_version_xodus_nexus +register_utility "Xournal++" install_xournalpp check_xournalpp uninstall_xournalpp update_xournalpp get_version_xournalpp register_utility "Zen Browser" install_zen_browser check_zen_browser uninstall_zen_browser update_zen_browser get_version_zen_browser register_utility "Zoom" install_zoom check_zoom uninstall_zoom update_zoom get_version_zoom register_utility "Zotero" install_zotero check_zotero uninstall_zotero update_zotero get_version_zotero @@ -698,6 +714,22 @@ UTILITY_CATEGORY["Input Leap"]="System Tools" UTILITY_CATEGORY["k9s"]="Development" UTILITY_CATEGORY["Kdenlive"]="Productivity" UTILITY_CATEGORY["Krita"]="Productivity" +UTILITY_CATEGORY["1Password"]="Productivity" +UTILITY_CATEGORY["Anki"]="Productivity" +UTILITY_CATEGORY["Blender"]="Productivity" +UTILITY_CATEGORY["Calibre"]="Productivity" +UTILITY_CATEGORY["Cryptomator"]="Productivity" +UTILITY_CATEGORY["Darktable"]="Productivity" +UTILITY_CATEGORY["KeePassXC"]="Productivity" +UTILITY_CATEGORY["Kodi"]="Productivity" +UTILITY_CATEGORY["mpv"]="Productivity" +UTILITY_CATEGORY["Okular"]="Productivity" +UTILITY_CATEGORY["RawTherapee"]="Productivity" +UTILITY_CATEGORY["Scribus"]="Productivity" +UTILITY_CATEGORY["Shotcut"]="Productivity" +UTILITY_CATEGORY["Spotify"]="Productivity" +UTILITY_CATEGORY["VeraCrypt"]="Productivity" +UTILITY_CATEGORY["Xournal++"]="Productivity" UTILITY_CATEGORY["kubectl"]="Development" UTILITY_CATEGORY["Libation"]="Productivity" UTILITY_CATEGORY["LibreWolf"]="Internet" @@ -773,9 +805,40 @@ UTILITY_SUBCATEGORY["WireGuard Server"]="VPN" UTILITY_SUBCATEGORY["LibreOffice"]="Office Suites" UTILITY_SUBCATEGORY["OnlyOffice"]="Office Suites" UTILITY_SUBCATEGORY["WPS Office"]="Office Suites" +UTILITY_SUBCATEGORY["Euro-Office"]="Office Suites" +UTILITY_SUBCATEGORY["Joplin Client"]="Notes" UTILITY_SUBCATEGORY["Obsidian"]="Notes" UTILITY_SUBCATEGORY["Standard Notes"]="Notes" -UTILITY_SUBCATEGORY["Joplin Client"]="Notes" +UTILITY_SUBCATEGORY["Anki"]="Notes" +UTILITY_SUBCATEGORY["Xournal++"]="Notes" +UTILITY_SUBCATEGORY["Logseq"]="Notes" +UTILITY_SUBCATEGORY["Mark Text"]="Notes" +UTILITY_SUBCATEGORY["Bitwarden Client"]="Password Managers" +UTILITY_SUBCATEGORY["1Password"]="Password Managers" +UTILITY_SUBCATEGORY["KeePassXC"]="Password Managers" +UTILITY_SUBCATEGORY["Cryptomator"]="Encryption" +UTILITY_SUBCATEGORY["VeraCrypt"]="Encryption" +UTILITY_SUBCATEGORY["Calibre"]="Documents & Reading" +UTILITY_SUBCATEGORY["Okular"]="Documents & Reading" +UTILITY_SUBCATEGORY["Zotero"]="Documents & Reading" +UTILITY_SUBCATEGORY["GIMP"]="Graphics & Photo" +UTILITY_SUBCATEGORY["Inkscape"]="Graphics & Photo" +UTILITY_SUBCATEGORY["Krita"]="Graphics & Photo" +UTILITY_SUBCATEGORY["Blender"]="Graphics & Photo" +UTILITY_SUBCATEGORY["Darktable"]="Graphics & Photo" +UTILITY_SUBCATEGORY["RawTherapee"]="Graphics & Photo" +UTILITY_SUBCATEGORY["Scribus"]="Graphics & Photo" +UTILITY_SUBCATEGORY["Kdenlive"]="Video & Audio" +UTILITY_SUBCATEGORY["Shotcut"]="Video & Audio" +UTILITY_SUBCATEGORY["HandBrake"]="Video & Audio" +UTILITY_SUBCATEGORY["Audacity"]="Video & Audio" +UTILITY_SUBCATEGORY["OBS Studio"]="Video & Audio" +UTILITY_SUBCATEGORY["VLC"]="Media" +UTILITY_SUBCATEGORY["mpv"]="Media" +UTILITY_SUBCATEGORY["Kodi"]="Media" +UTILITY_SUBCATEGORY["Spotify"]="Media" +UTILITY_SUBCATEGORY["Multimedia Codecs"]="Media" +UTILITY_SUBCATEGORY["Libation"]="Media" UTILITY_SUBCATEGORY["Claude Code"]="IDEs & Editors" UTILITY_SUBCATEGORY["Claude Desktop"]="IDEs & Editors" UTILITY_SUBCATEGORY["Codex"]="IDEs & Editors" @@ -887,6 +950,7 @@ SUBCATEGORY_ORDER["Development"]="IDEs & Editors|Distrobox" SUBCATEGORY_ORDER["Drivers"]="CPU Microcode|GPU Drivers" SUBCATEGORY_ORDER["File Managers"]="Graphical|Terminal" SUBCATEGORY_ORDER["Internet"]="Web Browsers|Web Browser Tweaks|Web Browser Extensions|Messaging|Email Clients|File Transfer|VPN" +SUBCATEGORY_ORDER["Productivity"]="Office Suites|Notes|Password Managers|Encryption|Documents & Reading|Graphics & Photo|Video & Audio|Media" SUBCATEGORY_ORDER["Remote Admin Tools"]="Remote Access" SUBCATEGORY_ORDER["Bootloaders"]="GRUB Themes" SUBCATEGORY_ORDER["Login Screens"]="Display Managers|SDDM Themes|LightDM Greeters" @@ -1067,6 +1131,22 @@ UTILITY_DESCRIPTION["HandBrake"]="Open-source video transcoder for converting vi UTILITY_DESCRIPTION["Inkscape"]="Professional vector graphics editor for creating illustrations, logos, and scalable artwork using SVG." UTILITY_DESCRIPTION["Kdenlive"]="KDE's powerful non-linear video editor with multi-track editing, effects, and broad format support." UTILITY_DESCRIPTION["Krita"]="Professional digital painting application designed for illustrators, concept artists, and texture artists." +UTILITY_DESCRIPTION["1Password"]="Password manager and secrets vault from 1Password. Installed from 1Password's own signed repository on Debian, Ubuntu, Fedora, RHEL clones and openSUSE, so updates arrive with the system; on Arch it comes from the AUR (only with AUR support enabled). Needs a 1Password account; not available on Alpine. Uninstall keeps your account data." +UTILITY_DESCRIPTION["Anki"]="Spaced-repetition flashcard program for memorising anything, with sync across devices. Distro package where one exists (Arch, Alpine), otherwise Flathub. Uninstall keeps your decks." +UTILITY_DESCRIPTION["Blender"]="Free 3D creation suite: modelling, sculpting, animation, rendering, video editing and compositing. Distro package, or Flathub where the repository has none." +UTILITY_DESCRIPTION["Calibre"]="E-book library manager and reader: converts between formats, edits metadata, and syncs books to e-readers. Distro package, or Flathub on RHEL clones. Not available on Alpine." +UTILITY_DESCRIPTION["Cryptomator"]="Client-side encryption for cloud storage: creates encrypted vaults as ordinary folders that Dropbox, Nextcloud, Google Drive and others sync. Installed from Flathub on every distro; not available on Alpine. Uninstall keeps your vaults." +UTILITY_DESCRIPTION["Darktable"]="Open-source raw photo workflow and editor, a free alternative to Lightroom. Distro package, or Flathub where the repository has none." +UTILITY_DESCRIPTION["KeePassXC"]="Offline, open-source password manager that keeps passwords in an encrypted file you control, with browser integration and TOTP. Distro package, or Flathub where the repository has none. Uninstall keeps your database." +UTILITY_DESCRIPTION["Kodi"]="Home-theater media center for movies, TV, music and photos from local drives and the network. Distro package on Debian, Ubuntu and Arch, RPM Fusion Free on Fedora and RHEL clones, Flathub on openSUSE." +UTILITY_DESCRIPTION["mpv"]="Minimal, scriptable media player for nearly every video and audio format, driven by keyboard shortcuts and a config file. Distro package, or Flathub where the repository has none." +UTILITY_DESCRIPTION["Okular"]="KDE's document viewer for PDF, ePub, comic books and more, with annotations and signatures. Pulls in KDE libraries; works on any desktop. Distro package, or Flathub where the repository has none." +UTILITY_DESCRIPTION["RawTherapee"]="Open-source raw photo developer with fine control over exposure, color and noise. Distro package, or Flathub where the repository has none (RHEL clones)." +UTILITY_DESCRIPTION["Scribus"]="Desktop publishing: page layout for magazines, brochures and print-ready PDFs. Distro package, or Flathub where the repository has none." +UTILITY_DESCRIPTION["Shotcut"]="Cross-platform video editor with a multi-track timeline, filters and wide format support. Distro package, or Flathub where the repository has none (RHEL clones)." +UTILITY_DESCRIPTION["Spotify"]="Spotify music streaming client. Installed from Flathub on every distro; not available on Alpine. Needs a Spotify account. Uninstall keeps your login and cache." +UTILITY_DESCRIPTION["VeraCrypt"]="Disk and file encryption: encrypted containers, whole partitions and hidden volumes, successor to TrueCrypt. Arch uses its repository package; Debian, Ubuntu, Fedora, RHEL clones and openSUSE use the package from VeraCrypt's own GitHub release, signature checked, for the releases it publishes. Not available on Alpine." +UTILITY_DESCRIPTION["Xournal++"]="Handwriting notebook and PDF annotator for pen tablets and touchscreens. Distro package, or Flathub where the repository has none." UTILITY_DESCRIPTION["Libation"]="Open-source Audible audiobook manager for downloading, decrypting, and organizing your audiobook library." UTILITY_DESCRIPTION["Logseq"]="Open-source knowledge management and note-taking app based on linked, Markdown-formatted outliner blocks." UTILITY_DESCRIPTION["Mark Text"]="Simple, elegant Markdown editor focused on writing speed with live preview and multiple themes." @@ -1184,7 +1264,7 @@ mark_aur_only_arch \ "Devolutions RDM=remote-desktop-manager" \ "Euro-Office=euro-office-desktopeditors-git" \ "Snap (snapd)=snapd" "Snapper GUI=snapper-gui-git" \ - "Trojita=trojita" "Zotero=zotero" + "Trojita=trojita" "Zotero=zotero" "1Password=1password" # Utilities that can install from upstream's own binary when no package source # carries them (the third tier of arch_install_ordered, reached on Arch because diff --git a/lib/installers/_shared.sh b/lib/installers/_shared.sh index 93473a5..4460592 100644 --- a/lib/installers/_shared.sh +++ b/lib/installers/_shared.sh @@ -412,3 +412,97 @@ ensure_electron_runtime_deps() { fi return 0 } + +# ============================================================================ +# Native package, else Flathub +# +# Install source policy for apps that most distros package but some do not +# (Anki, Calibre on RHEL clones, Kodi on openSUSE, ...): the distro's own +# repository first, because it is signed by the distro and tracks the system; +# Flathub only where the repository has no such package. Used by mpv, Kodi, +# Blender, Darktable, RawTherapee, Shotcut, Scribus, Calibre, Anki, Okular, +# Xournal++ and KeePassXC. Older installers carry their own copy of this +# fallback inline; do not add another one, use these. +# ============================================================================ + +# Whether a package manager repository that is configured right now offers PKG. +# The query output is captured first and tested afterwards: piping it into +# grep -q would end the query early and, under pipefail, report "not found" +# for a package that is there (SIGPIPE, status 141). +pkg_in_repo() { + local pkg="$1" out + case "${PKG_MGR:-}" in + apt) + out=$(apt-cache policy "$pkg" 2>/dev/null) + [[ "$out" == *"Candidate: "[!\(]* ]] + ;; + dnf|yum) + out=$("$PKG_MGR" -q repoquery --latest-limit=1 --qf '%{name}\n' "$pkg" 2>/dev/null) + grep -qx "$pkg" <<<"$out" + ;; + pacman) arch_repo_has "$pkg" ;; + zypper) + out=$(zypper -q info "$pkg" 2>/dev/null) + grep -q '^Version' <<<"$out" + ;; + apk) + out=$(apk search -e "$pkg" 2>/dev/null) + [[ -n "$out" ]] + ;; + *) return 1 ;; + esac +} + +# Install a Flathub app system-wide, adding flatpak and the flathub remote first. +# sudo, not a bare flatpak: ensure_flatpak adds flathub as a SYSTEM remote (see +# the note in flatpak_or_aur in aur.sh). +flatpak_install_flathub() { + local flatpak_id="$1" + ensure_flatpak || { error "Flatpak is needed for ${flatpak_id} and could not be set up."; return 1; } + sudo flatpak install -y flathub "$flatpak_id" || return 1 + flatpak_refresh_dbus +} + +# native_or_flatpak_install FLATPAK_ID PKG +native_or_flatpak_install() { + local flatpak_id="$1" pkg="$2" + pkg_refresh + # RHEL clones carry much of this software in EPEL (which needs CRB). + if [[ "${DISTRO_FAMILY:-}" == "rhel" ]]; then + rpm -q epel-release &>/dev/null || pkg_install epel-release || true + enable_crb + fi + if pkg_in_repo "$pkg"; then + pkg_install "$pkg" + return $? + fi + info "${pkg} is not in the ${DISTRO_NAME:-system} repositories; installing the Flatpak from Flathub." + flatpak_install_flathub "$flatpak_id" +} + +# User settings and data stay: these apps hold notes, vaults and libraries. +native_or_flatpak_uninstall() { + local flatpak_id="$1" pkg="$2" + if flatpak_is_installed "$flatpak_id"; then + flatpak uninstall -y --user "$flatpak_id" 2>/dev/null || \ + sudo flatpak uninstall -y --system "$flatpak_id" + else + pkg_remove "$pkg" + fi +} + +native_or_flatpak_update() { + local flatpak_id="$1" pkg="$2" + if flatpak_is_installed "$flatpak_id"; then + flatpak update -y --user "$flatpak_id" 2>/dev/null || \ + sudo flatpak update -y --system "$flatpak_id" + else + pkg_upgrade "$pkg" + fi +} + +# Version from the package manager or Flatpak. The program itself is never run: +# several of these are GUI apps that open a window for --version. +native_or_flatpak_version() { + _ver_from_pkg "$2" || _ver_from_flatpak "$1" || echo "" +} diff --git a/lib/installers/alpine_packages.sh b/lib/installers/alpine_packages.sh index 543d067..bd186fc 100644 --- a/lib/installers/alpine_packages.sh +++ b/lib/installers/alpine_packages.sh @@ -88,6 +88,17 @@ _ALPINE_TABLE=( "Nextcloud Desktop|nextcloud-client|nextcloud||" "MangoHud|mangohud|mangohud||" "Feral Gamemode|gamemode|gamemoded||" + "Anki|anki|anki||" + "Blender|blender|blender||" + "Darktable|darktable|darktable||" + "KeePassXC|keepassxc|keepassxc||" + "Kodi|kodi|kodi||" + "mpv|mpv|mpv||" + "Okular|okular|okular||" + "RawTherapee|rawtherapee|rawtherapee||" + "Scribus|scribus|scribus||" + "Shotcut|shotcut|shotcut||" + "Xournal++|xournalpp|xournalpp||" ) # Registered utilities whose own installer file has an Alpine branch. diff --git a/lib/installers/anki.sh b/lib/installers/anki.sh new file mode 100644 index 0000000..df0e5de --- /dev/null +++ b/lib/installers/anki.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Anki flashcards installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- Anki --- + +check_anki() { _check_standard anki anki net.ankiweb.Anki; } + +install_anki() { + info "Installing Anki..." + native_or_flatpak_install net.ankiweb.Anki anki || return 1 + info "Anki installed." +} + +uninstall_anki() { + info "Uninstalling Anki..." + native_or_flatpak_uninstall net.ankiweb.Anki anki +} + +update_anki() { + info "Updating Anki..." + native_or_flatpak_update net.ankiweb.Anki anki +} + +get_version_anki() { native_or_flatpak_version net.ankiweb.Anki anki; } diff --git a/lib/installers/blender.sh b/lib/installers/blender.sh new file mode 100644 index 0000000..e9c317f --- /dev/null +++ b/lib/installers/blender.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Blender 3D suite installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- Blender --- + +check_blender() { _check_standard blender blender org.blender.Blender; } + +install_blender() { + info "Installing Blender..." + native_or_flatpak_install org.blender.Blender blender || return 1 + info "Blender installed." +} + +uninstall_blender() { + info "Uninstalling Blender..." + native_or_flatpak_uninstall org.blender.Blender blender +} + +update_blender() { + info "Updating Blender..." + native_or_flatpak_update org.blender.Blender blender +} + +get_version_blender() { native_or_flatpak_version org.blender.Blender blender; } diff --git a/lib/installers/calibre.sh b/lib/installers/calibre.sh new file mode 100644 index 0000000..61b5cb4 --- /dev/null +++ b/lib/installers/calibre.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Calibre e-book manager installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- Calibre --- + +check_calibre() { _check_standard calibre calibre com.calibre_ebook.calibre; } + +install_calibre() { + info "Installing Calibre..." + native_or_flatpak_install com.calibre_ebook.calibre calibre || return 1 + info "Calibre installed." +} + +uninstall_calibre() { + info "Uninstalling Calibre..." + native_or_flatpak_uninstall com.calibre_ebook.calibre calibre +} + +update_calibre() { + info "Updating Calibre..." + native_or_flatpak_update com.calibre_ebook.calibre calibre +} + +get_version_calibre() { native_or_flatpak_version com.calibre_ebook.calibre calibre; } diff --git a/lib/installers/cryptomator.sh b/lib/installers/cryptomator.sh new file mode 100644 index 0000000..8862516 --- /dev/null +++ b/lib/installers/cryptomator.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Cryptomator installer functions +# Cryptomator publishes its Linux app as a Flatpak (org.cryptomator.Cryptomator) +# on Flathub, the same on every distro, so that is the one install route. +# Vaults are ordinary folders chosen by the user and are never touched here. + +# --- Cryptomator --- + +_CRYPTOMATOR_FLATPAK="org.cryptomator.Cryptomator" + +check_cryptomator() { _check_standard "" "" "$_CRYPTOMATOR_FLATPAK"; } + +install_cryptomator() { + info "Installing Cryptomator..." + flatpak_install_flathub "$_CRYPTOMATOR_FLATPAK" || return 1 + info "Cryptomator installed." +} + +uninstall_cryptomator() { + info "Uninstalling Cryptomator..." + flatpak uninstall -y --user "$_CRYPTOMATOR_FLATPAK" 2>/dev/null || \ + sudo flatpak uninstall -y --system "$_CRYPTOMATOR_FLATPAK" +} + +update_cryptomator() { + info "Updating Cryptomator..." + flatpak update -y --user "$_CRYPTOMATOR_FLATPAK" 2>/dev/null || \ + sudo flatpak update -y --system "$_CRYPTOMATOR_FLATPAK" +} + +get_version_cryptomator() { _ver_from_flatpak "$_CRYPTOMATOR_FLATPAK" || echo ""; } diff --git a/lib/installers/darktable.sh b/lib/installers/darktable.sh new file mode 100644 index 0000000..5acb76a --- /dev/null +++ b/lib/installers/darktable.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Darktable photo workflow installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- Darktable --- + +check_darktable() { _check_standard darktable darktable org.darktable.Darktable; } + +install_darktable() { + info "Installing Darktable..." + native_or_flatpak_install org.darktable.Darktable darktable || return 1 + info "Darktable installed." +} + +uninstall_darktable() { + info "Uninstalling Darktable..." + native_or_flatpak_uninstall org.darktable.Darktable darktable +} + +update_darktable() { + info "Updating Darktable..." + native_or_flatpak_update org.darktable.Darktable darktable +} + +get_version_darktable() { native_or_flatpak_version org.darktable.Darktable darktable; } diff --git a/lib/installers/keepassxc.sh b/lib/installers/keepassxc.sh new file mode 100644 index 0000000..5186448 --- /dev/null +++ b/lib/installers/keepassxc.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# KeePassXC password manager installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- KeePassXC --- + +check_keepassxc() { _check_standard keepassxc keepassxc org.keepassxc.KeePassXC; } + +install_keepassxc() { + info "Installing KeePassXC..." + native_or_flatpak_install org.keepassxc.KeePassXC keepassxc || return 1 + info "KeePassXC installed." +} + +uninstall_keepassxc() { + info "Uninstalling KeePassXC..." + native_or_flatpak_uninstall org.keepassxc.KeePassXC keepassxc +} + +update_keepassxc() { + info "Updating KeePassXC..." + native_or_flatpak_update org.keepassxc.KeePassXC keepassxc +} + +get_version_keepassxc() { native_or_flatpak_version org.keepassxc.KeePassXC keepassxc; } diff --git a/lib/installers/kodi.sh b/lib/installers/kodi.sh new file mode 100644 index 0000000..f14e7d6 --- /dev/null +++ b/lib/installers/kodi.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Kodi media center installer functions +# Debian/Ubuntu and Arch: the distro package. Fedora and RHEL clones: RPM Fusion +# Free. openSUSE has none in its own repositories, so it uses Flathub, as does +# any system where the package is not offered. + +# --- Kodi --- + +check_kodi() { _check_standard kodi kodi tv.kodi.Kodi; } + +install_kodi() { + info "Installing Kodi..." + case "$DISTRO_FAMILY" in + fedora) + ensure_rpmfusion free || return 1 + ;; + rhel) + # Not fatal: without RPM Fusion Kodi comes from Flathub below. + ensure_rpmfusion free || warn "RPM Fusion could not be enabled; Kodi will come from Flathub." + ;; + esac + native_or_flatpak_install tv.kodi.Kodi kodi || return 1 + info "Kodi installed." +} + +uninstall_kodi() { + info "Uninstalling Kodi..." + native_or_flatpak_uninstall tv.kodi.Kodi kodi +} + +update_kodi() { + info "Updating Kodi..." + native_or_flatpak_update tv.kodi.Kodi kodi +} + +get_version_kodi() { native_or_flatpak_version tv.kodi.Kodi kodi; } diff --git a/lib/installers/mpv.sh b/lib/installers/mpv.sh new file mode 100644 index 0000000..4e42e31 --- /dev/null +++ b/lib/installers/mpv.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# mpv media player installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- mpv --- + +check_mpv() { _check_standard mpv mpv io.mpv.Mpv; } + +install_mpv() { + info "Installing mpv..." + native_or_flatpak_install io.mpv.Mpv mpv || return 1 + info "mpv installed." +} + +uninstall_mpv() { + info "Uninstalling mpv..." + native_or_flatpak_uninstall io.mpv.Mpv mpv +} + +update_mpv() { + info "Updating mpv..." + native_or_flatpak_update io.mpv.Mpv mpv +} + +get_version_mpv() { native_or_flatpak_version io.mpv.Mpv mpv; } diff --git a/lib/installers/okular.sh b/lib/installers/okular.sh new file mode 100644 index 0000000..495174f --- /dev/null +++ b/lib/installers/okular.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Okular document viewer installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- Okular --- + +check_okular() { _check_standard okular okular org.kde.okular; } + +install_okular() { + info "Installing Okular..." + native_or_flatpak_install org.kde.okular okular || return 1 + info "Okular installed." +} + +uninstall_okular() { + info "Uninstalling Okular..." + native_or_flatpak_uninstall org.kde.okular okular +} + +update_okular() { + info "Updating Okular..." + native_or_flatpak_update org.kde.okular okular +} + +get_version_okular() { native_or_flatpak_version org.kde.okular okular; } diff --git a/lib/installers/onepassword.sh b/lib/installers/onepassword.sh new file mode 100644 index 0000000..829d239 --- /dev/null +++ b/lib/installers/onepassword.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# 1Password installer functions +# Debian/Ubuntu, Fedora, RHEL clones and openSUSE use 1Password's own signed +# repository (downloads.1password.com), so updates arrive with the system. +# Arch has no vendor repository: the package comes from the AUR, which this +# tool only uses when AUR_ENABLED=true. 1Password publishes no Alpine package. + +# --- 1Password --- + +_OP_KEY_URL="https://downloads.1password.com/linux/keys/1password.asc" +# Fingerprint of the signing key (key ID AC2D62742012EA22), checked against the +# downloaded key before it is trusted. +_OP_KEY_FPR="3FEF9748469ADBE15DA7CA80AC2D62742012EA22" +_OP_APT_KEYRING="/usr/share/keyrings/1password-archive-keyring.gpg" +_OP_APT_LIST="/etc/apt/sources.list.d/1password.list" +_OP_REPO_FILE="/etc/yum.repos.d/1password.repo" + +check_onepassword() { _check_standard 1password 1password ""; } + +_op_import_rpm_key() { + sudo rpm --import "$_OP_KEY_URL" || { error "Could not import the 1Password signing key."; return 1; } +} + +install_onepassword() { + info "Installing 1Password..." + ensure_tools + case "$DISTRO_FAMILY" in + debian) + local arch + arch=$(dpkg --print-architecture) + _add_apt_repo "$_OP_KEY_URL" "$_OP_APT_KEYRING" \ + "deb [arch=${arch} signed-by=${_OP_APT_KEYRING}] https://downloads.1password.com/linux/debian/${arch} stable main" \ + "$_OP_APT_LIST" "$_OP_KEY_FPR" || return 1 + pkg_install 1password + ;; + fedora|rhel) + _op_import_rpm_key || return 1 + printf '%s\n' \ + '[1password]' \ + 'name=1Password Stable Channel' \ + 'baseurl=https://downloads.1password.com/linux/rpm/stable/$basearch' \ + 'enabled=1' \ + 'gpgcheck=1' \ + 'repo_gpgcheck=1' \ + "gpgkey=${_OP_KEY_URL}" | sudo tee "$_OP_REPO_FILE" >/dev/null + pkg_install 1password + ;; + suse) + _op_import_rpm_key || return 1 + sudo zypper --non-interactive removerepo 1password &>/dev/null || true + sudo zypper --non-interactive addrepo --refresh \ + "https://downloads.1password.com/linux/rpm/stable/$(uname -m)" 1password || return 1 + sudo zypper --non-interactive --gpg-auto-import-keys refresh 1password || return 1 + pkg_install 1password + ;; + arch) + # The AUR package verifies its download against this key. + curl -fsSL "$_OP_KEY_URL" | gpg --import - || { error "Could not import the 1Password signing key."; return 1; } + repo_or_aur 1password || return 1 + ;; + *) + error "1Password publishes no package for ${DISTRO_NAME}." + return 1 + ;; + esac + info "1Password installed." +} + +# The signed-in account and its vault cache (~/.config/1Password) are kept. +uninstall_onepassword() { + info "Uninstalling 1Password..." + case "$DISTRO_FAMILY" in + debian) + pkg_remove 1password + sudo rm -f "$_OP_APT_LIST" "$_OP_APT_KEYRING" + ;; + fedora|rhel) + pkg_remove 1password + sudo rm -f "$_OP_REPO_FILE" + ;; + suse) + pkg_remove 1password + sudo zypper --non-interactive removerepo 1password 2>/dev/null || true + ;; + arch) + aur_remove 1password 2>/dev/null || pkg_remove 1password + ;; + esac +} + +update_onepassword() { + info "Updating 1Password..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur 1password + else + pkg_upgrade 1password + fi +} + +get_version_onepassword() { _ver_from_pkg 1password || echo ""; } diff --git a/lib/installers/rawtherapee.sh b/lib/installers/rawtherapee.sh new file mode 100644 index 0000000..5b437d7 --- /dev/null +++ b/lib/installers/rawtherapee.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# RawTherapee raw photo developer installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- RawTherapee --- + +check_rawtherapee() { _check_standard rawtherapee rawtherapee com.rawtherapee.RawTherapee; } + +install_rawtherapee() { + info "Installing RawTherapee..." + native_or_flatpak_install com.rawtherapee.RawTherapee rawtherapee || return 1 + info "RawTherapee installed." +} + +uninstall_rawtherapee() { + info "Uninstalling RawTherapee..." + native_or_flatpak_uninstall com.rawtherapee.RawTherapee rawtherapee +} + +update_rawtherapee() { + info "Updating RawTherapee..." + native_or_flatpak_update com.rawtherapee.RawTherapee rawtherapee +} + +get_version_rawtherapee() { native_or_flatpak_version com.rawtherapee.RawTherapee rawtherapee; } diff --git a/lib/installers/scribus.sh b/lib/installers/scribus.sh new file mode 100644 index 0000000..a06c90d --- /dev/null +++ b/lib/installers/scribus.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Scribus desktop publishing installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- Scribus --- + +check_scribus() { _check_standard scribus scribus net.scribus.Scribus; } + +install_scribus() { + info "Installing Scribus..." + native_or_flatpak_install net.scribus.Scribus scribus || return 1 + info "Scribus installed." +} + +uninstall_scribus() { + info "Uninstalling Scribus..." + native_or_flatpak_uninstall net.scribus.Scribus scribus +} + +update_scribus() { + info "Updating Scribus..." + native_or_flatpak_update net.scribus.Scribus scribus +} + +get_version_scribus() { native_or_flatpak_version net.scribus.Scribus scribus; } diff --git a/lib/installers/shotcut.sh b/lib/installers/shotcut.sh new file mode 100644 index 0000000..dca1593 --- /dev/null +++ b/lib/installers/shotcut.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Shotcut video editor installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- Shotcut --- + +check_shotcut() { _check_standard shotcut shotcut org.shotcut.Shotcut; } + +install_shotcut() { + info "Installing Shotcut..." + native_or_flatpak_install org.shotcut.Shotcut shotcut || return 1 + info "Shotcut installed." +} + +uninstall_shotcut() { + info "Uninstalling Shotcut..." + native_or_flatpak_uninstall org.shotcut.Shotcut shotcut +} + +update_shotcut() { + info "Updating Shotcut..." + native_or_flatpak_update org.shotcut.Shotcut shotcut +} + +get_version_shotcut() { native_or_flatpak_version org.shotcut.Shotcut shotcut; } diff --git a/lib/installers/spotify.sh b/lib/installers/spotify.sh new file mode 100644 index 0000000..02d9fec --- /dev/null +++ b/lib/installers/spotify.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Spotify installer functions +# Spotify's Linux client is installed from Flathub (com.spotify.Client), the same +# on every distro: none of the distro repositories checked carries it. + +# --- Spotify --- + +_SPOTIFY_FLATPAK="com.spotify.Client" + +check_spotify() { _check_standard "" "" "$_SPOTIFY_FLATPAK"; } + +install_spotify() { + info "Installing Spotify..." + flatpak_install_flathub "$_SPOTIFY_FLATPAK" || return 1 + info "Spotify installed." +} + +# Spotify keeps its login and cache in ~/.var/app/com.spotify.Client, which is +# left alone. +uninstall_spotify() { + info "Uninstalling Spotify..." + flatpak uninstall -y --user "$_SPOTIFY_FLATPAK" 2>/dev/null || \ + sudo flatpak uninstall -y --system "$_SPOTIFY_FLATPAK" +} + +update_spotify() { + info "Updating Spotify..." + flatpak update -y --user "$_SPOTIFY_FLATPAK" 2>/dev/null || \ + sudo flatpak update -y --system "$_SPOTIFY_FLATPAK" +} + +get_version_spotify() { _ver_from_flatpak "$_SPOTIFY_FLATPAK" || echo ""; } diff --git a/lib/installers/veracrypt.sh b/lib/installers/veracrypt.sh new file mode 100644 index 0000000..c9a5cba --- /dev/null +++ b/lib/installers/veracrypt.sh @@ -0,0 +1,163 @@ +#!/bin/bash +# VeraCrypt disk encryption installer functions +# Arch: the veracrypt package in the official repositories. Elsewhere VeraCrypt +# is in no distro repository, so the installer takes the package upstream +# attaches to its GitHub release: a per-release .deb (Debian, Ubuntu) or .rpm +# (Fedora, RHEL clones, openSUSE), whose detached signature is checked against +# VeraCrypt's published signing key (fingerprint pinned below). VeraCrypt builds +# only for the releases it lists, and says so when yours is not one of them. +# Alpine has no package, so it is not offered there. + +# --- VeraCrypt --- + +_VC_API="https://api.github.com/repos/veracrypt/VeraCrypt/releases/latest" +_VC_KEY_URL="https://veracrypt.io/VeraCrypt_PGP_public_key.asc" +# Primary fingerprint of the VeraCrypt Team signing key (key ID 821ACD02680D16DE). +_VC_KEY_FPR="5069A233D55A0EEB174A5FC3821ACD02680D16DE" + +check_veracrypt() { _check_standard veracrypt veracrypt ""; } + +_VC_JSON="" + +# Latest release version, e.g. 1.26.31. +_veracrypt_latest_version() { + curl -fsSL --max-time 15 "$_VC_API" 2>/dev/null \ + | grep -oP '"tag_name"\s*:\s*"VeraCrypt_\K[0-9.]+' | head -1 +} + +# Print the download URL of the release file named $1, or nothing. +_veracrypt_asset_url() { + [[ -n "$_VC_JSON" ]] || _VC_JSON=$(curl -fsSL --max-time 30 "$_VC_API" 2>/dev/null) || return 1 + grep -oP '"browser_download_url"\s*:\s*"\K[^"]+' <<<"$_VC_JSON" | grep -E "/${1//./\\.}\$" | head -1 +} + +# Print the file name of the release package that fits this system, or nothing. +# $1 is the version. The names are fixed by upstream: veracrypt-VER-OS-RELEASE-ARCH. +_veracrypt_package_name() { + local ver="$1" os rel dpkg_arch names deb_rel + [[ -n "$_VC_JSON" ]] || _VC_JSON=$(curl -fsSL --max-time 30 "$_VC_API" 2>/dev/null) || return 1 + names=$(grep -oP '"name"\s*:\s*"\Kveracrypt-'"${ver//./\\.}"'-[^"]+\.(deb|rpm)(?=")' <<<"$_VC_JSON") + case "$DISTRO_FAMILY" in + debian) + # DISTRO_VERSION_ID carries the point release (13.7, 24.04.4); the + # file names use the release only (13, 24.04). + case "$DISTRO_ID" in + debian) os=Debian; deb_rel=${DISTRO_VERSION_ID%%.*} ;; + ubuntu|kubuntu) os=Ubuntu; deb_rel=$(cut -d. -f1,2 <<<"$DISTRO_VERSION_ID") ;; + *) return 1 ;; + esac + dpkg_arch=$(dpkg --print-architecture) + grep -x "veracrypt-${ver//./\\.}-${os}-${deb_rel//./\\.}-${dpkg_arch}\.deb" <<<"$names" + ;; + fedora) + rel=${DISTRO_VERSION_ID%%.*} + # No build for this exact release (Fedora is ahead of upstream): the + # newest Fedora build upstream publishes. + grep -x "veracrypt-${ver//./\\.}-Fedora-${rel}-x86_64\.rpm" <<<"$names" \ + || grep -E "^veracrypt-${ver//./\\.}-Fedora-[0-9]+-x86_64\.rpm$" <<<"$names" | sort -V | tail -1 + ;; + rhel) + grep -x "veracrypt-${ver//./\\.}-CentOS-8-x86_64\.rpm" <<<"$names" + ;; + suse) + grep -x "veracrypt-${ver//./\\.}-openSUSE-15-x86_64\.rpm" <<<"$names" + ;; + esac +} + +# Check the detached signature $2 (a URL) of file $1 against VeraCrypt's signing +# key. The key is downloaded, its fingerprint compared with the pinned one, and +# only then used, in a throwaway keyring so nothing is added to the user's own. +# On openSUSE the key is also imported into rpm, which otherwise refuses the +# package as "NOKEY". +_veracrypt_verify_signature() { + local file="$1" sig_url="$2" tmp keyfile sigfile status primary fprs + [[ -n "$sig_url" ]] || { error "The VeraCrypt release has no signature for $(basename "$file")."; return 1; } + tmp=$(mktemp -d /tmp/veracrypt-key-XXXXXX) || return 1 + keyfile="$tmp/key.asc"; sigfile="$tmp/sig" + curl -fsSL --max-time 30 -o "$keyfile" "$_VC_KEY_URL" && download_file "$sig_url" "$sigfile" || { + rm -rf "$tmp"; error "Could not download the VeraCrypt signing key or signature."; return 1 + } + fprs=$(GNUPGHOME="$tmp" gpg --show-keys --with-colons "$keyfile" 2>/dev/null | awk -F: '$1 == "fpr" { print $10 }') + if ! grep -qx "$_VC_KEY_FPR" <<<"$fprs"; then + rm -rf "$tmp"; error "The downloaded VeraCrypt key does not match fingerprint ${_VC_KEY_FPR}."; return 1 + fi + GNUPGHOME="$tmp" gpg --batch --import "$keyfile" &>/dev/null + status=$(GNUPGHOME="$tmp" gpg --batch --status-fd 1 --verify "$sigfile" "$file" 2>/dev/null) + # VALIDSIG's last field is the primary key fingerprint, whichever subkey signed. + primary=$(awk '$2 == "VALIDSIG" { print $NF }' <<<"$status") + if [[ "$primary" != "$_VC_KEY_FPR" ]]; then + rm -rf "$tmp"; error "The signature on $(basename "$file") is not a valid VeraCrypt signature."; return 1 + fi + if [[ "$DISTRO_FAMILY" == "suse" ]] && ! sudo rpm --import "$keyfile"; then + rm -rf "$tmp"; error "Could not import the VeraCrypt signing key into rpm."; return 1 + fi + rm -rf "$tmp" + return 0 +} + +install_veracrypt() { + info "Installing VeraCrypt..." + ensure_tools + case "$DISTRO_FAMILY" in + arch) + pkg_install veracrypt + info "VeraCrypt installed." + return $? + ;; + debian|fedora|rhel|suse) ;; + *) + error "VeraCrypt publishes no package for ${DISTRO_NAME}." + return 1 + ;; + esac + + local ver name url ext tmpdir pkgfile + ver=$(_veracrypt_latest_version) + [[ -n "$ver" ]] || { error "Could not read the latest VeraCrypt release from GitHub."; return 1; } + name=$(_veracrypt_package_name "$ver") + if [[ -z "$name" ]]; then + error "VeraCrypt ${ver} has no build for ${DISTRO_NAME} ${DISTRO_VERSION_ID} (Debian 12/13, Ubuntu 22.04+, Fedora, CentOS 8 and openSUSE 15 only)." + return 1 + fi + if [[ "$DISTRO_FAMILY" == "fedora" && "$name" != *"-Fedora-${DISTRO_VERSION_ID%%.*}-"* ]]; then + warn "VeraCrypt has no Fedora ${DISTRO_VERSION_ID} build yet; using the newest one it publishes (${name})." + fi + url=$(_veracrypt_asset_url "$name") + [[ -n "$url" ]] || { error "Could not find ${name} in the VeraCrypt release."; return 1; } + + ext="${name##*.}" + tmpdir=$(mktemp -d /tmp/veracrypt-XXXXXX) || return 1 + CLEANUP_FILES+=("$tmpdir") + pkgfile="$tmpdir/$name" + download_file "$url" "$pkgfile" || { error "Failed to download ${name}."; return 1; } + verify_download "$pkgfile" "$ext" "VeraCrypt" || return 1 + + _veracrypt_verify_signature "$pkgfile" "$(_veracrypt_asset_url "${name}.sig")" || return 1 + + pkg_install_local "$pkgfile" || { error "Installing ${name} failed."; return 1; } + info "VeraCrypt installed." +} + +uninstall_veracrypt() { + info "Uninstalling VeraCrypt..." + pkg_remove veracrypt +} + +update_veracrypt() { + info "Updating VeraCrypt..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + pkg_upgrade veracrypt + return $? + fi + local installed latest + installed=$(get_version_veracrypt) + latest=$(_veracrypt_latest_version) + if [[ -n "$installed" && "$installed" == "$latest" ]]; then + info "VeraCrypt is already at ${installed}." + return 0 + fi + install_veracrypt +} + +get_version_veracrypt() { _ver_from_pkg veracrypt || echo ""; } diff --git a/lib/installers/xournalpp.sh b/lib/installers/xournalpp.sh new file mode 100644 index 0000000..78ab10e --- /dev/null +++ b/lib/installers/xournalpp.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Xournal++ handwritten notes installer functions +# Distro package where the repositories have one, otherwise Flathub +# (native_or_flatpak_* in _shared.sh). + +# --- Xournal++ --- + +check_xournalpp() { _check_standard xournalpp xournalpp com.github.xournalpp.xournalpp; } + +install_xournalpp() { + info "Installing Xournal++..." + native_or_flatpak_install com.github.xournalpp.xournalpp xournalpp || return 1 + info "Xournal++ installed." +} + +uninstall_xournalpp() { + info "Uninstalling Xournal++..." + native_or_flatpak_uninstall com.github.xournalpp.xournalpp xournalpp +} + +update_xournalpp() { + info "Updating Xournal++..." + native_or_flatpak_update com.github.xournalpp.xournalpp xournalpp +} + +get_version_xournalpp() { native_or_flatpak_version com.github.xournalpp.xournalpp xournalpp; } diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 606b9e6..b57f4bc 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -5348,6 +5348,268 @@ test_alpine_sudo_shim test_alpine_registry_filter test_alpine_table_names_registered +# ---------------------------------------------------------------------------- +echo "" +echo "=== Productivity apps: password managers, encryption, media, creative, documents (#91) ===" + +_PROD_APPS=( + "1Password|onepassword" "Anki|anki" "Blender|blender" "Calibre|calibre" + "Cryptomator|cryptomator" "Darktable|darktable" "KeePassXC|keepassxc" "Kodi|kodi" + "mpv|mpv" "Okular|okular" "RawTherapee|rawtherapee" "Scribus|scribus" + "Shotcut|shotcut" "Spotify|spotify" "VeraCrypt|veracrypt" "Xournal++|xournalpp" +) + +test_productivity_apps_registered() { + local entry name slug fn gaps=0 + for entry in "${_PROD_APPS[@]}"; do + IFS='|' read -r name slug <<<"$entry" + grep -qE "^register_utility \"${name//+/\\+}\"[[:space:]]+install_${slug} " "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing register: $name"; } + grep -qF "UTILITY_CATEGORY[\"${name}\"]=\"Productivity\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing category: $name"; } + grep -qF "UTILITY_DESCRIPTION[\"${name}\"]=" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing description: $name"; } + for fn in install check uninstall update get_version; do + grep -q "^${fn}_${slug}()" "${SCRIPT_DIR}/lib/installers/${slug}.sh" 2>/dev/null || { gaps=1; echo " missing ${fn}_${slug}"; } + done + grep -qxF " '${name}'" "${SCRIPT_DIR}/completions/_linux_util" || { gaps=1; echo " missing zsh completion: $name"; } + grep -qxF "${name}" "${SCRIPT_DIR}/completions/linux_util.bash" || { gaps=1; echo " missing bash completion: $name"; } + done + assert_eq "0" "$gaps" "The 16 new Productivity apps are registered with category, description, completions and all five functions" +} + +# 1Password is AUR-only on Arch, so it must be hidden there while AUR support is off. +# Every Productivity app sits in a folder, except the ones that belong to none. +test_productivity_subcategories() { + local entry name sub gaps=0 + for entry in "LibreOffice|Office Suites" \ + "OnlyOffice|Office Suites" \ + "WPS Office|Office Suites" \ + "Euro-Office|Office Suites" \ + "Joplin Client|Notes" \ + "Obsidian|Notes" \ + "Standard Notes|Notes" \ + "Anki|Notes" \ + "Xournal++|Notes" \ + "Logseq|Notes" \ + "Mark Text|Notes" \ + "Bitwarden Client|Password Managers" \ + "1Password|Password Managers" \ + "KeePassXC|Password Managers" \ + "Cryptomator|Encryption" \ + "VeraCrypt|Encryption" \ + "Calibre|Documents & Reading" \ + "Okular|Documents & Reading" \ + "Zotero|Documents & Reading" \ + "GIMP|Graphics & Photo" \ + "Inkscape|Graphics & Photo" \ + "Krita|Graphics & Photo" \ + "Blender|Graphics & Photo" \ + "Darktable|Graphics & Photo" \ + "RawTherapee|Graphics & Photo" \ + "Scribus|Graphics & Photo" \ + "Kdenlive|Video & Audio" \ + "Shotcut|Video & Audio" \ + "HandBrake|Video & Audio" \ + "Audacity|Video & Audio" \ + "OBS Studio|Video & Audio" \ + "VLC|Media" \ + "mpv|Media" \ + "Kodi|Media" \ + "Spotify|Media" \ + "Multimedia Codecs|Media" \ + "Libation|Media"; do + IFS='|' read -r name sub <<<"$entry" + grep -qF "UTILITY_SUBCATEGORY[\"${name}\"]=\"${sub}\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " ${name} not in ${sub}"; } + done + grep -qF 'SUBCATEGORY_ORDER["Productivity"]="Office Suites|Notes|Password Managers|Encryption|Documents & Reading|Graphics & Photo|Video & Audio|Media"' "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " no folder order"; } + assert_eq "0" "$gaps" "Productivity apps are sorted into Office Suites, Notes, Password Managers, Encryption, Documents & Reading, Graphics & Photo, Video & Audio and Media" +} + +test_onepassword_marked_aur_only_on_arch() { + assert_true "1Password is marked AUR-only on Arch with its package name" \ + grep -q '"1Password=1password"' "${SCRIPT_DIR}/lib/installers.sh" +} + +# Alpine: apk-packaged apps are offered, the rest are hidden. +test_productivity_apps_alpine_rows() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + have=""; for row in "${_ALPINE_TABLE[@]}"; do have+=" ${row%%|*}"; done + for n in mpv Kodi Blender Darktable RawTherapee Shotcut Scribus Anki Okular "Xournal++" KeePassXC; do + [[ " $have " == *" $n "* ]] || printf 'missing:%s ' "$n" + done + for n in Spotify 1Password VeraCrypt Cryptomator Calibre; do + [[ " $have " == *" $n "* ]] && printf 'unexpected:%s ' "$n" + done + echo done + ) + assert_eq "done" "$out" "Alpine lists the apps its repositories carry and hides Spotify, 1Password, VeraCrypt, Cryptomator and Calibre" +} + +# pkg_in_repo: one answer per package manager, from that manager's own query. +test_pkg_in_repo_per_manager() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + r() { "$@" && printf Y || printf n; } + PKG_MGR=apt + # Long output after the Candidate line: under pipefail a "| grep -q" would + # kill this early and report the package missing (SIGPIPE, status 141). + apt-cache() { printf 'x:\n Installed: (none)\n Candidate: %s\n' "${APT_CAND:-1.0-1}"; seq 1 30000; } + r pkg_in_repo mpv; APT_CAND="(none)"; r pkg_in_repo anki + PKG_MGR=dnf + dnf() { [[ "$*" == *"repoquery"* ]] && printf '%s\n' "${RPM_NAME:-}"; } + RPM_NAME=mpv; r pkg_in_repo mpv; RPM_NAME=""; r pkg_in_repo mpv; RPM_NAME=mpv-libs; r pkg_in_repo mpv + PKG_MGR=pacman + arch_repo_has() { [[ "$1" == mpv ]]; } + r pkg_in_repo mpv; r pkg_in_repo anki + PKG_MGR=zypper + zypper() { [[ "$*" == *"info mpv"* ]] && printf 'Name : mpv\nVersion : 0.42\n'; } + r pkg_in_repo mpv; r pkg_in_repo kodi + PKG_MGR=apk + apk() { [[ "$3" == mpv ]] && echo "mpv-0.41"; } + r pkg_in_repo mpv; r pkg_in_repo calibre + ) + assert_eq "YnYnnYnYnYn" "$out" "pkg_in_repo asks each package manager and needs an exact name match" +} + +# native_or_flatpak_install: repository first, Flathub only when the repository has no such package. +_nof_run() { # $1 family, $2 in-repo (y/n) + ( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + DISTRO_FAMILY="$1"; DISTRO_NAME="Test"; _log=$(mktemp); _inrepo="$2" + pkg_refresh() { :; }; info() { :; } + pkg_in_repo() { [[ "$_inrepo" == y ]]; } + pkg_install() { echo "pkg_install $*" >> "$_log"; } + flatpak_install_flathub() { echo "flatpak $*" >> "$_log"; } + enable_crb() { echo "crb" >> "$_log"; } + rpm() { return 1; } + native_or_flatpak_install org.example.App app; echo "rc=$?" >> "$_log" + tr '\n' ' ' < "$_log"; rm -f "$_log" + ) +} +test_native_or_flatpak_install_order() { + assert_eq "pkg_install app rc=0 " "$(_nof_run debian y)" "native_or_flatpak_install uses the distro package when the repository has it" + assert_eq "flatpak org.example.App rc=0 " "$(_nof_run debian n)" "native_or_flatpak_install uses Flathub when the repository has no such package" + assert_eq "pkg_install epel-release crb pkg_install app rc=0 " "$(_nof_run rhel y)" "native_or_flatpak_install enables EPEL and CRB first on RHEL clones" +} + +# Uninstall and update follow whichever route installed the app. +test_native_or_flatpak_uninstall_update_route() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + _log=$(mktemp) + flatpak_is_installed() { [[ "$FP" == y ]]; } + flatpak() { echo "flatpak $*" >> "$_log"; } + pkg_remove() { echo "pkg_remove $*" >> "$_log"; } + pkg_upgrade() { echo "pkg_upgrade $*" >> "$_log"; } + FP=y; native_or_flatpak_uninstall org.example.App app; native_or_flatpak_update org.example.App app + FP=n; native_or_flatpak_uninstall org.example.App app; native_or_flatpak_update org.example.App app + tr '\n' '|' < "$_log"; rm -f "$_log" + ) + assert_eq "flatpak uninstall -y --user org.example.App|flatpak update -y --user org.example.App|pkg_remove app|pkg_upgrade app|" "$out" \ + "uninstall and update use Flatpak for a Flatpak install and the package manager otherwise" +} + +# VeraCrypt: which release file fits which system. Names are upstream's fixed pattern. +_VC_FIXTURE='{"assets":[ + {"name": "veracrypt-1.26.31-Debian-12-amd64.deb"},{"name": "veracrypt-1.26.31-Debian-13-amd64.deb"},{"name": "veracrypt-1.26.31-Debian-13-arm64.deb"}, + {"name": "veracrypt-console-1.26.31-Debian-13-amd64.deb"},{"name": "veracrypt-1.26.31-Ubuntu-26.04-amd64.deb"}, + {"name": "veracrypt-1.26.31-Fedora-43-x86_64.rpm"},{"name": "veracrypt-1.26.31-Fedora-44-x86_64.rpm"}, + {"name": "veracrypt-1.26.31-CentOS-8-x86_64.rpm"},{"name": "veracrypt-1.26.31-openSUSE-15-x86_64.rpm"}, + {"name": "veracrypt-1.26.31-Debian-13-amd64.deb.sig"}]}' +_vc_pick() { # $1 family, $2 id, $3 version id, $4 dpkg arch + ( + source "${SCRIPT_DIR}/lib/installers/veracrypt.sh" + DISTRO_FAMILY="$1"; DISTRO_ID="$2"; DISTRO_VERSION_ID="$3"; _arch="${4:-amd64}" + dpkg() { echo "$_arch"; } + _VC_JSON="$_VC_FIXTURE" + _veracrypt_package_name 1.26.31 + ) +} +test_veracrypt_picks_release_file() { + assert_eq "veracrypt-1.26.31-Debian-13-amd64.deb" "$(_vc_pick debian debian 13.7)" "VeraCrypt: Debian 13 gets the Debian-13 .deb, not the console one" + assert_eq "veracrypt-1.26.31-Debian-13-arm64.deb" "$(_vc_pick debian debian 13.7 arm64)" "VeraCrypt: Debian arm64 gets the arm64 .deb" + assert_eq "veracrypt-1.26.31-Ubuntu-26.04-amd64.deb" "$(_vc_pick debian ubuntu 26.04.2)" "VeraCrypt: Ubuntu 26.04.2 gets the Ubuntu-26.04 .deb" + assert_eq "veracrypt-1.26.31-Ubuntu-26.04-amd64.deb" "$(_vc_pick debian kubuntu 26.04.0)" "VeraCrypt: Kubuntu counts as Ubuntu" + assert_eq "" "$(_vc_pick debian linuxmint 22)" "VeraCrypt: a Debian derivative with no matching build gets nothing" + assert_eq "" "$(_vc_pick debian ubuntu 25.10)" "VeraCrypt: an Ubuntu release upstream does not build for gets nothing" + assert_eq "veracrypt-1.26.31-Fedora-44-x86_64.rpm" "$(_vc_pick fedora fedora 44)" "VeraCrypt: Fedora 44 gets its own .rpm" + assert_eq "veracrypt-1.26.31-Fedora-44-x86_64.rpm" "$(_vc_pick fedora fedora 45)" "VeraCrypt: Fedora 45 (no build yet) gets the newest Fedora .rpm" + assert_eq "veracrypt-1.26.31-CentOS-8-x86_64.rpm" "$(_vc_pick rhel rocky 9.8)" "VeraCrypt: RHEL clones get the CentOS 8 .rpm" + assert_eq "veracrypt-1.26.31-openSUSE-15-x86_64.rpm" "$(_vc_pick suse opensuse-tumbleweed 20261101)" "VeraCrypt: openSUSE gets the openSUSE 15 .rpm" +} + +# Signature check: only a VALIDSIG whose primary key is the pinned VeraCrypt fingerprint passes. +_vc_sig_run() { # $1 gpg VALIDSIG status line (empty = bad signature), $2 fingerprints gpg reports for the key file + ( + source "${SCRIPT_DIR}/lib/installers/veracrypt.sh" + DISTRO_FAMILY=debian; error() { :; } + d=$(mktemp -d); echo data > "$d/pkg" + curl() { while [[ $# -gt 0 ]]; do [[ "$1" == -o ]] && : > "$2"; shift; done; return 0; } + download_file() { : > "$2"; } + _st="$1"; _fp="$2" + gpg() { + case "$*" in + *--show-keys*) printf 'fpr:::::::::%s:\n' "$_fp" ;; + *--verify*) printf '%s\n' "$_st" ;; + esac + } + _veracrypt_verify_signature "$d/pkg" "https://x/pkg.sig" && echo pass || echo fail + rm -rf "$d" + ) +} +test_veracrypt_signature_check() { + local good="5069A233D55A0EEB174A5FC3821ACD02680D16DE" sub="BB335DCA0D75325C6126BAB6200B5A9D26878A32" + assert_eq "pass" "$(_vc_sig_run "[GNUPG:] VALIDSIG ${sub} 2026-01-01 1 0 4 0 1 10 00 ${good}" "$good")" "VeraCrypt: a valid signature from a subkey of the pinned key passes" + assert_eq "fail" "$(_vc_sig_run "[GNUPG:] VALIDSIG ${sub} 2026-01-01 1 0 4 0 1 10 00 0000000000000000000000000000000000000000" "$good")" "VeraCrypt: a valid signature from another key fails" + assert_eq "fail" "$(_vc_sig_run "[GNUPG:] BADSIG 821ACD02680D16DE VeraCrypt Team" "$good")" "VeraCrypt: a bad signature fails" + assert_eq "fail" "$(_vc_sig_run "[GNUPG:] VALIDSIG ${sub} 2026-01-01 1 0 4 0 1 10 00 ${good}" "AAAA")" "VeraCrypt: a downloaded key with another fingerprint fails" +} + +# The download URL must be the file itself, never its .sig next to it. +test_veracrypt_asset_url_exact() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/veracrypt.sh" + _VC_JSON='"browser_download_url": "https://x/veracrypt-1.26.31-Debian-13-amd64.deb.sig" +"browser_download_url": "https://x/veracrypt-1.26.31-Debian-13-amd64.deb"' + _veracrypt_asset_url veracrypt-1.26.31-Debian-13-amd64.deb + ) + assert_eq "https://x/veracrypt-1.26.31-Debian-13-amd64.deb" "$out" "VeraCrypt: the download URL is the package, not its signature file" +} + +# 1Password: the vendor repository is added with the key fingerprint pinned. +test_onepassword_repo_setup() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/onepassword.sh" + _log=$(mktemp); info() { :; }; ensure_tools() { :; } + DISTRO_FAMILY=debian + dpkg() { echo amd64; } + _add_apt_repo() { printf 'key=%s ring=%s line=%s list=%s fpr=%s\n' "$1" "$2" "$3" "$4" "$5" >> "$_log"; } + pkg_install() { echo "pkg_install $*" >> "$_log"; } + install_onepassword + cat "$_log"; rm -f "$_log" + ) + assert_contains "$out" "key=https://downloads.1password.com/linux/keys/1password.asc" "1Password: apt repo uses the vendor key URL" + assert_contains "$out" "line=deb \[arch=amd64 signed-by=/usr/share/keyrings/1password-archive-keyring.gpg\] https://downloads.1password.com/linux/debian/amd64 stable main" "1Password: apt source line pins the keyring and architecture" + assert_contains "$out" "fpr=3FEF9748469ADBE15DA7CA80AC2D62742012EA22" "1Password: the key fingerprint is checked" + assert_contains "$out" "pkg_install 1password" "1password package installed after the repo is added" +} + +test_productivity_apps_registered +test_productivity_subcategories +test_onepassword_marked_aur_only_on_arch +test_productivity_apps_alpine_rows +test_pkg_in_repo_per_manager +test_native_or_flatpak_install_order +test_native_or_flatpak_uninstall_update_route +test_veracrypt_picks_release_file +test_veracrypt_asset_url_exact +test_veracrypt_signature_check +test_onepassword_repo_setup + echo "" echo "════════════════════════════════════════════════════════════════" echo "Test Results: ${_TESTS_PASSED} passed, ${_TESTS_FAILED} failed, ${_TESTS_SKIPPED} skipped" From 80fea77b757c603856a2f422dea270444a52cc2f Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 11:03:48 -0500 Subject: [PATCH 08/14] feat(system-tools): add 17 tools and sort System Tools into folders Add htop, nvtop, smartmontools, TLP, auto-cpufreq, zram, earlyoom, BleachBit, ncdu, HardInfo, inxi, CPU-X, CUPS, Alacritty, kitty, Ghostty and WezTerm (part of #91). System Tools now has Monitors, Power & Memory, Disk & Cleanup, System Info, Shell Tools, Terminal Emulators and Kernel Managers folders. ClamAV, CUPS, Input Leap and OCCT stay at the top level. Tools that cannot install on a family are not registered there: Alacritty on RHEL clones and Ubuntu 22.04, auto-cpufreq on openSUSE Leap and Rocky/Alma 8 and 9, Ghostty and WezTerm outside the families that package them, and TLP and inxi on Rocky/Alma 10. Alpine gets ten of them through its package table. auto-cpufreq uses the AUR on Arch and upstream's installer elsewhere. TLP and auto-cpufreq refuse to install beside each other. Extract ensure_epel from native_or_flatpak_install for reuse. Update the changelog, README, utilities docs and shell completions, and add tests. --- CHANGELOG.md | 17 +++ README.md | 2 +- completions/_linux_util | 17 +++ completions/linux_util.bash | 17 +++ docs/utilities.md | 79 +++++++++-- lib/installers.sh | 109 ++++++++++++++- lib/installers/_shared.sh | 15 +- lib/installers/alacritty.sh | 34 +++++ lib/installers/alpine_packages.sh | 10 ++ lib/installers/auto_cpufreq.sh | 130 +++++++++++++++++ lib/installers/bleachbit.sh | 29 ++++ lib/installers/cpu_x.sh | 31 +++++ lib/installers/cups.sh | 34 +++++ lib/installers/earlyoom.sh | 31 +++++ lib/installers/ghostty.sh | 36 +++++ lib/installers/hardinfo.sh | 64 +++++++++ lib/installers/htop.sh | 28 ++++ lib/installers/inxi.sh | 29 ++++ lib/installers/kitty.sh | 28 ++++ lib/installers/ncdu.sh | 29 ++++ lib/installers/nvtop.sh | 29 ++++ lib/installers/smartmontools.sh | 29 ++++ lib/installers/tlp.sh | 39 ++++++ lib/installers/wezterm.sh | 35 +++++ lib/installers/zram.sh | 69 +++++++++ tests/test_linux_util.sh | 224 ++++++++++++++++++++++++++++++ 26 files changed, 1175 insertions(+), 19 deletions(-) create mode 100644 lib/installers/alacritty.sh create mode 100644 lib/installers/auto_cpufreq.sh create mode 100644 lib/installers/bleachbit.sh create mode 100644 lib/installers/cpu_x.sh create mode 100644 lib/installers/cups.sh create mode 100644 lib/installers/earlyoom.sh create mode 100644 lib/installers/ghostty.sh create mode 100644 lib/installers/hardinfo.sh create mode 100644 lib/installers/htop.sh create mode 100644 lib/installers/inxi.sh create mode 100644 lib/installers/kitty.sh create mode 100644 lib/installers/ncdu.sh create mode 100644 lib/installers/nvtop.sh create mode 100644 lib/installers/smartmontools.sh create mode 100644 lib/installers/tlp.sh create mode 100644 lib/installers/wezterm.sh create mode 100644 lib/installers/zram.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 891f44f..0ecb862 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,23 @@ when a release is cut. ### Added +- **17 more System Tools** (part of #91). Monitors: htop and nvtop. Disk + health: smartmontools. Power and memory: TLP, auto-cpufreq, zram and + earlyoom. Cleanup: BleachBit and ncdu. Hardware info: HardInfo, inxi and + CPU-X. Printing: CUPS. Terminals: Alacritty, kitty, Ghostty and WezTerm. + System Tools is now sorted into folders: **Monitors**, **Power & Memory**, + **Disk & Cleanup**, **System Info**, **Shell Tools**, **Terminal Emulators** + and the existing Kernel Managers; ClamAV, CUPS, Input Leap and OCCT stay at + the top. Each uses the distro's own package (EPEL on Rocky/Alma), Flathub for + BleachBit and CPU-X where the repository has none, and, for auto-cpufreq + only, upstream's own installer from its GitHub release (the AUR on Arch, + only with AUR support on). TLP, earlyoom, CUPS and zram start their service. + Not offered: Alacritty on Rocky/Alma/RHEL and Ubuntu 22.04; auto-cpufreq on + openSUSE Leap, Rocky/Alma 8 and 9, and Alpine; Ghostty on Fedora and Rocky/Alma/RHEL, and on + Debian or Ubuntu releases whose repositories lack it; WezTerm except on + Arch, openSUSE and Alpine; TLP and inxi on Rocky/Alma 10. Alpine carries + htop, smartmontools, TLP, earlyoom, ncdu, inxi, Alacritty, kitty, WezTerm + and CUPS. - **16 more Productivity apps** (part of #91). Password managers and encryption: 1Password, KeePassXC, Cryptomator and VeraCrypt. Media: mpv, Kodi and Spotify. Creative: Blender, Darktable, RawTherapee, Shotcut and diff --git a/README.md b/README.md index 17339d8..93d7989 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ selection rules and the profile table: [docs/menu.md](docs/menu.md). | **Firewalls** | UFW and firewalld, each with its GUI front end (Gufw, firewall-config) | | **Login Screens** | SDDM, GDM, LightDM, ly, LXDM, plus SDDM themes and the LightDM Slick Greeter | | **Window Managers** | Hyprland, Sway, i3, bspwm, awesome, dwm, Openbox | -| **System Tools** | Btop, GPU Task Manager, Fastfetch, bat, ripgrep, ClamAV, Stacer, Filelight, Input Leap, OCCT, Pay Respects, Zsh + Oh My Zsh, and a Kernel Managers folder | +| **System Tools** | Folders for Monitors (Btop, htop, nvtop, GPU Task Manager, TMOG, Stacer), Power & Memory (TLP, auto-cpufreq, zram, earlyoom), Disk & Cleanup (smartmontools, ncdu, Filelight, BleachBit), System Info (Fastfetch, inxi, HardInfo, CPU-X), Shell Tools (bat, ripgrep, Pay Respects, Zsh + Oh My Zsh), Terminal Emulators (Alacritty, kitty, Ghostty, WezTerm) and Kernel Managers, plus ClamAV, CUPS, Input Leap and OCCT | Every entry, with its per-utility description and any distro limits, is in [docs/utilities.md](docs/utilities.md). For what is installed on *this* machine, diff --git a/completions/_linux_util b/completions/_linux_util index ab9a8f4..49d7212 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -6,13 +6,16 @@ _linux_util_utilities=( '1Password' + 'Alacritty' 'AMD Drivers' 'Anki' 'ArtCraft Launcher' + 'auto-cpufreq' 'bat' 'Betterbird' 'Bitwarden Client' 'Bitwarden Extension' + 'BleachBit' 'Blender' 'Bottles' 'Boxflat' @@ -30,8 +33,10 @@ _linux_util_utilities=( 'Codex' 'Command-Not-Found Prompt' 'COSMIC Desktop' + 'CPU-X' 'Create Snapshot' 'Cryptomator' + 'CUPS' 'Cursor IDE' 'Darktable' 'DBeaver' @@ -39,6 +44,7 @@ _linux_util_utilities=( 'Devolutions RDM' 'Discord' 'Docker' + 'earlyoom' 'Enable RDP' 'Evolution' 'Fastfetch' @@ -50,21 +56,26 @@ _linux_util_utilities=( 'Flatpak Setup' 'Full System Upgrade/Update' 'Geary' + 'Ghostty' 'GIMP' 'GitHub CLI' 'GNOME Desktop' 'Google Chrome' 'GPU Task Manager' 'GTK Window Fix' + 'HardInfo' 'Hermes Agent' 'Heroic Games Launcher' + 'htop' 'Intel Drivers' + 'inxi' 'JetBrains Toolbox' 'Joplin Client' 'Joplin Web Clipper' 'KDE Desktop' 'KDiskMark' 'KeePassXC' + 'kitty' 'KMail' 'Kodi' 'LibreOffice' @@ -79,12 +90,14 @@ _linux_util_utilities=( 'MATE Desktop' 'mpv' 'Multimedia Codecs' + 'ncdu' 'NeoMutt' 'Nextcloud Desktop' 'Num Lock at Boot' 'NVIDIA Drivers' 'NVIDIA PAIR' 'NVM' + 'nvtop' 'OBS Studio' 'Obsidian' 'Okular' @@ -94,7 +107,9 @@ _linux_util_utilities=( 'RawTherapee' 'Scribus' 'Shotcut' + 'smartmontools' 'Spotify' + 'TLP' 'tmux' 'tmux Resurrect' 'Pantheon Desktop' @@ -131,6 +146,7 @@ _linux_util_utilities=( 'Visual Studio Code' 'VSCodium' 'Vivaldi Browser' + 'WezTerm' 'WinApps' 'Wine' 'WireGuard Client' @@ -140,6 +156,7 @@ _linux_util_utilities=( 'Xfce Desktop' 'Xodus Nexus' 'Xournal++' + 'zram' 'Zsh + Oh My Zsh' ) diff --git a/completions/linux_util.bash b/completions/linux_util.bash index 7185241..ba357d0 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -4,13 +4,16 @@ _linux_util_utilities() { cat <<'EOF' 1Password +Alacritty AMD Drivers Anki ArtCraft Launcher +auto-cpufreq bat Betterbird Bitwarden Client Bitwarden Extension +BleachBit Blender Bottles Boxflat @@ -28,8 +31,10 @@ Cockpit Codex Command-Not-Found Prompt COSMIC Desktop +CPU-X Create Snapshot Cryptomator +CUPS Cursor IDE Darktable DBeaver @@ -37,6 +42,7 @@ Deepin Desktop Devolutions RDM Discord Docker +earlyoom Enable RDP Euro-Office Evolution @@ -49,21 +55,26 @@ Firefox Flatpak Setup Full System Upgrade/Update Geary +Ghostty GIMP GitHub CLI GNOME Desktop Google Chrome GPU Task Manager GTK Window Fix +HardInfo Hermes Agent Heroic Games Launcher +htop Intel Drivers +inxi JetBrains Toolbox Joplin Client Joplin Web Clipper KDE Desktop KDiskMark KeePassXC +kitty KMail Kodi LibreOffice @@ -78,11 +89,13 @@ MangoHud MATE Desktop mpv Multimedia Codecs +ncdu NeoMutt Nextcloud Desktop NVIDIA Drivers NVIDIA PAIR NVM +nvtop OBS Studio Obsidian Okular @@ -92,7 +105,9 @@ OpenSSH Server RawTherapee Scribus Shotcut +smartmontools Spotify +TLP tmux tmux Resurrect Pantheon Desktop @@ -130,6 +145,7 @@ VeraCrypt Visual Studio Code VSCodium Vivaldi Browser +WezTerm WinApps Wine WireGuard Client @@ -139,6 +155,7 @@ XEN Guest Utilities Xfce Desktop Xodus Nexus Xournal++ +zram Zsh + Oh My Zsh EOF } diff --git a/docs/utilities.md b/docs/utilities.md index d1551ec..24bc085 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -345,21 +345,82 @@ UFW Firewall is listed under [System Tasks](#system-tasks). | Utility | Description | |---------|-------------| -| **bat** | `cat` with syntax highlighting, line numbers and Git change markers — on Debian/Ubuntu, where the command is `batcat`, a `bat` link to it is added in `~/.local/bin` | -| **Btop** | Terminal-based resource monitor with rich visuals | | **ClamAV** | Open-source antivirus engine — prompts for a desktop front-end, defaulting to ClamUI (Flathub) | -| **Fastfetch** | Fast system information display tool | -| **Filelight** | Disk usage analyzer with interactive sunburst chart | -| **GPU Task Manager** | Terminal task manager for the GPU (`gputaskman`): per-process VRAM and GPU load, and which runtimes and model files use it — NVIDIA, AMD (amdgpu) and Intel (i915). Upstream's portable build, SHA-256 checked, installed per user in `~/.local/opt/gputaskman`; needs glibc 2.35 or newer (not Rocky/RHEL 9) | +| **CUPS** | The printing system; starts at boot, printers are added at `http://localhost:631` | | **Input Leap** | Software KVM — share keyboard and mouse across machines | | **OCCT** | CPU/RAM/GPU stability and stress testing — free Personal edition, x86_64 binary from ocbase.com, installed per-user under `~/.local/share/occt` | -| **Pay Respects** | Press `F` to fix the last failed command — Rust `thefuck` replacement with inline `Ctrl+X` correction. Installed from upstream's `.deb`/`.rpm` (in no distro repo; AUR on Arch) and wired into `~/.bashrc`/`~/.zshrc`; its AI module is disabled by default | -| **ripgrep** | `rg`: searches a folder tree for text much faster than `grep -r`, skipping files in `.gitignore` | -| **Stacer** | Graphical system optimizer and monitor | + +Grouped into folders inside the System Tools tab: + +### Monitors + +Resource, GPU and task monitors. + +| Utility | Description | +|---------|-------------| +| **Btop** | Terminal-based resource monitor with rich visuals | +| **htop** | Interactive process viewer | +| **nvtop** | `htop` for GPUs (NVIDIA, AMD, Intel); not available on Alpine | +| **GPU Task Manager** | Terminal task manager for the GPU (`gputaskman`): per-process VRAM and GPU load, and which runtimes and model files use it — NVIDIA, AMD (amdgpu) and Intel (i915). Upstream's portable build, SHA-256 checked, installed per user in `~/.local/opt/gputaskman`; needs glibc 2.35 or newer (not Rocky/RHEL 9) | | **TMOG** | Native Qt task manager with real-time system metrics — no repo, AUR, or checksums upstream; installed from tmog.org's `.deb` on Debian/Ubuntu, AppImage elsewhere | +| **Stacer** | Graphical system optimizer and monitor | + +### Power & Memory + +Battery, CPU power and memory-pressure tools. + +| Utility | Description | +|---------|-------------| +| **TLP** | Laptop battery and power tuning, started at boot. Replaces power-profiles-daemon, cannot run beside auto-cpufreq; not available on Rocky/Alma 10, where EPEL has no package | +| **auto-cpufreq** | Adjusts CPU speed and power use to the battery and load, with a background service, for laptops. Arch: the AUR (only with AUR support on). Elsewhere upstream's own installer runs from the GitHub release into `/opt/auto-cpufreq` — upstream publishes no checksum. Cannot run beside TLP; not available on Alpine, on openSUSE Leap (upstream's installer cannot find its Python packages) or on Rocky/Alma 8 and 9 (the program needs Python 3.10) | +| **zram** | Compressed swap in RAM. `zram-tools` on Debian/Ubuntu, `zram-generator` elsewhere (half of RAM, at most 4 GiB, unless a config already exists); not available on Alpine | +| **earlyoom** | Ends the biggest memory hog before the machine freezes; started at boot | + +### Disk & Cleanup + +Drive health, disk usage and cleaning. + +| Utility | Description | +|---------|-------------| +| **smartmontools** | `smartctl` and `smartd` for drive health; services left as the package sets them | +| **ncdu** | Terminal disk-usage browser | +| **Filelight** | Disk usage analyzer with interactive sunburst chart | +| **BleachBit** | Disk cleaner for caches, logs, history and temporary files. Distro package (EPEL on Rocky/Alma 8 and 9), Flathub on Rocky/Alma 10; not available on Alpine | + +### System Info + +Hardware and system information. + +| Utility | Description | +|---------|-------------| +| **Fastfetch** | Fast system information display tool | +| **inxi** | Readable hardware and system summary (`inxi -Fxz`); not available on Rocky/Alma 10, where EPEL has no package | +| **HardInfo** | System profiler and benchmark window. Installs HardInfo2 (the old HardInfo on Ubuntu 22.04); EPEL on Rocky/Alma; not available on Alpine | +| **CPU-X** | CPU-Z-style window for CPU, motherboard, memory and GPU details. Distro package, Flathub on Rocky/Alma/RHEL; not available on Alpine | + +### Shell Tools + +Command-line helpers and shells. + +| Utility | Description | +|---------|-------------| +| **bat** | `cat` with syntax highlighting, line numbers and Git change markers — on Debian/Ubuntu, where the command is `batcat`, a `bat` link to it is added in `~/.local/bin` | +| **ripgrep** | `rg`: searches a folder tree for text much faster than `grep -r`, skipping files in `.gitignore` | +| **Pay Respects** | Press `F` to fix the last failed command — Rust `thefuck` replacement with inline `Ctrl+X` correction. Installed from upstream's `.deb`/`.rpm` (in no distro repo; AUR on Arch) and wired into `~/.bashrc`/`~/.zshrc`; its AI module is disabled by default | | **Zsh + Oh My Zsh** | Z shell with Oh My Zsh framework, themes, and plugins | -Grouped under a **Kernel Managers** folder inside the System Tools tab — tools for installing and switching alternate kernels. Each is listed on every distro but installs only on the family it supports (warning and stopping otherwise): +### Terminal Emulators + +| Utility | Description | +|---------|-------------| +| **Alacritty** | GPU-accelerated terminal emulator configured by a text file. Distro package; not offered on Rocky/Alma/RHEL or Ubuntu 22.04, which have none | +| **Ghostty** | Fast GPU-accelerated terminal emulator. From the distro package: Arch, openSUSE Tumbleweed, Ubuntu 26.04 and newer. Upstream publishes no Linux packages, so elsewhere it says so and changes nothing; not offered on Fedora, Rocky/Alma/RHEL or Alpine | +| **kitty** | GPU-accelerated terminal emulator with tabs, splits and image display | +| **WezTerm** | GPU-accelerated terminal emulator configured in Lua. Offered on Arch, openSUSE and Alpine only: upstream's stable build is from 2024 and its other channels are nightlies | + +### Kernel Managers + +Tools for installing and switching alternate kernels. Each is listed on every distro but installs only on the family it supports (warning and stopping otherwise). | Utility | Description | |---------|-------------| diff --git a/lib/installers.sh b/lib/installers.sh index 6fd9c8e..4624b1c 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -396,6 +396,44 @@ if [[ "$DISTRO_ID" != "elementary" && "$_rhel10_plus" == "false" ]]; then register_utility "Cinnamon Desktop" install_cinnamon check_cinnamon uninstall_cinnamon update_cinnamon get_version_cinnamon fi +# System Tools (#91): monitors, disk health, power and memory, cleanup, hardware +# info, terminal emulators and printing. Only the ones that cannot install on a +# family are held back (the reason is in each installer's header and in +# docs/utilities.md). Alpine keeps only the ones in alpine_packages.sh. +register_utility "BleachBit" install_bleachbit check_bleachbit uninstall_bleachbit update_bleachbit get_version_bleachbit +register_utility "CPU-X" install_cpu_x check_cpu_x uninstall_cpu_x update_cpu_x get_version_cpu_x +register_utility "CUPS" install_cups check_cups uninstall_cups update_cups get_version_cups +register_utility "earlyoom" install_earlyoom check_earlyoom uninstall_earlyoom update_earlyoom get_version_earlyoom +register_utility "HardInfo" install_hardinfo check_hardinfo uninstall_hardinfo update_hardinfo get_version_hardinfo +register_utility "htop" install_htop check_htop uninstall_htop update_htop get_version_htop +register_utility "kitty" install_kitty check_kitty uninstall_kitty update_kitty get_version_kitty +register_utility "ncdu" install_ncdu check_ncdu uninstall_ncdu update_ncdu get_version_ncdu +register_utility "nvtop" install_nvtop check_nvtop uninstall_nvtop update_nvtop get_version_nvtop +register_utility "smartmontools" install_smartmontools check_smartmontools uninstall_smartmontools update_smartmontools get_version_smartmontools +register_utility "zram" install_zram check_zram uninstall_zram update_zram get_version_zram +# Alacritty: no package for Rocky/Alma/RHEL (no upstream binary either) or Ubuntu 22.04. +if [[ "$DISTRO_FAMILY" != "rhel" ]] && ! [[ "$DISTRO_ID" == "ubuntu" && "${DISTRO_VERSION_ID%%.*}" -lt 23 ]]; then + register_utility "Alacritty" install_alacritty check_alacritty uninstall_alacritty update_alacritty get_version_alacritty +fi +# auto-cpufreq: upstream's installer asks openSUSE Leap for Python packages Leap does not have, +# and the program needs Python 3.10, which Rocky/Alma 8 and 9 do not ship. +if [[ "$DISTRO_ID" != "opensuse-leap" && "$DISTRO_ID" != "sles" ]] && { [[ "$DISTRO_FAMILY" != "rhel" ]] || [[ "${DISTRO_VERSION_ID%%.*}" -ge 10 ]]; }; then + register_utility "auto-cpufreq" install_auto_cpufreq check_auto_cpufreq uninstall_auto_cpufreq update_auto_cpufreq get_version_auto_cpufreq +fi +# Ghostty: only the Debian family, Arch and openSUSE carry a package. +if [[ "$DISTRO_FAMILY" == "debian" || "$DISTRO_FAMILY" == "arch" || "$DISTRO_FAMILY" == "suse" ]]; then + register_utility "Ghostty" install_ghostty check_ghostty uninstall_ghostty update_ghostty get_version_ghostty +fi +# WezTerm: only Arch, openSUSE and Alpine carry a maintained package. +if [[ "$DISTRO_FAMILY" == "arch" || "$DISTRO_FAMILY" == "suse" || "$DISTRO_FAMILY" == "alpine" ]]; then + register_utility "WezTerm" install_wezterm check_wezterm uninstall_wezterm update_wezterm get_version_wezterm +fi +# EPEL 10 has neither TLP nor inxi. +if [[ "$DISTRO_FAMILY" != "rhel" || "${DISTRO_VERSION_ID%.*}" -lt 10 ]]; then + register_utility "inxi" install_inxi check_inxi uninstall_inxi update_inxi get_version_inxi + register_utility "TLP" install_tlp check_tlp uninstall_tlp update_tlp get_version_tlp +fi + # COSMIC: requires Ubuntu 24.10+/Debian Trixie, Fedora 42+, or Arch. # Not packaged for the RHEL ecosystem or openSUSE Leap/SLES. if [[ "$DISTRO_ID" != "elementary" ]] && \ @@ -711,6 +749,23 @@ UTILITY_CATEGORY["firewall-config (GUI)"]="Firewalls" UTILITY_CATEGORY["HandBrake"]="Productivity" UTILITY_CATEGORY["Inkscape"]="Productivity" UTILITY_CATEGORY["Input Leap"]="System Tools" +UTILITY_CATEGORY["auto-cpufreq"]="System Tools" +UTILITY_CATEGORY["BleachBit"]="System Tools" +UTILITY_CATEGORY["CPU-X"]="System Tools" +UTILITY_CATEGORY["CUPS"]="System Tools" +UTILITY_CATEGORY["earlyoom"]="System Tools" +UTILITY_CATEGORY["HardInfo"]="System Tools" +UTILITY_CATEGORY["htop"]="System Tools" +UTILITY_CATEGORY["kitty"]="System Tools" +UTILITY_CATEGORY["ncdu"]="System Tools" +UTILITY_CATEGORY["nvtop"]="System Tools" +UTILITY_CATEGORY["smartmontools"]="System Tools" +UTILITY_CATEGORY["zram"]="System Tools" +UTILITY_CATEGORY["Alacritty"]="System Tools" +UTILITY_CATEGORY["Ghostty"]="System Tools" +UTILITY_CATEGORY["WezTerm"]="System Tools" +UTILITY_CATEGORY["inxi"]="System Tools" +UTILITY_CATEGORY["TLP"]="System Tools" UTILITY_CATEGORY["k9s"]="Development" UTILITY_CATEGORY["Kdenlive"]="Productivity" UTILITY_CATEGORY["Krita"]="Productivity" @@ -904,6 +959,32 @@ UTILITY_SUBCATEGORY["Midnight Commander"]="Terminal" UTILITY_SUBCATEGORY["Ranger"]="Terminal" UTILITY_SUBCATEGORY["nnn"]="Terminal" UTILITY_SUBCATEGORY["Superfile"]="Terminal" +UTILITY_SUBCATEGORY["Alacritty"]="Terminal Emulators" +UTILITY_SUBCATEGORY["Ghostty"]="Terminal Emulators" +UTILITY_SUBCATEGORY["kitty"]="Terminal Emulators" +UTILITY_SUBCATEGORY["WezTerm"]="Terminal Emulators" +UTILITY_SUBCATEGORY["Btop"]="Monitors" +UTILITY_SUBCATEGORY["htop"]="Monitors" +UTILITY_SUBCATEGORY["nvtop"]="Monitors" +UTILITY_SUBCATEGORY["GPU Task Manager"]="Monitors" +UTILITY_SUBCATEGORY["TMOG"]="Monitors" +UTILITY_SUBCATEGORY["Stacer"]="Monitors" +UTILITY_SUBCATEGORY["TLP"]="Power & Memory" +UTILITY_SUBCATEGORY["auto-cpufreq"]="Power & Memory" +UTILITY_SUBCATEGORY["zram"]="Power & Memory" +UTILITY_SUBCATEGORY["earlyoom"]="Power & Memory" +UTILITY_SUBCATEGORY["smartmontools"]="Disk & Cleanup" +UTILITY_SUBCATEGORY["ncdu"]="Disk & Cleanup" +UTILITY_SUBCATEGORY["Filelight"]="Disk & Cleanup" +UTILITY_SUBCATEGORY["BleachBit"]="Disk & Cleanup" +UTILITY_SUBCATEGORY["Fastfetch"]="System Info" +UTILITY_SUBCATEGORY["inxi"]="System Info" +UTILITY_SUBCATEGORY["HardInfo"]="System Info" +UTILITY_SUBCATEGORY["CPU-X"]="System Info" +UTILITY_SUBCATEGORY["bat"]="Shell Tools" +UTILITY_SUBCATEGORY["ripgrep"]="Shell Tools" +UTILITY_SUBCATEGORY["Pay Respects"]="Shell Tools" +UTILITY_SUBCATEGORY["Zsh + Oh My Zsh"]="Shell Tools" UTILITY_SUBCATEGORY["SDDM"]="Display Managers" UTILITY_SUBCATEGORY["GDM"]="Display Managers" UTILITY_SUBCATEGORY["LightDM"]="Display Managers" @@ -954,7 +1035,7 @@ SUBCATEGORY_ORDER["Productivity"]="Office Suites|Notes|Password Managers|Encrypt SUBCATEGORY_ORDER["Remote Admin Tools"]="Remote Access" SUBCATEGORY_ORDER["Bootloaders"]="GRUB Themes" SUBCATEGORY_ORDER["Login Screens"]="Display Managers|SDDM Themes|LightDM Greeters" -SUBCATEGORY_ORDER["System Tools"]="Kernel Managers" +SUBCATEGORY_ORDER["System Tools"]="Monitors|Power & Memory|Disk & Cleanup|System Info|Shell Tools|Terminal Emulators|Kernel Managers" # --- Descriptions (shown in the info panel when an item is highlighted) --- @@ -1174,6 +1255,23 @@ UTILITY_DESCRIPTION["linux-tkg"]="Frogging-Family custom-kernel builder. Unlike UTILITY_DESCRIPTION["Btop"]="Modern terminal-based resource monitor with a rich visual interface showing CPU, memory, disk, and network." UTILITY_DESCRIPTION["bat"]="A cat clone with syntax highlighting, line numbers and Git change markers. On Debian/Ubuntu, where the command is named batcat, a bat link to it is added in ~/.local/bin." UTILITY_DESCRIPTION["ripgrep"]="rg: searches a folder tree for text much faster than grep -r, and skips files listed in .gitignore." +UTILITY_DESCRIPTION["Alacritty"]="Fast GPU-accelerated terminal emulator configured by a text file. Distro package; not available on Rocky/Alma/RHEL or Ubuntu 22.04, which have none." +UTILITY_DESCRIPTION["auto-cpufreq"]="Adjusts CPU speed and power use to the battery and load, with a background service; for laptops. No distro carries it: on Arch it comes from the AUR (only with AUR support enabled), elsewhere upstream's own installer runs from the GitHub release (upstream publishes no checksum), into /opt/auto-cpufreq. Cannot run beside TLP. Not available on Alpine, openSUSE Leap or Rocky/Alma 8 and 9." +UTILITY_DESCRIPTION["BleachBit"]="Disk cleaner that clears caches, logs, history and temporary files for the system and many applications. Distro package (EPEL on Rocky/Alma 8 and 9), or Flathub on Rocky/Alma 10. Not available on Alpine." +UTILITY_DESCRIPTION["CPU-X"]="CPU-Z-style window showing the CPU, motherboard, memory, GPU and system. Distro package, or Flathub on Rocky/Alma/RHEL. Not available on Alpine." +UTILITY_DESCRIPTION["CUPS"]="The printing system: installs the print server and starts it at boot. Add printers at http://localhost:631 or in the desktop's printer settings." +UTILITY_DESCRIPTION["earlyoom"]="Ends the biggest memory hog before the machine freezes, instead of waiting for the kernel's slow out-of-memory killer. Started at boot." +UTILITY_DESCRIPTION["Ghostty"]="Fast GPU-accelerated terminal emulator. Installed from the distro package, which exists on Arch, openSUSE Tumbleweed and Ubuntu 26.04 and newer; elsewhere it says so and changes nothing. Not offered on Fedora, Rocky/Alma/RHEL or Alpine." +UTILITY_DESCRIPTION["HardInfo"]="System profiler and benchmark window: CPU, memory, storage, sensors and network. Installs HardInfo2, the maintained fork (the old HardInfo on Ubuntu 22.04). Distro package, or EPEL on Rocky/Alma. Not available on Alpine." +UTILITY_DESCRIPTION["htop"]="Interactive process viewer with colours, a tree view and mouse support." +UTILITY_DESCRIPTION["inxi"]="Prints a readable summary of the hardware and system: CPU, GPU, disks, network and sensors. Try inxi -Fxz. Not available on Rocky/Alma 10, where EPEL has no package." +UTILITY_DESCRIPTION["kitty"]="Fast GPU-accelerated terminal emulator with tabs, splits and image display. Distro package (EPEL on Rocky/Alma)." +UTILITY_DESCRIPTION["ncdu"]="Terminal disk-usage browser: shows which folders use the space and lets you delete from the list." +UTILITY_DESCRIPTION["nvtop"]="htop-style monitor for GPUs (NVIDIA, AMD, Intel). Distro package (EPEL on Rocky/Alma). Not available on Alpine." +UTILITY_DESCRIPTION["smartmontools"]="smartctl reads a drive's SMART health data and smartd watches it in the background. Installs the package and leaves its services as the package sets them." +UTILITY_DESCRIPTION["TLP"]="Laptop battery and power tuning that works with its defaults and starts at boot. Replaces power-profiles-daemon and cannot run beside auto-cpufreq. Not available on Rocky/Alma 10, where EPEL has no package." +UTILITY_DESCRIPTION["WezTerm"]="GPU-accelerated terminal emulator configured in Lua. Distro package on Arch, openSUSE and Alpine; not offered elsewhere, where upstream's stable build is from 2024 and the rest are nightlies." +UTILITY_DESCRIPTION["zram"]="Compressed swap in RAM: the machine holds more before it slows down, with no swap partition. zram-tools on Debian and Ubuntu, zram-generator elsewhere (half of RAM, at most 4 GiB, unless the system already has a config). Not available on Alpine." UTILITY_DESCRIPTION["Filelight"]="KDE disk usage analyzer that visualizes storage consumption as an interactive radial map, making it easy to identify large files and directories." UTILITY_DESCRIPTION["ClamAV"]="Open-source antivirus engine for detecting trojans, viruses, malware, and other malicious threats. Asks which desktop front-end you want and defaults to ClamUI, a GTK4/libadwaita app from Flathub covering scanning, quarantine, and scheduled scans; ClamTk is offered too wherever the distro packages it. Enables the freshclam definition updater and the scan daemon." UTILITY_DESCRIPTION["Input Leap"]="Open-source KVM software that shares one keyboard and mouse across multiple computers on your local network." @@ -1264,7 +1362,8 @@ mark_aur_only_arch \ "Devolutions RDM=remote-desktop-manager" \ "Euro-Office=euro-office-desktopeditors-git" \ "Snap (snapd)=snapd" "Snapper GUI=snapper-gui-git" \ - "Trojita=trojita" "Zotero=zotero" "1Password=1password" + "Trojita=trojita" "Zotero=zotero" "1Password=1password" \ + "auto-cpufreq=auto-cpufreq" # Utilities that can install from upstream's own binary when no package source # carries them (the third tier of arch_install_ordered, reached on Arch because @@ -1288,7 +1387,8 @@ mark_upstream_binary \ "Xodus Nexus=$_XN_APPIMAGE" \ "Hermes Agent=$HOME/.hermes/hermes-agent" \ "LM Studio=$_LMS_APPIMAGE" \ - "GPU Task Manager=$_GTM_DIR" + "GPU Task Manager=$_GTM_DIR" \ + "auto-cpufreq=$_ACF_ROOT/current" # Where the current upstream version can be read for those installs. Registered # only for the ones with a cheap, stable version endpoint: these lookups gate @@ -1302,7 +1402,8 @@ mark_upstream_latest \ "Claude Desktop=_claude_desktop_latest_version" \ "Xodus Nexus=_xn_latest_version" \ "LM Studio=_lms_latest_version" \ - "GPU Task Manager=_gtm_latest_version" + "GPU Task Manager=_gtm_latest_version" \ + "auto-cpufreq=_acf_latest_version" # Utilities whose own run is a complete system upgrade, so the pre-flight package # refresh must not upgrade ahead of them -- see mark_full_upgrade in utilities.sh. diff --git a/lib/installers/_shared.sh b/lib/installers/_shared.sh index 4460592..bc18246 100644 --- a/lib/installers/_shared.sh +++ b/lib/installers/_shared.sh @@ -453,6 +453,15 @@ pkg_in_repo() { esac } +# RHEL clones carry much of this software in EPEL (which needs CRB). A no-op +# on every other family. Used by native_or_flatpak_install and the installers +# that take a package from EPEL. +ensure_epel() { + [[ "${DISTRO_FAMILY:-}" == "rhel" ]] || return 0 + rpm -q epel-release &>/dev/null || pkg_install epel-release || true + enable_crb +} + # Install a Flathub app system-wide, adding flatpak and the flathub remote first. # sudo, not a bare flatpak: ensure_flatpak adds flathub as a SYSTEM remote (see # the note in flatpak_or_aur in aur.sh). @@ -467,11 +476,7 @@ flatpak_install_flathub() { native_or_flatpak_install() { local flatpak_id="$1" pkg="$2" pkg_refresh - # RHEL clones carry much of this software in EPEL (which needs CRB). - if [[ "${DISTRO_FAMILY:-}" == "rhel" ]]; then - rpm -q epel-release &>/dev/null || pkg_install epel-release || true - enable_crb - fi + ensure_epel if pkg_in_repo "$pkg"; then pkg_install "$pkg" return $? diff --git a/lib/installers/alacritty.sh b/lib/installers/alacritty.sh new file mode 100644 index 0000000..7146f5d --- /dev/null +++ b/lib/installers/alacritty.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Alacritty terminal emulator installer functions +# +# GPU-accelerated terminal configured by a text file. In the repositories of +# Debian, Ubuntu 23.04 and newer, Fedora, Arch, openSUSE and Alpine. +# Rocky/Alma/RHEL and Ubuntu 22.04 have no package and upstream publishes no +# binary or Flatpak, so it is not offered there. + +# --- Alacritty --- + +check_alacritty() { _check_standard alacritty alacritty ""; } + +install_alacritty() { + info "Installing Alacritty..." + pkg_refresh + if ! pkg_in_repo alacritty; then + error "Alacritty is not in the ${DISTRO_NAME:-system} repositories. Nothing was changed." + return 1 + fi + pkg_install alacritty || return 1 + info "Alacritty installed." +} + +uninstall_alacritty() { + info "Uninstalling Alacritty..." + pkg_remove alacritty +} + +update_alacritty() { + info "Updating Alacritty..." + pkg_upgrade alacritty +} + +get_version_alacritty() { _ver_from_pkg alacritty || _ver_from_cmd alacritty || echo ""; } diff --git a/lib/installers/alpine_packages.sh b/lib/installers/alpine_packages.sh index bd186fc..615dcc8 100644 --- a/lib/installers/alpine_packages.sh +++ b/lib/installers/alpine_packages.sh @@ -99,6 +99,16 @@ _ALPINE_TABLE=( "Scribus|scribus|scribus||" "Shotcut|shotcut|shotcut||" "Xournal++|xournalpp|xournalpp||" + "htop|htop|htop||" + "smartmontools|smartmontools|||" + "TLP|tlp||tlp|" + "earlyoom|earlyoom|earlyoom|earlyoom|" + "ncdu|ncdu|ncdu||" + "inxi|inxi|inxi||" + "Alacritty|alacritty|alacritty||" + "kitty|kitty|kitty||" + "WezTerm|wezterm|wezterm||" + "CUPS|cups||cupsd|" ) # Registered utilities whose own installer file has an Alpine branch. diff --git a/lib/installers/auto_cpufreq.sh b/lib/installers/auto_cpufreq.sh new file mode 100644 index 0000000..b3695d8 --- /dev/null +++ b/lib/installers/auto_cpufreq.sh @@ -0,0 +1,130 @@ +#!/bin/bash +# auto-cpufreq installer functions +# +# Adjusts CPU speed and power use to the battery and load, with a background +# service. No distro repository carries it (the AUR does, used on Arch only +# when AUR support is on). Elsewhere the installer downloads the release's +# source archive from GitHub over HTTPS and runs upstream's own installer +# (auto-cpufreq-installer --install), which puts it in /opt/auto-cpufreq with +# its Python parts from PyPI, then installs the service with +# `auto-cpufreq --install`. Upstream publishes no checksum or signature for +# releases. It cannot run beside TLP; needs systemd, so it is not offered on +# Alpine, and upstream's installer fails on openSUSE Leap (it asks for Python +# packages Leap does not have) and the program needs Python 3.10, which Rocky/Alma +# 8 and 9 do not ship, so it is not offered on either. + +# --- auto-cpufreq --- + +_ACF_API="https://api.github.com/repos/AdnanHodzic/auto-cpufreq/releases/latest" +_ACF_ROOT="/opt/auto-cpufreq" +# Written when the service is installed; present only while it is. +_ACF_DAEMON_REMOVER="/usr/local/bin/auto-cpufreq-remove" + +# Latest release version without the leading v, e.g. 3.2.0. +_acf_latest_version() { + curl -fsSL --max-time 15 "$_ACF_API" 2>/dev/null \ + | grep -oP '"tag_name"\s*:\s*"v?\K[0-9.]+' | head -1 +} + +check_auto_cpufreq() { + [[ -e "${_ACF_ROOT}/current" ]] && return 0 + _check_standard auto-cpufreq auto-cpufreq "" +} + +# Download release $1 and run upstream's installer from it. +_acf_install_source() { + local ver="$1" tmp + ensure_tools + tmp=$(mktemp -d) || return 1 + CLEANUP_FILES+=("$tmp") + info "Downloading auto-cpufreq ${ver} from GitHub..." + curl -fsSL --max-time 120 \ + "https://github.com/AdnanHodzic/auto-cpufreq/archive/refs/tags/v${ver}.tar.gz" \ + -o "${tmp}/src.tar.gz" || { error "Could not download auto-cpufreq ${ver}."; rm -rf "$tmp"; return 1; } + mkdir "${tmp}/src" && tar -xzf "${tmp}/src.tar.gz" -C "${tmp}/src" --strip-components=1 \ + || { error "Could not unpack the auto-cpufreq download."; rm -rf "$tmp"; return 1; } + sudo bash "${tmp}/src/auto-cpufreq-installer" --install + local rc=$? + rm -rf "$tmp" + return "$rc" +} + +# Put release $1 in place and start its service. Upstream's installer refuses to +# run while the service is installed, so a running install is stopped first. +_acf_deploy() { + local ver="$1" + if [[ -e "$_ACF_DAEMON_REMOVER" ]]; then + sudo auto-cpufreq --remove || { error "Could not stop the auto-cpufreq service for the update."; return 1; } + fi + _acf_install_source "$ver" || return 1 + sudo auto-cpufreq --install || warn "Could not install the auto-cpufreq service; run 'sudo auto-cpufreq --install' later." +} + +install_auto_cpufreq() { + info "Installing auto-cpufreq..." + if pkg_check_installed tlp; then + error "TLP is installed, and the two fight over the same CPU settings. Uninstall TLP first." + return 1 + fi + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur auto-cpufreq || return 1 + svc_enable_now auto-cpufreq || warn "Could not start the auto-cpufreq service; it will start at the next boot." + info "auto-cpufreq installed." + return 0 + fi + local ver + ver=$(_acf_latest_version) + [[ -n "$ver" ]] || { error "Could not read the latest auto-cpufreq version from GitHub."; return 1; } + _acf_deploy "$ver" || return 1 + info "auto-cpufreq ${ver} installed. Watch it with: auto-cpufreq --stats" +} + +uninstall_auto_cpufreq() { + info "Uninstalling auto-cpufreq..." + if [[ -e "${_ACF_ROOT}/current" ]]; then + # Upstream order: the service first, then the program. + sudo auto-cpufreq --remove 2>/dev/null || true + local tmp ver + ver=$(_acf_latest_version) + [[ -n "$ver" ]] || { error "Could not read the auto-cpufreq version from GitHub to run its remover."; return 1; } + tmp=$(mktemp -d) || return 1 + CLEANUP_FILES+=("$tmp") + curl -fsSL --max-time 120 "https://github.com/AdnanHodzic/auto-cpufreq/archive/refs/tags/v${ver}.tar.gz" \ + -o "${tmp}/src.tar.gz" && mkdir "${tmp}/src" \ + && tar -xzf "${tmp}/src.tar.gz" -C "${tmp}/src" --strip-components=1 \ + && sudo bash "${tmp}/src/auto-cpufreq-installer" --remove + local rc=$? + rm -rf "$tmp" + return "$rc" + fi + svc_disable_now auto-cpufreq 2>/dev/null || true + pkg_remove auto-cpufreq +} + +update_auto_cpufreq() { + info "Updating auto-cpufreq..." + if [[ -e "${_ACF_ROOT}/current" ]]; then + local ver cur + ver=$(_acf_latest_version) + [[ -n "$ver" ]] || { error "Could not read the latest auto-cpufreq version from GitHub."; return 1; } + cur=$(get_version_auto_cpufreq) + if [[ -n "$cur" && "$cur" == "$ver" ]]; then + info "auto-cpufreq is already at the latest version (${cur})." + return 0 + fi + _acf_deploy "$ver" + elif [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur auto-cpufreq + else + error "auto-cpufreq is not installed." + return 1 + fi +} + +# --version prints the distro and kernel first, so the line that names +# auto-cpufreq is picked out: "auto-cpufreq version: 3.2.0 (git: ...)". +get_version_auto_cpufreq() { + local v + v=$(_run_native auto-cpufreq --version 2>/dev/null | sed -n 's/^auto-cpufreq version: \([0-9][0-9.]*\).*/\1/p' | head -1) + printf '%s\n' "$v" +} diff --git a/lib/installers/bleachbit.sh b/lib/installers/bleachbit.sh new file mode 100644 index 0000000..7d395d4 --- /dev/null +++ b/lib/installers/bleachbit.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# BleachBit installer functions +# +# Disk cleaner: clears caches, logs, history and temporary files for the system +# and many applications. Distro package where the repositories have one +# (EPEL on Rocky/Alma 8 and 9), otherwise Flathub (Rocky/Alma 10). +# Alpine has no package, so it is not offered there. + +# --- BleachBit --- + +check_bleachbit() { _check_standard bleachbit bleachbit org.bleachbit.BleachBit; } + +install_bleachbit() { + info "Installing BleachBit..." + native_or_flatpak_install org.bleachbit.BleachBit bleachbit || return 1 + info "BleachBit installed." +} + +uninstall_bleachbit() { + info "Uninstalling BleachBit..." + native_or_flatpak_uninstall org.bleachbit.BleachBit bleachbit +} + +update_bleachbit() { + info "Updating BleachBit..." + native_or_flatpak_update org.bleachbit.BleachBit bleachbit +} + +get_version_bleachbit() { native_or_flatpak_version org.bleachbit.BleachBit bleachbit; } diff --git a/lib/installers/cpu_x.sh b/lib/installers/cpu_x.sh new file mode 100644 index 0000000..0f2a98c --- /dev/null +++ b/lib/installers/cpu_x.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# CPU-X installer functions +# +# CPU-Z-style window showing the CPU, motherboard, memory, GPU and system. +# Distro package where the repositories have one (Debian, Ubuntu, Fedora, Arch, +# openSUSE), otherwise Flathub (Rocky/Alma/RHEL). Alpine has no package, so it +# is not offered there. + +# --- CPU-X --- + +_CPUX_FLATPAK="io.github.thetumultuousunicornofdarkness.cpu-x" + +check_cpu_x() { _check_standard cpu-x cpu-x "$_CPUX_FLATPAK"; } + +install_cpu_x() { + info "Installing CPU-X..." + native_or_flatpak_install "$_CPUX_FLATPAK" cpu-x || return 1 + info "CPU-X installed." +} + +uninstall_cpu_x() { + info "Uninstalling CPU-X..." + native_or_flatpak_uninstall "$_CPUX_FLATPAK" cpu-x +} + +update_cpu_x() { + info "Updating CPU-X..." + native_or_flatpak_update "$_CPUX_FLATPAK" cpu-x +} + +get_version_cpu_x() { native_or_flatpak_version "$_CPUX_FLATPAK" cpu-x; } diff --git a/lib/installers/cups.sh b/lib/installers/cups.sh new file mode 100644 index 0000000..9d3e270 --- /dev/null +++ b/lib/installers/cups.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# CUPS installer functions +# +# CUPS: the printing system. Installs the print server and starts it at boot; +# printers are then added at http://localhost:631 or in the desktop's printer +# settings. In every supported distro's repositories, Alpine included (its +# OpenRC service is called cupsd). + +# --- CUPS --- + +# The service is named cups on systemd and cupsd on Alpine's OpenRC. +_cups_service() { [[ "${DISTRO_FAMILY:-}" == "alpine" ]] && echo cupsd || echo cups; } + +check_cups() { _check_standard "" cups ""; } + +install_cups() { + info "Installing CUPS..." + pkg_install cups || return 1 + svc_enable_now "$(_cups_service)" || warn "Could not start the CUPS service; it will start at the next boot." + info "CUPS installed. Add a printer at http://localhost:631" +} + +uninstall_cups() { + info "Uninstalling CUPS..." + svc_disable_now "$(_cups_service)" 2>/dev/null || true + pkg_remove cups +} + +update_cups() { + info "Updating CUPS..." + pkg_upgrade cups +} + +get_version_cups() { _ver_from_pkg cups || echo ""; } diff --git a/lib/installers/earlyoom.sh b/lib/installers/earlyoom.sh new file mode 100644 index 0000000..2a29b37 --- /dev/null +++ b/lib/installers/earlyoom.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# earlyoom installer functions +# +# earlyoom: ends the biggest memory hog before the machine freezes, instead of +# waiting for the kernel's slow out-of-memory killer. In the distro +# repositories everywhere (EPEL on RHEL clones); started at boot. + +# --- earlyoom --- + +check_earlyoom() { _check_standard "" earlyoom ""; } + +install_earlyoom() { + info "Installing earlyoom..." + ensure_epel + pkg_install earlyoom || return 1 + svc_enable_now earlyoom || warn "Could not start the earlyoom service; it will start at the next boot." + info "earlyoom installed." +} + +uninstall_earlyoom() { + info "Uninstalling earlyoom..." + svc_disable_now earlyoom 2>/dev/null || true + pkg_remove earlyoom +} + +update_earlyoom() { + info "Updating earlyoom..." + pkg_upgrade earlyoom +} + +get_version_earlyoom() { _ver_from_pkg earlyoom || echo ""; } diff --git a/lib/installers/ghostty.sh b/lib/installers/ghostty.sh new file mode 100644 index 0000000..636d6c0 --- /dev/null +++ b/lib/installers/ghostty.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Ghostty terminal emulator installer functions +# +# Fast GPU-accelerated terminal. Installed from the distro's own package, which +# exists on Arch, openSUSE Tumbleweed and Ubuntu 26.04 and newer. Upstream +# publishes no Linux packages of its own (the .deb and Copr builds linked from +# its site are made by third parties, unsigned), so where the repositories do +# not carry it the installer says so and changes nothing. Not offered on +# Fedora, RHEL clones or Alpine. + +# --- Ghostty --- + +check_ghostty() { _check_standard ghostty ghostty ""; } + +install_ghostty() { + info "Installing Ghostty..." + pkg_refresh + if ! pkg_in_repo ghostty; then + error "Ghostty is not in the ${DISTRO_NAME:-system} repositories, and upstream publishes no Linux packages. Nothing was changed. See https://ghostty.org/docs/install/binary" + return 1 + fi + pkg_install ghostty || return 1 + info "Ghostty installed." +} + +uninstall_ghostty() { + info "Uninstalling Ghostty..." + pkg_remove ghostty +} + +update_ghostty() { + info "Updating Ghostty..." + pkg_upgrade ghostty +} + +get_version_ghostty() { _ver_from_pkg ghostty || _ver_from_cmd ghostty || echo ""; } diff --git a/lib/installers/hardinfo.sh b/lib/installers/hardinfo.sh new file mode 100644 index 0000000..8dc7bce --- /dev/null +++ b/lib/installers/hardinfo.sh @@ -0,0 +1,64 @@ +#!/bin/bash +# HardInfo installer functions +# +# System profiler and benchmark window (CPU, memory, storage, sensors, network). +# The maintained fork is HardInfo2 (package hardinfo2); Ubuntu 22.04 only has +# the old hardinfo, which is used there. Debian, Ubuntu, Fedora, Arch and +# openSUSE use their repositories, Rocky/Alma use EPEL. Alpine has no package, +# so it is not offered there. + +# --- HardInfo --- + +# The package this system's repositories carry: hardinfo2 first, hardinfo next. +# Prints nothing when neither is available. +_hardinfo_package() { + local p + for p in hardinfo2 hardinfo; do + pkg_in_repo "$p" && { printf '%s\n' "$p"; return 0; } + done + return 1 +} + +# The package that is installed right now, or nothing. +_hardinfo_installed_package() { + local p + for p in hardinfo2 hardinfo; do + pkg_check_installed "$p" && { printf '%s\n' "$p"; return 0; } + done + return 1 +} + +check_hardinfo() { _hardinfo_installed_package >/dev/null; } + +install_hardinfo() { + info "Installing HardInfo..." + pkg_refresh + ensure_epel + local pkg + pkg=$(_hardinfo_package) || { + error "Neither hardinfo2 nor hardinfo is in the ${DISTRO_NAME:-system} repositories." + return 1 + } + pkg_install "$pkg" || return 1 + info "HardInfo installed (package ${pkg})." +} + +uninstall_hardinfo() { + info "Uninstalling HardInfo..." + local pkg + pkg=$(_hardinfo_installed_package) || return 0 + pkg_remove "$pkg" +} + +update_hardinfo() { + info "Updating HardInfo..." + local pkg + pkg=$(_hardinfo_installed_package) || return 1 + pkg_upgrade "$pkg" +} + +get_version_hardinfo() { + local pkg + pkg=$(_hardinfo_installed_package) || { echo ""; return 0; } + _ver_from_pkg "$pkg" || echo "" +} diff --git a/lib/installers/htop.sh b/lib/installers/htop.sh new file mode 100644 index 0000000..7409349 --- /dev/null +++ b/lib/installers/htop.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# htop installer functions +# +# htop: interactive process viewer with colours, tree view and mouse support. +# Every supported distro packages it, Alpine too (EPEL on RHEL clones). + +# --- htop --- + +check_htop() { _check_standard htop htop ""; } + +install_htop() { + info "Installing htop..." + ensure_epel + pkg_install htop || return 1 + info "htop installed." +} + +uninstall_htop() { + info "Uninstalling htop..." + pkg_remove htop +} + +update_htop() { + info "Updating htop..." + pkg_upgrade htop +} + +get_version_htop() { _ver_from_pkg htop || _ver_from_cmd htop || echo ""; } diff --git a/lib/installers/inxi.sh b/lib/installers/inxi.sh new file mode 100644 index 0000000..04eac96 --- /dev/null +++ b/lib/installers/inxi.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# inxi installer functions +# +# inxi: prints a readable summary of the hardware and system (CPU, GPU, disks, +# network, sensors). In the distro repositories everywhere (EPEL on RHEL +# clones); EPEL 10 does not carry it, so it is not offered on Rocky/Alma 10. + +# --- inxi --- + +check_inxi() { _check_standard inxi inxi ""; } + +install_inxi() { + info "Installing inxi..." + ensure_epel + pkg_install inxi || return 1 + info "inxi installed. Try: inxi -Fxz" +} + +uninstall_inxi() { + info "Uninstalling inxi..." + pkg_remove inxi +} + +update_inxi() { + info "Updating inxi..." + pkg_upgrade inxi +} + +get_version_inxi() { _ver_from_pkg inxi || _ver_from_cmd inxi || echo ""; } diff --git a/lib/installers/kitty.sh b/lib/installers/kitty.sh new file mode 100644 index 0000000..ad91756 --- /dev/null +++ b/lib/installers/kitty.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# kitty terminal emulator installer functions +# +# GPU-accelerated terminal. In the distro repositories everywhere, Alpine +# included (EPEL on RHEL clones). + +# --- kitty --- + +check_kitty() { _check_standard kitty kitty ""; } + +install_kitty() { + info "Installing kitty..." + ensure_epel + pkg_install kitty || return 1 + info "kitty installed." +} + +uninstall_kitty() { + info "Uninstalling kitty..." + pkg_remove kitty +} + +update_kitty() { + info "Updating kitty..." + pkg_upgrade kitty +} + +get_version_kitty() { _ver_from_pkg kitty || _ver_from_cmd kitty || echo ""; } diff --git a/lib/installers/ncdu.sh b/lib/installers/ncdu.sh new file mode 100644 index 0000000..27d90a5 --- /dev/null +++ b/lib/installers/ncdu.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# ncdu installer functions +# +# ncdu: terminal disk-usage browser; shows which folders use the space. +# In the distro repositories everywhere (EPEL on RHEL clones), Alpine included. + +# --- ncdu --- + +check_ncdu() { _check_standard ncdu ncdu ""; } + +install_ncdu() { + info "Installing ncdu..." + ensure_epel + pkg_install ncdu || return 1 + info "ncdu installed." +} + +uninstall_ncdu() { + info "Uninstalling ncdu..." + pkg_remove ncdu +} + +update_ncdu() { + info "Updating ncdu..." + pkg_upgrade ncdu +} + +# ncdu prints "ncdu 2.7" (two parts), so the package version is read first. +get_version_ncdu() { _ver_from_pkg ncdu || echo ""; } diff --git a/lib/installers/nvtop.sh b/lib/installers/nvtop.sh new file mode 100644 index 0000000..5b4d68c --- /dev/null +++ b/lib/installers/nvtop.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# nvtop installer functions +# +# nvtop: htop-style monitor for GPUs (NVIDIA, AMD, Intel). In the distro +# repositories everywhere except Alpine; on RHEL clones it comes from EPEL. +# The NVIDIA Drivers installer also installs this package. + +# --- nvtop --- + +check_nvtop() { _check_standard nvtop nvtop ""; } + +install_nvtop() { + info "Installing nvtop..." + ensure_epel + pkg_install nvtop || return 1 + info "nvtop installed." +} + +uninstall_nvtop() { + info "Uninstalling nvtop..." + pkg_remove nvtop +} + +update_nvtop() { + info "Updating nvtop..." + pkg_upgrade nvtop +} + +get_version_nvtop() { _ver_from_pkg nvtop || _ver_from_cmd nvtop || echo ""; } diff --git a/lib/installers/smartmontools.sh b/lib/installers/smartmontools.sh new file mode 100644 index 0000000..cf51252 --- /dev/null +++ b/lib/installers/smartmontools.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# smartmontools installer functions +# +# smartctl reads a drive's SMART health data; smartd watches it in the +# background. The package is in every supported distro's own repositories. +# Services are left as the package sets them: Debian starts smartd by itself, +# the others leave it off until you configure it. + +# --- smartmontools --- + +check_smartmontools() { _check_standard "" smartmontools ""; } + +install_smartmontools() { + info "Installing smartmontools..." + pkg_install smartmontools || return 1 + info "smartmontools installed. Check a drive with: sudo smartctl -a /dev/sda" +} + +uninstall_smartmontools() { + info "Uninstalling smartmontools..." + pkg_remove smartmontools +} + +update_smartmontools() { + info "Updating smartmontools..." + pkg_upgrade smartmontools +} + +get_version_smartmontools() { _ver_from_pkg smartmontools || echo ""; } diff --git a/lib/installers/tlp.sh b/lib/installers/tlp.sh new file mode 100644 index 0000000..566a80e --- /dev/null +++ b/lib/installers/tlp.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# TLP installer functions +# +# TLP: laptop battery and power tuning that works with its defaults and starts +# at boot. In the distro repositories everywhere; on RHEL clones from EPEL +# (EPEL 10 does not carry it, so it is not offered on Rocky/Alma 10). +# TLP replaces power-profiles-daemon and must not run beside auto-cpufreq. + +# --- TLP --- + +check_tlp() { _check_standard "" tlp ""; } + +install_tlp() { + info "Installing TLP..." + if _have_cmd auto-cpufreq || [[ -e /opt/auto-cpufreq/current ]]; then + error "auto-cpufreq is installed, and the two fight over the same CPU settings. Uninstall auto-cpufreq first." + return 1 + fi + if pkg_check_installed power-profiles-daemon; then + warn "TLP replaces power-profiles-daemon (the desktop's power-mode switch); the package manager will remove it." + fi + ensure_epel + pkg_install tlp || return 1 + svc_enable_now tlp || warn "Could not start the tlp service; it will start at the next boot." + info "TLP installed. Show its state with: sudo tlp-stat -s" +} + +uninstall_tlp() { + info "Uninstalling TLP..." + svc_disable_now tlp 2>/dev/null || true + pkg_remove tlp +} + +update_tlp() { + info "Updating TLP..." + pkg_upgrade tlp +} + +get_version_tlp() { _ver_from_pkg tlp || echo ""; } diff --git a/lib/installers/wezterm.sh b/lib/installers/wezterm.sh new file mode 100644 index 0000000..8bd2935 --- /dev/null +++ b/lib/installers/wezterm.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# WezTerm terminal emulator installer functions +# +# GPU-accelerated terminal configured in Lua. Installed from the distro's own +# package, which exists on Arch, openSUSE and Alpine. Upstream's stable build +# is from February 2024 and its other channels are nightly builds, and +# Flathub's copy is that old build in a sandbox with a read-only home, so +# Debian, Ubuntu, Fedora and RHEL clones do not offer it. + +# --- WezTerm --- + +check_wezterm() { _check_standard wezterm wezterm ""; } + +install_wezterm() { + info "Installing WezTerm..." + pkg_refresh + if ! pkg_in_repo wezterm; then + error "WezTerm is not in the ${DISTRO_NAME:-system} repositories. Nothing was changed." + return 1 + fi + pkg_install wezterm || return 1 + info "WezTerm installed." +} + +uninstall_wezterm() { + info "Uninstalling WezTerm..." + pkg_remove wezterm +} + +update_wezterm() { + info "Updating WezTerm..." + pkg_upgrade wezterm +} + +get_version_wezterm() { _ver_from_pkg wezterm || echo ""; } diff --git a/lib/installers/zram.sh b/lib/installers/zram.sh new file mode 100644 index 0000000..161ea1a --- /dev/null +++ b/lib/installers/zram.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# zram installer functions +# +# Compressed swap in RAM: the machine can hold more before it slows down, with +# no swap partition. Debian and Ubuntu use zram-tools (service zramswap, half +# of RAM, set in /etc/default/zramswap). Fedora, RHEL clones, Arch and openSUSE +# use zram-generator; when no zram-generator config exists anywhere (Fedora +# ships one) this writes /etc/systemd/zram-generator.conf with half of RAM, at +# most 4 GiB, compressed with zstd. Needs systemd, so it is not offered on +# Alpine. + +# --- zram --- + +_ZRAM_CONF="/etc/systemd/zram-generator.conf" +_ZRAM_MARK="# Written by linux_util" + +_zram_pkg() { [[ "$DISTRO_FAMILY" == "debian" ]] && echo zram-tools || echo zram-generator; } + +# Whether any zram-generator configuration exists, ours or the distro's. +_zram_has_config() { + local f + for f in /etc/systemd/zram-generator.conf /usr/lib/systemd/zram-generator.conf \ + /etc/systemd/zram-generator.conf.d/*.conf /usr/lib/systemd/zram-generator.conf.d/*.conf; do + [[ -f "$f" ]] && return 0 + done + return 1 +} + +check_zram() { pkg_check_installed "$(_zram_pkg)"; } + +install_zram() { + info "Installing zram..." + local pkg + pkg=$(_zram_pkg) + pkg_install "$pkg" || return 1 + if [[ "$DISTRO_FAMILY" == "debian" ]]; then + svc_enable_now zramswap || warn "Could not start zramswap; it will start at the next boot." + else + if ! _zram_has_config; then + info "Writing ${_ZRAM_CONF} (half of RAM, at most 4 GiB, zstd)." + printf '%s\n[zram0]\nzram-size = min(ram / 2, 4096)\ncompression-algorithm = zstd\n' "$_ZRAM_MARK" \ + | sudo tee "$_ZRAM_CONF" >/dev/null || return 1 + fi + # The generator makes its units on a daemon reload. + sudo systemctl daemon-reload + sudo systemctl start systemd-zram-setup@zram0.service \ + || warn "Could not start zram0 now; it will start at the next boot." + fi + info "zram installed. Show it with: zramctl" +} + +uninstall_zram() { + info "Uninstalling zram..." + if [[ "$DISTRO_FAMILY" == "debian" ]]; then + svc_disable_now zramswap 2>/dev/null || true + else + sudo systemctl stop systemd-zram-setup@zram0.service 2>/dev/null || true + # Only a file this installer wrote is removed. + [[ -f "$_ZRAM_CONF" ]] && grep -qxF "$_ZRAM_MARK" "$_ZRAM_CONF" && sudo rm -f "$_ZRAM_CONF" + fi + pkg_remove "$(_zram_pkg)" +} + +update_zram() { + info "Updating zram..." + pkg_upgrade "$(_zram_pkg)" +} + +get_version_zram() { _ver_from_pkg "$(_zram_pkg)" || echo ""; } diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index b57f4bc..47f7480 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -5610,6 +5610,230 @@ test_veracrypt_asset_url_exact test_veracrypt_signature_check test_onepassword_repo_setup +# ---------------------------------------------------------------------------- +echo "" +echo "=== System Tools: monitors, power, disk, hardware info, terminals, printing (#91) ===" + +_SYSTOOLS_APPS=( + "Alacritty|alacritty" "auto-cpufreq|auto_cpufreq" "BleachBit|bleachbit" "CPU-X|cpu_x" + "CUPS|cups" "earlyoom|earlyoom" "Ghostty|ghostty" "HardInfo|hardinfo" "htop|htop" + "inxi|inxi" "kitty|kitty" "ncdu|ncdu" "nvtop|nvtop" "smartmontools|smartmontools" + "TLP|tlp" "WezTerm|wezterm" "zram|zram" +) + +test_system_tools_registered() { + local entry name slug fn gaps=0 + for entry in "${_SYSTOOLS_APPS[@]}"; do + IFS='|' read -r name slug <<<"$entry" + grep -qE "^[[:space:]]*register_utility \"${name}\"[[:space:]]+install_${slug} " "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing register: $name"; } + grep -qF "UTILITY_CATEGORY[\"${name}\"]=\"System Tools\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing category: $name"; } + grep -qF "UTILITY_DESCRIPTION[\"${name}\"]=" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing description: $name"; } + for fn in install check uninstall update get_version; do + grep -q "^${fn}_${slug}()" "${SCRIPT_DIR}/lib/installers/${slug}.sh" 2>/dev/null || { gaps=1; echo " missing ${fn}_${slug}"; } + done + grep -qxF " '${name}'" "${SCRIPT_DIR}/completions/_linux_util" || { gaps=1; echo " missing zsh completion: $name"; } + grep -qxF "${name}" "${SCRIPT_DIR}/completions/linux_util.bash" || { gaps=1; echo " missing bash completion: $name"; } + done + assert_eq "0" "$gaps" "The 17 new System Tools are registered with category, description, completions and all five functions" +} + +test_system_tools_subcategories() { + local entry name sub gaps=0 + for entry in "Btop|Monitors" "htop|Monitors" "nvtop|Monitors" "GPU Task Manager|Monitors" "TMOG|Monitors" "Stacer|Monitors" \ + "TLP|Power & Memory" "auto-cpufreq|Power & Memory" "zram|Power & Memory" "earlyoom|Power & Memory" \ + "smartmontools|Disk & Cleanup" "ncdu|Disk & Cleanup" "Filelight|Disk & Cleanup" "BleachBit|Disk & Cleanup" \ + "Fastfetch|System Info" "inxi|System Info" "HardInfo|System Info" "CPU-X|System Info" \ + "bat|Shell Tools" "ripgrep|Shell Tools" "Pay Respects|Shell Tools" "Zsh + Oh My Zsh|Shell Tools" \ + "Alacritty|Terminal Emulators" "Ghostty|Terminal Emulators" "kitty|Terminal Emulators" "WezTerm|Terminal Emulators" \ + "Mainline|Kernel Managers" "linux-tkg|Kernel Managers"; do + IFS='|' read -r name sub <<<"$entry" + grep -qF "UTILITY_SUBCATEGORY[\"${name}\"]=\"${sub}\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " ${name} not in ${sub}"; } + done + grep -qF 'SUBCATEGORY_ORDER["System Tools"]="Monitors|Power & Memory|Disk & Cleanup|System Info|Shell Tools|Terminal Emulators|Kernel Managers"' "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " no folder order"; } + assert_eq "0" "$gaps" "System Tools are sorted into Monitors, Power & Memory, Disk & Cleanup, System Info, Shell Tools, Terminal Emulators and Kernel Managers" +} + +# Held back on the families that cannot install them. +test_system_tools_family_gates() { + local f="${SCRIPT_DIR}/lib/installers.sh" gaps=0 line + line=$(grep -n 'register_utility "Alacritty"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF 'DISTRO_FAMILY" != "rhel"' || { gaps=1; echo " Alacritty not held back on RHEL clones"; } + sed -n "$((line-1))p" "$f" | grep -qF 'DISTRO_ID" == "ubuntu" && "${DISTRO_VERSION_ID%%.*}" -lt 23' || { gaps=1; echo " Alacritty not held back on Ubuntu 22.04"; } + line=$(grep -n 'register_utility "auto-cpufreq"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF 'opensuse-leap' || { gaps=1; echo " auto-cpufreq not held back on openSUSE Leap"; } + sed -n "$((line-1))p" "$f" | grep -qF -- '-ge 10' || { gaps=1; echo " auto-cpufreq not held back on Rocky/Alma 8 and 9"; } + line=$(grep -n 'register_utility "Ghostty"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF 'debian" || "$DISTRO_FAMILY" == "arch" || "$DISTRO_FAMILY" == "suse"' || { gaps=1; echo " Ghostty not limited to Debian, Arch, openSUSE"; } + line=$(grep -n 'register_utility "WezTerm"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF 'arch" || "$DISTRO_FAMILY" == "suse" || "$DISTRO_FAMILY" == "alpine"' || { gaps=1; echo " WezTerm not limited to Arch, openSUSE, Alpine"; } + for n in TLP inxi; do + line=$(grep -n "register_utility \"$n\"" "$f" | cut -d: -f1) + sed -n "$((line-2)),$((line-1))p" "$f" | grep -qF -- '-lt 10' || { gaps=1; echo " $n not held back on Rocky/Alma 10"; } + done + assert_eq "0" "$gaps" "Alacritty, auto-cpufreq, Ghostty, WezTerm, TLP and inxi are registered only where they can install" +} + +test_system_tools_auto_cpufreq_aur_and_upstream() { + local f="${SCRIPT_DIR}/lib/installers.sh" gaps=0 + grep -qF '"auto-cpufreq=auto-cpufreq"' "$f" || { gaps=1; echo " not marked AUR-only on Arch"; } + grep -qF '"auto-cpufreq=$_ACF_ROOT/current"' "$f" || { gaps=1; echo " not marked as an upstream install"; } + grep -qF '"auto-cpufreq=_acf_latest_version"' "$f" || { gaps=1; echo " no latest-version lookup"; } + assert_eq "0" "$gaps" "auto-cpufreq is AUR-only on Arch and refreshed by System Updates when installed from upstream" +} + +# Alpine offers what apk carries, with the right OpenRC services, and hides the rest. +test_system_tools_alpine_rows() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + have=""; for row in "${_ALPINE_TABLE[@]}"; do have+=" ${row%%|*}"; done + for n in htop smartmontools TLP earlyoom ncdu inxi Alacritty kitty WezTerm CUPS; do + [[ " $have " == *" $n "* ]] || printf 'missing:%s ' "$n" + done + for n in nvtop auto-cpufreq zram BleachBit HardInfo CPU-X Ghostty; do + [[ " $have " == *" $n "* ]] && printf 'unexpected:%s ' "$n" + done + printf 'tlp=%s cups=%s oom=%s ' "$(_alpine_field TLP 4)" "$(_alpine_field CUPS 4)" "$(_alpine_field earlyoom 4)" + echo done + ) + assert_eq "tlp=tlp cups=cupsd oom=earlyoom done" "$out" "Alpine offers its ten System Tools with their services and hides the rest" +} + +# EPEL and CRB are enabled on RHEL clones only. +test_ensure_epel() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + _log=$(mktemp) + rpm() { return 1; }; pkg_install() { echo "pkg_install $*" >> "$_log"; }; enable_crb() { echo crb >> "$_log"; } + DISTRO_FAMILY=debian; ensure_epel; DISTRO_FAMILY=fedora; ensure_epel + echo "--" >> "$_log" + DISTRO_FAMILY=rhel; ensure_epel + tr '\n' ' ' < "$_log"; rm -f "$_log" + ) + assert_eq "-- pkg_install epel-release crb " "$out" "ensure_epel does nothing off RHEL clones and enables EPEL and CRB on them" +} + +# zram: the right package per family, and a config is written only when none exists. +_zram_run() { # $1 family, $2 has-config (y/n) + ( + source "${SCRIPT_DIR}/lib/installers/zram.sh" + DISTRO_FAMILY="$1"; _hc="$2"; _log=$(mktemp); _cap=$(mktemp) + info() { :; }; warn() { :; } + pkg_install() { echo "pkg_install $*" >> "$_log"; } + svc_enable_now() { echo "svc $*" >> "$_log"; } + _zram_has_config() { [[ "$_hc" == y ]]; } + sudo() { if [[ "$1" == tee ]]; then cat > "$_cap"; else echo "sudo $*" >> "$_log"; fi; } + install_zram + tr '\n' '|' < "$_log"; echo; cat "$_cap"; rm -f "$_log" "$_cap" + ) +} +test_zram_per_family() { + local out + out=$(_zram_run debian n) + assert_true "zram: Debian and Ubuntu use zram-tools and start zramswap" \ + grep -qF "pkg_install zram-tools|svc zramswap|" <<<"$out" + assert_false "zram: Debian does not write a zram-generator config" grep -q 'zram-size' <<<"$out" + out=$(_zram_run arch n) + assert_true "zram: Arch uses zram-generator" grep -qF "pkg_install zram-generator|" <<<"$out" + assert_true "zram: with no config the installer writes half of RAM, at most 4 GiB" \ + grep -qF "zram-size = min(ram / 2, 4096)" <<<"$out" + assert_true "zram: the config it writes is marked so uninstall removes only that file" \ + grep -qxF "# Written by linux_util" <<<"$out" + assert_true "zram: the device is started after the config is written" \ + grep -qF "sudo systemctl start systemd-zram-setup@zram0.service" <<<"$out" + out=$(_zram_run fedora y) + assert_true "zram: Fedora installs zram-generator" grep -qF "pkg_install zram-generator|" <<<"$out" + assert_false "zram: an existing config is left alone" grep -q 'zram-size' <<<"$out" +} + +# HardInfo prefers the maintained HardInfo2 and falls back to the old package. +test_hardinfo_package_choice() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/hardinfo.sh" + pkg_in_repo() { [[ " $_have " == *" $1 "* ]]; } + _have="hardinfo2 hardinfo"; printf '%s,' "$(_hardinfo_package)" + _have="hardinfo"; printf '%s,' "$(_hardinfo_package)" + _have=""; _hardinfo_package || printf 'none' + ) + assert_eq "hardinfo2,hardinfo,none" "$out" "HardInfo: hardinfo2 first, hardinfo when that is all there is, nothing otherwise" +} + +# Ghostty and WezTerm change nothing when the repository has no package. +test_terminal_installers_refuse_without_package() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/ghostty.sh" + source "${SCRIPT_DIR}/lib/installers/wezterm.sh" + info() { :; }; error() { :; }; pkg_refresh() { :; }; pkg_in_repo() { return 1; } + pkg_install() { printf 'INSTALLED '; } + install_ghostty; printf 'g=%s ' "$?" + install_wezterm; printf 'w=%s' "$?" + ) + assert_eq "g=1 w=1" "$out" "Ghostty and WezTerm stop without installing when the repository lacks them" +} + +# TLP and auto-cpufreq must not be installed together. +test_tlp_and_auto_cpufreq_exclude_each_other() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/tlp.sh" + source "${SCRIPT_DIR}/lib/installers/auto_cpufreq.sh" + info() { :; }; error() { :; }; warn() { :; } + pkg_install() { printf 'INSTALLED '; } + _have_cmd() { [[ "$1" == auto-cpufreq ]]; } + install_tlp; printf 't=%s ' "$?" + pkg_check_installed() { [[ "$1" == tlp ]]; } + _acf_latest_version() { printf 'DOWNLOADED '; } + install_auto_cpufreq; printf 'a=%s' "$?" + ) + assert_eq "t=1 a=1" "$out" "TLP refuses beside auto-cpufreq and auto-cpufreq refuses beside TLP, before changing anything" +} + +# auto-cpufreq: the latest version is read from the release JSON, and an update that finds the same version does nothing. +test_auto_cpufreq_version_and_update() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/auto_cpufreq.sh" + curl() { printf '{"url":"x","tag_name": "v3.2.0","name":"v3.2.0"}'; } + printf '%s,' "$(_acf_latest_version)" + info() { :; }; error() { :; } + _ACF_ROOT=$(mktemp -d); mkdir -p "$_ACF_ROOT"; touch "$_ACF_ROOT/current" + get_version_auto_cpufreq() { echo 3.2.0; } + _acf_deploy() { printf 'REINSTALLED'; } + update_auto_cpufreq; printf 'rc=%s,' "$?" + get_version_auto_cpufreq() { echo 3.1.0; } + update_auto_cpufreq; printf 'rc=%s' "$?" + rm -rf "$_ACF_ROOT" + ) + assert_eq "3.2.0,rc=0,REINSTALLEDrc=0" "$out" "auto-cpufreq: reads the release version, skips an update at the same version and reinstalls an older one" +} + +# CUPS service name: cups on systemd, cupsd on Alpine's OpenRC. +test_cups_service_name() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/cups.sh" + DISTRO_FAMILY=debian; printf '%s,' "$(_cups_service)" + DISTRO_FAMILY=alpine; printf '%s' "$(_cups_service)" + ) + assert_eq "cups,cupsd" "$out" "CUPS: the service is cups everywhere and cupsd on Alpine" +} + +test_system_tools_registered +test_system_tools_subcategories +test_system_tools_family_gates +test_system_tools_auto_cpufreq_aur_and_upstream +test_system_tools_alpine_rows +test_ensure_epel +test_zram_per_family +test_hardinfo_package_choice +test_terminal_installers_refuse_without_package +test_tlp_and_auto_cpufreq_exclude_each_other +test_auto_cpufreq_version_and_update +test_cups_service_name + echo "" echo "════════════════════════════════════════════════════════════════" echo "Test Results: ${_TESTS_PASSED} passed, ${_TESTS_FAILED} failed, ${_TESTS_SKIPPED} skipped" From c4d29a0940798faa7fef388c39aac2a3cf33b946 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 12:12:31 -0500 Subject: [PATCH 09/14] feat: add 23 Development apps and shell tools, group into folders Add Vim, Emacs, Helix, Sublime Text, Zed, lazygit, Podman Desktop, Helm, minikube, k3s, Python, Java JDK, PHP, Ruby, VirtualBox, Wireshark, nmap and Ollama to Development, and fzf, eza, zoxide, starship and tldr to System Tools > Shell Tools. Each uses the distro package where one exists. Otherwise it falls back to a SHA-256 verified upstream GitHub release, a vendor-signed repo, Flathub, or k3s's own installer. Shared helpers for verified GitHub downloads, shell profile blocks and fingerprint-checked RPM keys live in _shared.sh; gpg_key_has_fingerprint is factored out of _add_apt_repo, and Pay Respects now reuses shell_rc_block_remove. Development is now sorted into IDEs & Editors, AI Tools, Languages & Runtimes, Git, Containers & Kubernetes, Virtualization, Network & Security and Distrobox folders. Claude Code, Claude Desktop, Codex, Hermes Agent and LM Studio move to AI Tools. Sublime Text is hidden on Rocky/Alma 9 and 10, nmap on openSUSE Leap, and several apps on Alpine, where no package exists. Update completions, docs, changelog and tests. Part of #91 --- CHANGELOG.md | 19 ++ README.md | 4 +- completions/_linux_util | 23 ++ completions/linux_util.bash | 23 ++ docs/utilities.md | 109 ++++++++-- lib/installers.sh | 147 ++++++++++++- lib/installers/_shared.sh | 242 +++++++++++++++++++++ lib/installers/alpine_packages.sh | 17 ++ lib/installers/emacs.sh | 27 +++ lib/installers/eza.sh | 32 +++ lib/installers/fzf.sh | 36 ++++ lib/installers/helix.sh | 80 +++++++ lib/installers/helm.sh | 71 +++++++ lib/installers/java_jdk.sh | 68 ++++++ lib/installers/k3s.sh | 66 ++++++ lib/installers/lazygit.sh | 32 +++ lib/installers/minikube.sh | 32 +++ lib/installers/nmap.sh | 27 +++ lib/installers/ollama.sh | 95 +++++++++ lib/installers/pay_respects.sh | 10 +- lib/installers/php.sh | 39 ++++ lib/installers/podman_desktop.sh | 28 +++ lib/installers/python.sh | 51 +++++ lib/installers/ruby.sh | 46 ++++ lib/installers/starship.sh | 37 ++++ lib/installers/sublime_text.sh | 105 ++++++++++ lib/installers/tldr.sh | 62 ++++++ lib/installers/vim.sh | 35 ++++ lib/installers/virtualbox.sh | 153 ++++++++++++++ lib/installers/wireshark.sh | 56 +++++ lib/installers/zed.sh | 28 +++ lib/installers/zoxide.sh | 37 ++++ lib/pkg_manager.sh | 28 +-- tests/test_linux_util.sh | 335 +++++++++++++++++++++++++++++- 34 files changed, 2144 insertions(+), 56 deletions(-) create mode 100644 lib/installers/emacs.sh create mode 100644 lib/installers/eza.sh create mode 100644 lib/installers/fzf.sh create mode 100644 lib/installers/helix.sh create mode 100644 lib/installers/helm.sh create mode 100644 lib/installers/java_jdk.sh create mode 100644 lib/installers/k3s.sh create mode 100644 lib/installers/lazygit.sh create mode 100644 lib/installers/minikube.sh create mode 100644 lib/installers/nmap.sh create mode 100644 lib/installers/ollama.sh create mode 100644 lib/installers/php.sh create mode 100644 lib/installers/podman_desktop.sh create mode 100644 lib/installers/python.sh create mode 100644 lib/installers/ruby.sh create mode 100644 lib/installers/starship.sh create mode 100644 lib/installers/sublime_text.sh create mode 100644 lib/installers/tldr.sh create mode 100644 lib/installers/vim.sh create mode 100644 lib/installers/virtualbox.sh create mode 100644 lib/installers/wireshark.sh create mode 100644 lib/installers/zed.sh create mode 100644 lib/installers/zoxide.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ecb862..45a69aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,25 @@ when a release is cut. ### Added +- **23 more Development apps and shell tools** (part of #91). Editors: Vim, + Emacs, Helix, Sublime Text and Zed. Shell tools: fzf, eza, zoxide, starship + and tldr (in System Tools > Shell Tools, beside bat and ripgrep); zoxide, + starship and fzf are loaded from `~/.bashrc` (and `~/.zshrc` when it exists). + Git: lazygit. Containers and Kubernetes: Podman Desktop, Helm, minikube and + k3s. Languages: Python, Java JDK, PHP and Ruby. Also VirtualBox, Wireshark, + nmap and Ollama. Each uses the distro's own package; where a release has + none, lazygit, eza, zoxide, starship, minikube, Helix, Helm and Ollama use + the upstream release, checked against its published SHA-256; Sublime Text + and (on Debian, Fedora and RHEL clones) VirtualBox use their vendor's signed + repository; Zed and Podman Desktop use Flathub; k3s uses its own install + script. Development is now sorted into folders: **IDEs & Editors**, **AI + Tools** (Claude Code, Claude Desktop, Codex, Hermes Agent and LM Studio + moved here, with Ollama), **Languages & Runtimes**, **Git**, **Containers & + Kubernetes**, **Virtualization**, **Network & Security** and Distrobox. + Uninstalling k3s deletes its cluster data; VirtualBox needs its kernel + module signed under Secure Boot. Not offered: Sublime Text on Rocky/Alma 9 + and 10 (their RPM refuses its signing key), nmap on openSUSE Leap, and on + Alpine Sublime Text, Zed, tldr, Podman Desktop, minikube and VirtualBox. - **17 more System Tools** (part of #91). Monitors: htop and nvtop. Disk health: smartmontools. Power and memory: TLP, auto-cpufreq, zram and earlyoom. Cleanup: BleachBit and ncdu. Hardware info: HardInfo, inxi and diff --git a/README.md b/README.md index 93d7989..14e6890 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ selection rules and the profile table: [docs/menu.md](docs/menu.md). | **Desktop Environments** | KDE Plasma, GNOME, Xfce, Cinnamon, MATE, LXQt, Budgie, COSMIC, Deepin, Pantheon | | **Backup** | Timeshift and Snapper (create/restore/delete), Déjà Dup, Kup, Vorta, Duplicati | | **Disk Utilities** | GParted, Ventoy, KDiskMark, and a Btrfs toolset (Assistant, btrfsmaintenance, btrbk, duperemove) | -| **Development** | Docker, Podman, Distrobox, Toolbx, VS Code, VSCodium, Cursor, Claude Code, Claude Desktop, Codex, Hermes Agent, LM Studio, Node/NVM, Go, Rust, pyenv, Terraform, OpenTofu, Ansible, kubectl, k9s, DBeaver, Virt-Manager, Firecracker | +| **Development** | Folders for IDEs & Editors (VS Code, VSCodium, Cursor, JetBrains Toolbox, Neovim, Vim, Emacs, Helix, Sublime Text, Zed), AI Tools (Claude Code, Claude Desktop, Codex, Hermes Agent, LM Studio, Ollama), Languages & Runtimes (Python, Java JDK, PHP, Ruby, Go, Node/NVM, Rust, pyenv), Git (GitHub CLI, lazygit), Containers & Kubernetes (Docker, Podman, Podman Desktop, kubectl, k9s, Helm, minikube, k3s), Virtualization (VirtualBox, Virt-Manager, Firecracker), Network & Security (Wireshark, nmap) and Distrobox, plus Terraform, OpenTofu, Ansible, DBeaver, Postman, PowerShell and Toolbx | | **Gaming** | Steam, Lutris, Heroic, Bottles, Xodus Nexus, Wine, ProtonUp-Qt, MangoHud, Gamemode, Boxflat | | **Internet** | Browsers (Firefox, Brave, Chrome, Chromium, Vivaldi, LibreWolf, Zen, Thorium, Tor), email clients, messaging, and VPNs (ProtonVPN, PIA, Tailscale, WireGuard) | | **Package Managers** | Flatpak, Homebrew, Nix, Snap, deb-get, Pacstall, yay, paru — added alongside the native manager, never replacing it | @@ -137,7 +137,7 @@ selection rules and the profile table: [docs/menu.md](docs/menu.md). | **Firewalls** | UFW and firewalld, each with its GUI front end (Gufw, firewall-config) | | **Login Screens** | SDDM, GDM, LightDM, ly, LXDM, plus SDDM themes and the LightDM Slick Greeter | | **Window Managers** | Hyprland, Sway, i3, bspwm, awesome, dwm, Openbox | -| **System Tools** | Folders for Monitors (Btop, htop, nvtop, GPU Task Manager, TMOG, Stacer), Power & Memory (TLP, auto-cpufreq, zram, earlyoom), Disk & Cleanup (smartmontools, ncdu, Filelight, BleachBit), System Info (Fastfetch, inxi, HardInfo, CPU-X), Shell Tools (bat, ripgrep, Pay Respects, Zsh + Oh My Zsh), Terminal Emulators (Alacritty, kitty, Ghostty, WezTerm) and Kernel Managers, plus ClamAV, CUPS, Input Leap and OCCT | +| **System Tools** | Folders for Monitors (Btop, htop, nvtop, GPU Task Manager, TMOG, Stacer), Power & Memory (TLP, auto-cpufreq, zram, earlyoom), Disk & Cleanup (smartmontools, ncdu, Filelight, BleachBit), System Info (Fastfetch, inxi, HardInfo, CPU-X), Shell Tools (bat, ripgrep, fzf, eza, zoxide, starship, tldr, Pay Respects, Zsh + Oh My Zsh), Terminal Emulators (Alacritty, kitty, Ghostty, WezTerm) and Kernel Managers, plus ClamAV, CUPS, Input Leap and OCCT | Every entry, with its per-utility description and any distro limits, is in [docs/utilities.md](docs/utilities.md). For what is installed on *this* machine, diff --git a/completions/_linux_util b/completions/_linux_util index 49d7212..545690d 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -45,8 +45,10 @@ _linux_util_utilities=( 'Discord' 'Docker' 'earlyoom' + 'Emacs' 'Enable RDP' 'Evolution' + 'eza' 'Fastfetch' 'Fedora Mainline Kernel' 'Feral Gamemode' @@ -55,6 +57,7 @@ _linux_util_utilities=( 'Firefox' 'Flatpak Setup' 'Full System Upgrade/Update' + 'fzf' 'Geary' 'Ghostty' 'GIMP' @@ -64,20 +67,25 @@ _linux_util_utilities=( 'GPU Task Manager' 'GTK Window Fix' 'HardInfo' + 'Helix' + 'Helm' 'Hermes Agent' 'Heroic Games Launcher' 'htop' 'Intel Drivers' 'inxi' + 'Java JDK' 'JetBrains Toolbox' 'Joplin Client' 'Joplin Web Clipper' + 'k3s' 'KDE Desktop' 'KDiskMark' 'KeePassXC' 'kitty' 'KMail' 'Kodi' + 'lazygit' 'LibreOffice' 'linux-tkg' 'Local Time Zone / Locale' @@ -88,11 +96,13 @@ _linux_util_utilities=( 'Mainline' 'MangoHud' 'MATE Desktop' + 'minikube' 'mpv' 'Multimedia Codecs' 'ncdu' 'NeoMutt' 'Nextcloud Desktop' + 'nmap' 'Num Lock at Boot' 'NVIDIA Drivers' 'NVIDIA PAIR' @@ -101,14 +111,22 @@ _linux_util_utilities=( 'OBS Studio' 'Obsidian' 'Okular' + 'Ollama' 'OnlyOffice' 'OpenLogi' 'OpenSSH Server' + 'PHP' + 'Podman Desktop' + 'Python' 'RawTherapee' + 'Ruby' 'Scribus' 'Shotcut' 'smartmontools' 'Spotify' + 'starship' + 'Sublime Text' + 'tldr' 'TLP' 'tmux' 'tmux Resurrect' @@ -143,6 +161,8 @@ _linux_util_utilities=( 'Trojita' 'UFW Firewall' 'VeraCrypt' + 'Vim' + 'VirtualBox' 'Visual Studio Code' 'VSCodium' 'Vivaldi Browser' @@ -151,11 +171,14 @@ _linux_util_utilities=( 'Wine' 'WireGuard Client' 'WireGuard Server' + 'Wireshark' 'WPS Office' 'XEN Guest Utilities' 'Xfce Desktop' 'Xodus Nexus' 'Xournal++' + 'Zed' + 'zoxide' 'zram' 'Zsh + Oh My Zsh' ) diff --git a/completions/linux_util.bash b/completions/linux_util.bash index ba357d0..d61a9e3 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -43,9 +43,11 @@ Devolutions RDM Discord Docker earlyoom +Emacs Enable RDP Euro-Office Evolution +eza Fastfetch Fedora Mainline Kernel Feral Gamemode @@ -54,6 +56,7 @@ Firecracker Firefox Flatpak Setup Full System Upgrade/Update +fzf Geary Ghostty GIMP @@ -63,20 +66,25 @@ Google Chrome GPU Task Manager GTK Window Fix HardInfo +Helix +Helm Hermes Agent Heroic Games Launcher htop Intel Drivers inxi +Java JDK JetBrains Toolbox Joplin Client Joplin Web Clipper +k3s KDE Desktop KDiskMark KeePassXC kitty KMail Kodi +lazygit LibreOffice linux-tkg Local Time Zone / Locale @@ -87,11 +95,13 @@ LXQt Desktop Mainline MangoHud MATE Desktop +minikube mpv Multimedia Codecs ncdu NeoMutt Nextcloud Desktop +nmap NVIDIA Drivers NVIDIA PAIR NVM @@ -99,14 +109,22 @@ nvtop OBS Studio Obsidian Okular +Ollama OnlyOffice OpenLogi OpenSSH Server +PHP +Podman Desktop +Python RawTherapee +Ruby Scribus Shotcut smartmontools Spotify +starship +Sublime Text +tldr TLP tmux tmux Resurrect @@ -142,6 +160,8 @@ Trojita Num Lock at Boot UFW Firewall VeraCrypt +Vim +VirtualBox Visual Studio Code VSCodium Vivaldi Browser @@ -150,11 +170,14 @@ WinApps Wine WireGuard Client WireGuard Server +Wireshark WPS Office XEN Guest Utilities Xfce Desktop Xodus Nexus Xournal++ +Zed +zoxide zram Zsh + Oh My Zsh EOF diff --git a/docs/utilities.md b/docs/utilities.md index 24bc085..d727ece 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -128,38 +128,98 @@ appear when it applies. | Utility | Description | |---------|-------------| | **Ansible** | IT automation and configuration management tool | +| **DBeaver** | Universal database management tool | +| **OpenTofu** | Open-source Terraform-compatible infrastructure-as-code tool | +| **Postman** | API development and testing platform | +| **PowerShell** | Microsoft's cross-platform automation shell built on .NET — Microsoft's apt repo where available, otherwise the GitHub release `.deb` | +| **Terraform** | HashiCorp infrastructure-as-code tool | +| **Toolbx** | Containerized command-line environments on Podman, integrated with the host (not available on openSUSE) | + +Grouped into folders inside the Development tab: + +### IDEs & Editors + +| Utility | Description | +|---------|-------------| +| **Visual Studio Code** | Microsoft's extensible code editor | +| **VSCodium** | Telemetry-free community build of VS Code (Open VSX extensions) | +| **Cursor IDE** | AI-powered code editor built on VS Code | +| **JetBrains Toolbox** | Manager for JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc.) | +| **Neovim** | Extensible Vim-based text editor | +| **Vim** | The classic modal editor (`vim-enhanced` on Fedora and RHEL clones) | +| **Emacs** | GNU Emacs, the extensible editor, with its graphical window | +| **Helix** | Modal terminal editor with language-server support built in. Distro package (Fedora, Rocky/Alma 9 and 10, Arch, openSUSE, Alpine); on Debian, Ubuntu and Rocky/Alma 8 the GitHub release, SHA-256 checked, in `/opt/helix` | +| **Sublime Text** | Fast text and code editor (paid licence, free to evaluate). Sublime HQ's own signed repository on Debian, Ubuntu, Fedora, RHEL clones and openSUSE; the AUR on Arch (only with AUR support on); not available on Alpine or Rocky/Alma 9 and 10 (their RPM refuses the key's SHA-1 signature) | +| **Zed** | Fast code editor with built-in collaboration and AI. Distro package on Arch and openSUSE Tumbleweed, Flathub elsewhere; not available on Alpine | + +### AI Tools + +| Utility | Description | +|---------|-------------| | **Claude Code** | Anthropic's AI coding assistant for the terminal | | **Claude Desktop** | Anthropic's Claude desktop app — Chat, Cowork and Claude Code (Linux beta). Native on Debian/Ubuntu; on other distros it runs in an Ubuntu 26.04 distrobox and appears in the app menu | | **Codex** | OpenAI's AI coding agent for the terminal (npm; settings in `~/.codex` are kept on uninstall) | -| **Cursor IDE** | AI-powered code editor built on VS Code | -| **DBeaver** | Universal database management tool | -| **Distrobox** | Run any Linux distro in an integrated terminal container (needs Podman/Docker) | -| **BoxBuddy** | GTK4 graphical front-end for Distrobox (Flatpak) | -| **DistroShelf** | GTK4 graphical manager for Distrobox containers (Flatpak) | -| **Kontainer** | Kirigami/QML graphical manager for Distrobox containers, built for KDE Plasma (Flatpak) | -| **Docker** | Container platform — official repos, adds user to `docker` group | -| **GitHub CLI** | Official CLI for GitHub — repos, issues, PRs, and workflows | -| **Go SDK** | Official Go programming language toolchain | | **Hermes Agent** | Nous Research's open-source AI agent for the terminal (installed per user; update and uninstall use its own commands, settings in `~/.hermes` are kept) | -| **JetBrains Toolbox** | Manager for JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc.) | -| **k9s** | Terminal UI for managing Kubernetes clusters | -| **kubectl** | Kubernetes command-line tool | | **LM Studio** | Desktop app for running large language models locally (AppImage, about 1 GB; models in `~/.lmstudio` are kept on uninstall) | -| **Neovim** | Extensible Vim-based text editor | +| **Ollama** | Runs large language models locally, as a service. Distro package (Fedora, Arch, openSUSE, Alpine); elsewhere the GitHub release, SHA-256 checked, with an `ollama` user and systemd service. CPU and NVIDIA GPUs; AMD GPUs need Ollama's ROCm add-on, which is not installed. Uninstall keeps downloaded models | + +### Languages & Runtimes + +| Utility | Description | +|---------|-------------| +| **Python** | The distro's Python 3 with pip, venv and development headers (pyenv installs other versions). Uninstall keeps `python3` itself | +| **Java JDK** | OpenJDK with the compiler: `default-jdk` on Debian/Ubuntu, otherwise the newest long-term-support build the repositories carry (25, 21 or 17) | +| **PHP** | The PHP command-line interpreter from the distro's packages (not a web-server module) | +| **Ruby** | Ruby with the headers gems need to build native extensions | +| **Go SDK** | Official Go programming language toolchain | | **Node.js** | JavaScript runtime — LTS release via NodeSource | +| **Rustup** | Rust toolchain installer and version manager | +| **pyenv** | Python version manager | | **NVM** | Node Version Manager — install and switch Node.js versions | -| **OpenTofu** | Open-source Terraform-compatible infrastructure-as-code tool | + +### Git + +| Utility | Description | +|---------|-------------| +| **GitHub CLI** | Official CLI for GitHub — repos, issues, PRs, and workflows | +| **lazygit** | Terminal UI for git. Distro package where there is one (Debian 13, Ubuntu 26.04, Fedora, Arch, openSUSE, Alpine); elsewhere the GitHub release, SHA-256 checked, in `/usr/local/bin` | + +### Containers & Kubernetes + +| Utility | Description | +|---------|-------------| +| **Docker** | Container platform — official repos, adds user to `docker` group | | **Podman** | Daemonless OCI container engine | -| **PowerShell** | Microsoft's cross-platform automation shell built on .NET — Microsoft's apt repo where available, otherwise the GitHub release `.deb` | -| **Postman** | API development and testing platform | -| **pyenv** | Python version manager | -| **Rustup** | Rust toolchain installer and version manager | -| **Terraform** | HashiCorp infrastructure-as-code tool | -| **Toolbx** | Containerized command-line environments on Podman, integrated with the host (not available on openSUSE) | +| **Podman Desktop** | Graphical manager for Podman containers, pods and Kubernetes. Distro package on Arch, Flathub elsewhere; not available on Alpine | +| **kubectl** | Kubernetes command-line tool | +| **k9s** | Terminal UI for managing Kubernetes clusters | +| **Helm** | Kubernetes package manager. Distro package (Fedora, Rocky/Alma 9 and 10, Arch, openSUSE, Alpine); elsewhere the release from `get.helm.sh`, checked against Helm's published SHA-256 | +| **minikube** | Local single-node Kubernetes cluster for development. Distro package on Arch and openSUSE Tumbleweed; elsewhere the GitHub release, SHA-256 checked. Needs a driver (Docker, Podman or KVM); not available on Alpine | +| **k3s** | Lightweight Kubernetes node, started as a service. Alpine: distro package; elsewhere k3s's own install script from `get.k3s.io`. Uninstalling deletes the cluster data in `/var/lib/rancher/k3s` | + +### Virtualization + +| Utility | Description | +|---------|-------------| +| **VirtualBox** | Runs virtual machines. Distro package on Ubuntu, Arch and openSUSE; Oracle's own signed repository on Debian 12/13, Fedora up to 44 and Rocky/Alma 8 to 10. The kernel module must be signed under Secure Boot; your VMs are kept on uninstall; not available on Alpine | | **Virt-Manager** | GUI for managing KVM/QEMU virtual machines | | **Firecracker** | Lightweight KVM microVM monitor (AWS) — Arch package on Arch, otherwise the upstream `firecracker` and `jailer` binaries in `/usr/local/bin`; needs `/dev/kvm` access | -| **Visual Studio Code** | Microsoft's extensible code editor | -| **VSCodium** | Telemetry-free community build of VS Code (Open VSX extensions) | + +### Network & Security + +| Utility | Description | +|---------|-------------| +| **Wireshark** | Network packet analyser; the installing user joins the `wireshark` group to capture without root (log out and in) | +| **nmap** | Network scanner for hosts and open ports; not in openSUSE Leap | + +### Distrobox + +| Utility | Description | +|---------|-------------| +| **Distrobox** | Run any Linux distro in an integrated terminal container (needs Podman/Docker) | +| **BoxBuddy** | GTK4 graphical front-end for Distrobox (Flatpak) | +| **DistroShelf** | GTK4 graphical manager for Distrobox containers (Flatpak) | +| **Kontainer** | Kirigami/QML graphical manager for Distrobox containers, built for KDE Plasma (Flatpak) | ## Gaming @@ -408,6 +468,11 @@ Command-line helpers and shells. | **ripgrep** | `rg`: searches a folder tree for text much faster than `grep -r`, skipping files in `.gitignore` | | **Pay Respects** | Press `F` to fix the last failed command — Rust `thefuck` replacement with inline `Ctrl+X` correction. Installed from upstream's `.deb`/`.rpm` (in no distro repo; AUR on Arch) and wired into `~/.bashrc`/`~/.zshrc`; its AI module is disabled by default | | **Zsh + Oh My Zsh** | Z shell with Oh My Zsh framework, themes, and plugins | +| **fzf** | Command-line fuzzy finder with Ctrl+R / Ctrl+T / Alt+C in the shell (loaded from `~/.bashrc`, and `~/.zshrc` when it exists) | +| **eza** | `ls` replacement with colours, icons and git status. Distro package where there is one; elsewhere the GitHub release, SHA-256 checked (x86_64 only) | +| **zoxide** | Smarter `cd`: jump to frequently used folders with `z`. Distro package (every release except Rocky/Alma 10); elsewhere the GitHub release, SHA-256 checked. Loaded from the shell profile | +| **starship** | Fast, themeable shell prompt. Distro package where there is one; elsewhere the GitHub release, SHA-256 checked. Loaded from the shell profile | +| **tldr** | Short, example-first help pages for commands (`tldr tar`). The distro's client: tealdeer, tlrc or the Python tldr (EPEL on Rocky/Alma); not available on Alpine | ### Terminal Emulators diff --git a/lib/installers.sh b/lib/installers.sh index 4624b1c..30c05b2 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -411,6 +411,36 @@ register_utility "ncdu" install_ncdu check_ncdu register_utility "nvtop" install_nvtop check_nvtop uninstall_nvtop update_nvtop get_version_nvtop register_utility "smartmontools" install_smartmontools check_smartmontools uninstall_smartmontools update_smartmontools get_version_smartmontools register_utility "zram" install_zram check_zram uninstall_zram update_zram get_version_zram +# Development and shell tools (#91). Alpine keeps only the ones in alpine_packages.sh. +register_utility "Emacs" install_emacs check_emacs uninstall_emacs update_emacs get_version_emacs +register_utility "fzf" install_fzf check_fzf uninstall_fzf update_fzf get_version_fzf +register_utility "eza" install_eza check_eza uninstall_eza update_eza get_version_eza +register_utility "Helix" install_helix check_helix uninstall_helix update_helix get_version_helix +register_utility "Helm" install_helm check_helm uninstall_helm update_helm get_version_helm +register_utility "Java JDK" install_java_jdk check_java_jdk uninstall_java_jdk update_java_jdk get_version_java_jdk +register_utility "k3s" install_k3s check_k3s uninstall_k3s update_k3s get_version_k3s +register_utility "lazygit" install_lazygit check_lazygit uninstall_lazygit update_lazygit get_version_lazygit +register_utility "minikube" install_minikube check_minikube uninstall_minikube update_minikube get_version_minikube +register_utility "Ollama" install_ollama check_ollama uninstall_ollama update_ollama get_version_ollama +register_utility "PHP" install_php check_php uninstall_php update_php get_version_php +register_utility "Podman Desktop" install_podman_desktop check_podman_desktop uninstall_podman_desktop update_podman_desktop get_version_podman_desktop +register_utility "Python" install_python check_python uninstall_python update_python get_version_python +register_utility "Ruby" install_ruby check_ruby uninstall_ruby update_ruby get_version_ruby +register_utility "starship" install_starship check_starship uninstall_starship update_starship get_version_starship +register_utility "tldr" install_tldr check_tldr uninstall_tldr update_tldr get_version_tldr +register_utility "Vim" install_vim check_vim uninstall_vim update_vim get_version_vim +register_utility "VirtualBox" install_virtualbox check_virtualbox uninstall_virtualbox update_virtualbox get_version_virtualbox +register_utility "Wireshark" install_wireshark check_wireshark uninstall_wireshark update_wireshark get_version_wireshark +register_utility "Zed" install_zed check_zed uninstall_zed update_zed get_version_zed +register_utility "zoxide" install_zoxide check_zoxide uninstall_zoxide update_zoxide get_version_zoxide +# Sublime Text: its RPM signing key carries a SHA-1 signature, which Rocky/Alma 9 and 10 refuse to import. +if [[ "$DISTRO_FAMILY" != "rhel" || "${DISTRO_VERSION_ID%%.*}" -lt 9 ]]; then + register_utility "Sublime Text" install_sublime_text check_sublime_text uninstall_sublime_text update_sublime_text get_version_sublime_text +fi +# nmap: not in openSUSE Leap's repositories. +if [[ "$DISTRO_ID" != "opensuse-leap" && "$DISTRO_ID" != "sles" ]]; then + register_utility "nmap" install_nmap check_nmap uninstall_nmap update_nmap get_version_nmap +fi # Alacritty: no package for Rocky/Alma/RHEL (no upstream binary either) or Ubuntu 22.04. if [[ "$DISTRO_FAMILY" != "rhel" ]] && ! [[ "$DISTRO_ID" == "ubuntu" && "${DISTRO_VERSION_ID%%.*}" -lt 23 ]]; then register_utility "Alacritty" install_alacritty check_alacritty uninstall_alacritty update_alacritty get_version_alacritty @@ -749,6 +779,29 @@ UTILITY_CATEGORY["firewall-config (GUI)"]="Firewalls" UTILITY_CATEGORY["HandBrake"]="Productivity" UTILITY_CATEGORY["Inkscape"]="Productivity" UTILITY_CATEGORY["Input Leap"]="System Tools" +UTILITY_CATEGORY["Emacs"]="Development" +UTILITY_CATEGORY["Helix"]="Development" +UTILITY_CATEGORY["Helm"]="Development" +UTILITY_CATEGORY["Java JDK"]="Development" +UTILITY_CATEGORY["k3s"]="Development" +UTILITY_CATEGORY["lazygit"]="Development" +UTILITY_CATEGORY["minikube"]="Development" +UTILITY_CATEGORY["nmap"]="Development" +UTILITY_CATEGORY["Ollama"]="Development" +UTILITY_CATEGORY["PHP"]="Development" +UTILITY_CATEGORY["Podman Desktop"]="Development" +UTILITY_CATEGORY["Python"]="Development" +UTILITY_CATEGORY["Ruby"]="Development" +UTILITY_CATEGORY["Sublime Text"]="Development" +UTILITY_CATEGORY["Vim"]="Development" +UTILITY_CATEGORY["VirtualBox"]="Development" +UTILITY_CATEGORY["Wireshark"]="Development" +UTILITY_CATEGORY["Zed"]="Development" +UTILITY_CATEGORY["fzf"]="System Tools" +UTILITY_CATEGORY["eza"]="System Tools" +UTILITY_CATEGORY["starship"]="System Tools" +UTILITY_CATEGORY["tldr"]="System Tools" +UTILITY_CATEGORY["zoxide"]="System Tools" UTILITY_CATEGORY["auto-cpufreq"]="System Tools" UTILITY_CATEGORY["BleachBit"]="System Tools" UTILITY_CATEGORY["CPU-X"]="System Tools" @@ -894,11 +947,11 @@ UTILITY_SUBCATEGORY["Kodi"]="Media" UTILITY_SUBCATEGORY["Spotify"]="Media" UTILITY_SUBCATEGORY["Multimedia Codecs"]="Media" UTILITY_SUBCATEGORY["Libation"]="Media" -UTILITY_SUBCATEGORY["Claude Code"]="IDEs & Editors" -UTILITY_SUBCATEGORY["Claude Desktop"]="IDEs & Editors" -UTILITY_SUBCATEGORY["Codex"]="IDEs & Editors" -UTILITY_SUBCATEGORY["Hermes Agent"]="IDEs & Editors" -UTILITY_SUBCATEGORY["LM Studio"]="IDEs & Editors" +UTILITY_SUBCATEGORY["Claude Code"]="AI Tools" +UTILITY_SUBCATEGORY["Claude Desktop"]="AI Tools" +UTILITY_SUBCATEGORY["Codex"]="AI Tools" +UTILITY_SUBCATEGORY["Hermes Agent"]="AI Tools" +UTILITY_SUBCATEGORY["LM Studio"]="AI Tools" UTILITY_SUBCATEGORY["Cursor IDE"]="IDEs & Editors" UTILITY_SUBCATEGORY["JetBrains Toolbox"]="IDEs & Editors" UTILITY_SUBCATEGORY["Visual Studio Code"]="IDEs & Editors" @@ -963,6 +1016,41 @@ UTILITY_SUBCATEGORY["Alacritty"]="Terminal Emulators" UTILITY_SUBCATEGORY["Ghostty"]="Terminal Emulators" UTILITY_SUBCATEGORY["kitty"]="Terminal Emulators" UTILITY_SUBCATEGORY["WezTerm"]="Terminal Emulators" +UTILITY_SUBCATEGORY["Vim"]="IDEs & Editors" +UTILITY_SUBCATEGORY["Emacs"]="IDEs & Editors" +UTILITY_SUBCATEGORY["Helix"]="IDEs & Editors" +UTILITY_SUBCATEGORY["Sublime Text"]="IDEs & Editors" +UTILITY_SUBCATEGORY["Zed"]="IDEs & Editors" +UTILITY_SUBCATEGORY["Ollama"]="AI Tools" +UTILITY_SUBCATEGORY["GitHub CLI"]="Git" +UTILITY_SUBCATEGORY["lazygit"]="Git" +UTILITY_SUBCATEGORY["Docker"]="Containers & Kubernetes" +UTILITY_SUBCATEGORY["Podman"]="Containers & Kubernetes" +UTILITY_SUBCATEGORY["Podman Desktop"]="Containers & Kubernetes" +UTILITY_SUBCATEGORY["kubectl"]="Containers & Kubernetes" +UTILITY_SUBCATEGORY["k9s"]="Containers & Kubernetes" +UTILITY_SUBCATEGORY["Helm"]="Containers & Kubernetes" +UTILITY_SUBCATEGORY["minikube"]="Containers & Kubernetes" +UTILITY_SUBCATEGORY["k3s"]="Containers & Kubernetes" +UTILITY_SUBCATEGORY["Python"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["Java JDK"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["PHP"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["Ruby"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["Go SDK"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["Node.js"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["Rustup"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["pyenv"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["NVM"]="Languages & Runtimes" +UTILITY_SUBCATEGORY["VirtualBox"]="Virtualization" +UTILITY_SUBCATEGORY["Virt-Manager"]="Virtualization" +UTILITY_SUBCATEGORY["Firecracker"]="Virtualization" +UTILITY_SUBCATEGORY["Wireshark"]="Network & Security" +UTILITY_SUBCATEGORY["nmap"]="Network & Security" +UTILITY_SUBCATEGORY["fzf"]="Shell Tools" +UTILITY_SUBCATEGORY["eza"]="Shell Tools" +UTILITY_SUBCATEGORY["zoxide"]="Shell Tools" +UTILITY_SUBCATEGORY["starship"]="Shell Tools" +UTILITY_SUBCATEGORY["tldr"]="Shell Tools" UTILITY_SUBCATEGORY["Btop"]="Monitors" UTILITY_SUBCATEGORY["htop"]="Monitors" UTILITY_SUBCATEGORY["nvtop"]="Monitors" @@ -1027,7 +1115,7 @@ UTILITY_SUBCATEGORY["Mount SMB Share"]="Mount / Unmount Shares" UTILITY_SUBCATEGORY["Manage Share"]="Mount / Unmount Shares" # Explicit subcategory display order within each category tab -SUBCATEGORY_ORDER["Development"]="IDEs & Editors|Distrobox" +SUBCATEGORY_ORDER["Development"]="IDEs & Editors|AI Tools|Languages & Runtimes|Git|Containers & Kubernetes|Virtualization|Network & Security|Distrobox" SUBCATEGORY_ORDER["Drivers"]="CPU Microcode|GPU Drivers" SUBCATEGORY_ORDER["File Managers"]="Graphical|Terminal" SUBCATEGORY_ORDER["Internet"]="Web Browsers|Web Browser Tweaks|Web Browser Extensions|Messaging|Email Clients|File Transfer|VPN" @@ -1255,6 +1343,29 @@ UTILITY_DESCRIPTION["linux-tkg"]="Frogging-Family custom-kernel builder. Unlike UTILITY_DESCRIPTION["Btop"]="Modern terminal-based resource monitor with a rich visual interface showing CPU, memory, disk, and network." UTILITY_DESCRIPTION["bat"]="A cat clone with syntax highlighting, line numbers and Git change markers. On Debian/Ubuntu, where the command is named batcat, a bat link to it is added in ~/.local/bin." UTILITY_DESCRIPTION["ripgrep"]="rg: searches a folder tree for text much faster than grep -r, and skips files listed in .gitignore." +UTILITY_DESCRIPTION["Emacs"]="GNU Emacs, the extensible editor and environment, with its graphical window. Distro package on every distro." +UTILITY_DESCRIPTION["eza"]="ls replacement with colours, icons and git status. Distro package (Debian 13, Ubuntu 26.04, Fedora, Arch, openSUSE, Alpine); elsewhere the GitHub release, SHA-256 checked, in /usr/local/bin (x86_64 only)." +UTILITY_DESCRIPTION["fzf"]="Command-line fuzzy finder that filters any list as you type, with Ctrl+R, Ctrl+T and Alt+C in the shell (loaded from ~/.bashrc, and ~/.zshrc when it exists). Distro package (EPEL on Rocky/Alma)." +UTILITY_DESCRIPTION["Helix"]="Modal terminal editor with language-server support built in. Distro package (Fedora, Rocky/Alma 9 and 10, Arch, openSUSE, Alpine); on Debian, Ubuntu and Rocky/Alma 8 the GitHub release, SHA-256 checked, in /opt/helix." +UTILITY_DESCRIPTION["Helm"]="The Kubernetes package manager. Distro package (Fedora, Rocky/Alma 9 and 10, Arch, openSUSE, Alpine); elsewhere the release from get.helm.sh, checked against Helm's published SHA-256, in /usr/local/bin." +UTILITY_DESCRIPTION["Java JDK"]="OpenJDK with the compiler. Distro packages: default-jdk on Debian and Ubuntu, the newest long-term-support build elsewhere (25, 21 or 17)." +UTILITY_DESCRIPTION["k3s"]="Lightweight Kubernetes: installs a cluster node and starts it as a service. Alpine: distro package. Elsewhere k3s's own install script from get.k3s.io, which checks the k3s binary itself. Uninstalling deletes the cluster data in /var/lib/rancher/k3s." +UTILITY_DESCRIPTION["lazygit"]="Terminal UI for git: stage hunks, resolve conflicts and browse history from the keyboard. Distro package (Debian 13, Ubuntu 26.04, Fedora, Arch, openSUSE, Alpine); elsewhere the GitHub release, SHA-256 checked, in /usr/local/bin." +UTILITY_DESCRIPTION["minikube"]="Runs a local single-node Kubernetes cluster for development. Distro package on Arch and openSUSE Tumbleweed; elsewhere the GitHub release, SHA-256 checked, in /usr/local/bin. Needs a driver such as Docker, Podman or KVM, which this does not install. Not available on Alpine." +UTILITY_DESCRIPTION["nmap"]="Network scanner: finds hosts and open ports. Distro package; not in openSUSE Leap." +UTILITY_DESCRIPTION["Ollama"]="Runs large language models locally. Distro package (Fedora, Arch, openSUSE, Alpine) started as a service; elsewhere the GitHub release, SHA-256 checked, with an ollama user and systemd service. CPU and NVIDIA GPUs; AMD GPUs need Ollama's ROCm add-on, which is not installed. Uninstall keeps downloaded models." +UTILITY_DESCRIPTION["PHP"]="The PHP command-line interpreter from the distro's packages (php-cli, php, php8 or php84). Not a web-server module." +UTILITY_DESCRIPTION["Podman Desktop"]="Graphical manager for Podman containers, pods and Kubernetes. Distro package on Arch, Flathub elsewhere. Needs a Podman engine (the Podman entry). Not available on Alpine." +UTILITY_DESCRIPTION["Python"]="The distro's Python 3 with pip, virtual environments and development headers. The version is the distro's; pyenv installs others. Uninstall keeps python3 itself, which the system needs." +UTILITY_DESCRIPTION["Ruby"]="Ruby with the headers gems need to build native extensions, from the distro's packages." +UTILITY_DESCRIPTION["starship"]="Fast, themeable shell prompt, loaded from ~/.bashrc (and ~/.zshrc when it exists). Distro package (Debian 13, Ubuntu 26.04, Arch, openSUSE, Alpine); elsewhere the GitHub release, SHA-256 checked, in /usr/local/bin." +UTILITY_DESCRIPTION["Sublime Text"]="Fast, polished text and code editor (paid licence, free to evaluate). Installed from Sublime HQ's own signed repository on Debian, Ubuntu, Fedora, RHEL clones and openSUSE, so updates arrive with the system; on Arch from the AUR (only with AUR support enabled). Not available on Alpine or Rocky/Alma 9 and 10 (their RPM refuses the key's SHA-1 signature). Uninstall keeps your settings and licence." +UTILITY_DESCRIPTION["tldr"]="Short, example-first help pages for shell commands (tldr tar). Installs the distro's client (tealdeer, tlrc or the Python tldr; EPEL on Rocky/Alma). Not available on Alpine." +UTILITY_DESCRIPTION["Vim"]="The classic modal editor (vim-enhanced on Fedora and RHEL clones). Distro package on every distro." +UTILITY_DESCRIPTION["VirtualBox"]="Runs virtual machines. Distro package on Ubuntu, Arch and openSUSE; Oracle's own signed repository on Debian 12/13, Fedora up to 44 and Rocky/Alma 8 to 10. The kernel module is built for the running kernel and must be signed under Secure Boot. Your VMs are kept on uninstall. Not available on Alpine." +UTILITY_DESCRIPTION["Wireshark"]="Network packet analyser. Distro package; the installing user joins the wireshark group to capture without root (log out and in)." +UTILITY_DESCRIPTION["Zed"]="Fast code editor with built-in collaboration and AI. Distro package on Arch and openSUSE Tumbleweed, Flathub elsewhere. Not available on Alpine." +UTILITY_DESCRIPTION["zoxide"]="Smarter cd: remembers the folders you use and jumps to them with z, loaded from ~/.bashrc (and ~/.zshrc when it exists). Distro package (every release except Rocky/Alma 10); elsewhere the GitHub release, SHA-256 checked, in /usr/local/bin." UTILITY_DESCRIPTION["Alacritty"]="Fast GPU-accelerated terminal emulator configured by a text file. Distro package; not available on Rocky/Alma/RHEL or Ubuntu 22.04, which have none." UTILITY_DESCRIPTION["auto-cpufreq"]="Adjusts CPU speed and power use to the battery and load, with a background service; for laptops. No distro carries it: on Arch it comes from the AUR (only with AUR support enabled), elsewhere upstream's own installer runs from the GitHub release (upstream publishes no checksum), into /opt/auto-cpufreq. Cannot run beside TLP. Not available on Alpine, openSUSE Leap or Rocky/Alma 8 and 9." UTILITY_DESCRIPTION["BleachBit"]="Disk cleaner that clears caches, logs, history and temporary files for the system and many applications. Distro package (EPEL on Rocky/Alma 8 and 9), or Flathub on Rocky/Alma 10. Not available on Alpine." @@ -1363,7 +1474,7 @@ mark_aur_only_arch \ "Euro-Office=euro-office-desktopeditors-git" \ "Snap (snapd)=snapd" "Snapper GUI=snapper-gui-git" \ "Trojita=trojita" "Zotero=zotero" "1Password=1password" \ - "auto-cpufreq=auto-cpufreq" + "auto-cpufreq=auto-cpufreq" "Sublime Text=sublime-text-4" # Utilities that can install from upstream's own binary when no package source # carries them (the third tier of arch_install_ordered, reached on Arch because @@ -1388,7 +1499,16 @@ mark_upstream_binary \ "Hermes Agent=$HOME/.hermes/hermes-agent" \ "LM Studio=$_LMS_APPIMAGE" \ "GPU Task Manager=$_GTM_DIR" \ - "auto-cpufreq=$_ACF_ROOT/current" + "auto-cpufreq=$_ACF_ROOT/current" \ + "Helix=/opt/helix" \ + "Helm=/usr/local/bin/helm" \ + "lazygit=/usr/local/bin/lazygit" \ + "eza=/usr/local/bin/eza" \ + "zoxide=/usr/local/bin/zoxide" \ + "starship=/usr/local/bin/starship" \ + "minikube=/usr/local/bin/minikube" \ + "k3s=/usr/local/bin/k3s-uninstall.sh" \ + "Ollama=/usr/local/lib/ollama" # Where the current upstream version can be read for those installs. Registered # only for the ones with a cheap, stable version endpoint: these lookups gate @@ -1403,7 +1523,16 @@ mark_upstream_latest \ "Xodus Nexus=_xn_latest_version" \ "LM Studio=_lms_latest_version" \ "GPU Task Manager=_gtm_latest_version" \ - "auto-cpufreq=_acf_latest_version" + "auto-cpufreq=_acf_latest_version" \ + "Helix=_helix_latest_version" \ + "Helm=_helm_latest_version" \ + "lazygit=_lazygit_latest_version" \ + "eza=_eza_latest_version" \ + "zoxide=_zoxide_latest_version" \ + "starship=_starship_latest_version" \ + "minikube=_minikube_latest_version" \ + "k3s=_k3s_latest_version" \ + "Ollama=_ollama_latest_version" # Utilities whose own run is a complete system upgrade, so the pre-flight package # refresh must not upgrade ahead of them -- see mark_full_upgrade in utilities.sh. diff --git a/lib/installers/_shared.sh b/lib/installers/_shared.sh index bc18246..987f146 100644 --- a/lib/installers/_shared.sh +++ b/lib/installers/_shared.sh @@ -511,3 +511,245 @@ native_or_flatpak_update() { native_or_flatpak_version() { _ver_from_pkg "$2" || _ver_from_flatpak "$1" || echo "" } + +# ============================================================================ +# Upstream GitHub release downloads, verified +# +# For apps no distro package covers on every release (lazygit, eza, helix, +# starship, zoxide, minikube, Ollama). GitHub publishes a SHA-256 digest for +# every release file next to its download URL in the release API; the download +# is checked against it and refused without one. Used by lazygit, eza, Helix, +# starship, zoxide, minikube and Ollama; do not add another copy of this. +# ============================================================================ + +declare -A _GH_RELEASE_JSON=() + +# Release JSON for REPO, fetched once per run, flattened to one line. +_gh_release_json() { + local repo="$1" + if [[ -z "${_GH_RELEASE_JSON[$repo]:-}" ]]; then + _GH_RELEASE_JSON["$repo"]=$(curl -fsSL --max-time 30 \ + "https://api.github.com/repos/${repo}/releases/latest" 2>/dev/null | tr -d '\n') || return 1 + fi + # A rate-limit or error answer is JSON too, but has no release in it. + if [[ "${_GH_RELEASE_JSON[$repo]}" != *'"tag_name"'* ]]; then + unset "_GH_RELEASE_JSON[$repo]" + return 1 + fi +} + +# Latest release tag of REPO, e.g. v0.66.3. +github_latest_tag() { + _gh_release_json "$1" || return 1 + grep -oP '"tag_name":\s*"\K[^"]+' <<<"${_GH_RELEASE_JSON[$1]}" | head -1 +} + +# github_asset_info REPO NAME_REGEX +# Prints "name url sha256" for the first release file whose name matches the +# extended regex (anchored at both ends), or nothing. A file with no published +# digest is never returned. +github_asset_info() { + local repo="$1" re="$2" entry name url sha + _gh_release_json "$repo" || return 1 + while IFS= read -r entry; do + name=$(grep -oP '"name":\s*"\K[^"]+' <<<"$entry" | head -1) + [[ "$name" =~ ^(${re})$ ]] || continue + sha=$(grep -oP '"digest":\s*"sha256:\K[0-9a-f]{64}' <<<"$entry" | head -1) + url=$(grep -oP '"browser_download_url":\s*"\K[^"]+' <<<"$entry" | head -1) + [[ -n "$sha" && -n "$url" ]] || continue + printf '%s %s %s\n' "$name" "$url" "$sha" + return 0 + done < <(grep -oP '"name":\s*"[^"]+"(?:(?!"name":).)*?"digest":\s*"sha256:[0-9a-f]{64}"(?:(?!"name":).)*?"browser_download_url":\s*"[^"]+"' \ + <<<"${_GH_RELEASE_JSON[$repo]}") + return 1 +} + +# github_asset_download REPO NAME_REGEX DEST_DIR +# Downloads the matching release file into DEST_DIR, checks it against its +# published SHA-256 and prints its path. Returns 1 (with the reason) otherwise. +github_asset_download() { + local repo="$1" re="$2" dest="$3" name url sha + _gh_release_json "$repo" || { + error "Could not read the latest ${repo} release from GitHub (offline, or its rate limit is used up; try again later)." + return 1 + } + read -r name url sha < <(github_asset_info "$repo" "$re") + if [[ -z "$name" ]]; then + error "No downloadable, checksummed file matching ${re} in the latest ${repo} release." + return 1 + fi + # stderr: the caller captures this function's stdout as the file path. + info "Downloading ${name}..." >&2 + curl -fsSL --max-time 600 "$url" -o "${dest}/${name}" || { error "Could not download ${name}."; return 1; } + verify_sha256 "${dest}/${name}" "$sha" "$name" || return 1 + printf '%s\n' "${dest}/${name}" +} + +# Architecture names upstream release files use. Prints nothing and returns 1 +# on a CPU this tool has no builds for. +# upstream_arch gnu -> x86_64 | aarch64 (Rust target triples) +# upstream_arch go -> amd64 | arm64 (Go style) +upstream_arch() { + case "$(uname -m)-$1" in + x86_64-gnu) echo x86_64 ;; + aarch64-gnu) echo aarch64 ;; + x86_64-go) echo amd64 ;; + aarch64-go) echo arm64 ;; + *) error "No upstream build for the $(uname -m) CPU."; return 1 ;; + esac +} + +# ============================================================================ +# Shell profile blocks (starship, zoxide, fzf) +# +# These tools do nothing until the shell is told to load them. The block is +# written between two marker lines so it is added once and removed exactly. +# ============================================================================ + +# shell_rc_block_add RCFILE BEGIN END (block body on stdin) +shell_rc_block_add() { + local rcfile="$1" begin="$2" end="$3" body + body=$(cat) + grep -qF "$begin" "$rcfile" 2>/dev/null && return 0 + { printf '\n%s\n' "$begin"; printf '%s\n' "$body"; printf '%s\n' "$end"; } >> "$rcfile" + info "Added a block to ${rcfile}" +} + +# shell_rc_block_remove RCFILE BEGIN END +# Exact string matching (awk), avoiding regex-escaping issues with sed. +shell_rc_block_remove() { + local rcfile="$1" begin="$2" end="$3" + [[ -f "$rcfile" ]] || return 0 + grep -qF "$begin" "$rcfile" 2>/dev/null || return 0 + awk -v begin="$begin" -v end="$end" ' + $0 == begin { skip=1 } + skip { if ($0 == end) { skip=0 } next } + { print } + ' "$rcfile" > "${rcfile}.tmp" && mv "${rcfile}.tmp" "$rcfile" + info "Removed a block from ${rcfile}" +} + +# shell_init_setup NAME BASH_LINE ZSH_LINE: add NAME's block to ~/.bashrc, and to +# ~/.zshrc when that file exists (zsh may not be set up yet). +shell_init_setup() { + local name="$1" bash_line="$2" zsh_line="$3" + shell_rc_block_add "$HOME/.bashrc" "# >>> linux_util ${name} (bash) >>>" "# <<< linux_util ${name} (bash) <<<" <<<"$bash_line" + [[ -f "$HOME/.zshrc" ]] && shell_rc_block_add "$HOME/.zshrc" "# >>> linux_util ${name} (zsh) >>>" "# <<< linux_util ${name} (zsh) <<<" <<<"$zsh_line" + return 0 +} + +shell_init_remove() { + local name="$1" + shell_rc_block_remove "$HOME/.bashrc" "# >>> linux_util ${name} (bash) >>>" "# <<< linux_util ${name} (bash) <<<" + shell_rc_block_remove "$HOME/.zshrc" "# >>> linux_util ${name} (zsh) >>>" "# <<< linux_util ${name} (zsh) <<<" +} + +# ============================================================================ +# Distro package, else a verified upstream binary +# +# For single-binary tools (lazygit, eza, zoxide, starship, minikube) that most +# distros package but some releases do not: the distro's own package when its +# repositories have one, otherwise the GitHub release file, checked against its +# published SHA-256 and installed to /usr/local/bin. The package manager never +# sees the copy, so uninstall and update follow whichever route is on the +# machine: the /usr/local/bin file counts as the upstream route only while no +# package is installed. +# ============================================================================ + +# Fill @GNU@ (x86_64|aarch64), @GO@ (amd64|arm64) and @GOX@ (x86_64|arm64) in an +# asset-name regex with this machine's names. +_upstream_expand_regex() { + local re="$1" gnu go gox + gnu=$(upstream_arch gnu) || return 1 + go=$(upstream_arch go) || return 1 + gox=$gnu; [[ "$gnu" == aarch64 ]] && gox=arm64 + re="${re//@GNU@/$gnu}"; re="${re//@GO@/$go}"; re="${re//@GOX@/$gox}" + printf '%s\n' "$re" +} + +# github_binary_install REPO ASSET_REGEX BINARY_NAME [DEST_NAME] +# Downloads the matching release file (a .tar.gz holding BINARY_NAME, or the +# bare binary itself), verifies it and installs it as /usr/local/bin/DEST_NAME. +github_binary_install() { + local repo="$1" re="$2" bin="$3" dest="${4:-$3}" tmp file found + re=$(_upstream_expand_regex "$re") || return 1 + tmp=$(mktemp -d) || return 1 + CLEANUP_FILES+=("$tmp") + file=$(github_asset_download "$repo" "$re" "$tmp") || { rm -rf "$tmp"; return 1; } + if [[ "$file" == *.tar.gz || "$file" == *.tgz ]]; then + tar -xzf "$file" -C "$tmp" || { error "Could not unpack $(basename "$file")."; rm -rf "$tmp"; return 1; } + found=$(find "$tmp" -type f -name "$bin" | head -1) + else + found="$file" + fi + if [[ -z "$found" ]]; then + error "${bin} was not in the downloaded file." + rm -rf "$tmp" + return 1 + fi + sudo install -Dm755 "$found" "/usr/local/bin/${dest}" || { rm -rf "$tmp"; return 1; } + rm -rf "$tmp" +} + +# True when /usr/local/bin/DEST is a copy this route installed (no package owns it). +upstream_binary_present() { + local dest="$1" pkg="$2" + [[ -x "/usr/local/bin/${dest}" ]] && ! pkg_check_installed "$pkg" +} + +# native_or_github_install PKG REPO ASSET_REGEX BINARY [DEST_NAME] +native_or_github_install() { + local pkg="$1" + pkg_refresh + ensure_epel + if pkg_in_repo "$pkg"; then + pkg_install "$pkg" + return $? + fi + info "${pkg} is not in the ${DISTRO_NAME:-system} repositories; installing the verified release from GitHub." + github_binary_install "${@:2}" +} + +# native_or_github_uninstall PKG DEST_NAME +native_or_github_uninstall() { + local pkg="$1" dest="$2" + if pkg_check_installed "$pkg"; then + pkg_remove "$pkg" + fi + sudo rm -f "/usr/local/bin/${dest}" +} + +# native_or_github_update PKG REPO ASSET_REGEX BINARY DEST_NAME INSTALLED_VERSION +# Reinstalls the release only when it is newer than INSTALLED_VERSION. +native_or_github_update() { + local pkg="$1" repo="$2" re="$3" bin="$4" dest="$5" cur="$6" tag + if ! upstream_binary_present "$dest" "$pkg"; then + pkg_upgrade "$pkg" + return $? + fi + tag=$(github_latest_tag "$repo") || { error "Could not read the latest ${repo} release from GitHub."; return 1; } + if [[ -n "$cur" && "${tag#v}" == "$cur" ]]; then + info "${dest} is already at the latest version (${cur})." + return 0 + fi + github_binary_install "$repo" "$re" "$bin" "$dest" +} + +# rpm_import_key_checked URL FINGERPRINT +# Imports a vendor's RPM signing key only when the downloaded key carries the +# pinned fingerprint. Used by Sublime Text and VirtualBox. +rpm_import_key_checked() { + local url="$1" fpr="$2" tmp + ensure_tools + tmp=$(mktemp) || return 1 + if ! curl -fsSL --max-time 30 "$url" -o "$tmp"; then + rm -f "$tmp"; error "Could not download the signing key from ${url}."; return 1 + fi + if ! gpg_key_has_fingerprint "$tmp" "$fpr"; then + rm -f "$tmp"; error "The key from ${url} does not match fingerprint ${fpr}."; return 1 + fi + sudo rpm --import "$tmp" + local rc=$? + rm -f "$tmp" + return "$rc" +} diff --git a/lib/installers/alpine_packages.sh b/lib/installers/alpine_packages.sh index 615dcc8..2355ebf 100644 --- a/lib/installers/alpine_packages.sh +++ b/lib/installers/alpine_packages.sh @@ -109,6 +109,23 @@ _ALPINE_TABLE=( "kitty|kitty|kitty||" "WezTerm|wezterm|wezterm||" "CUPS|cups||cupsd|" + "Vim|vim|vim||" + "Emacs|emacs|emacs||" + "Helix|helix|hx||" + "fzf|fzf|fzf||" + "eza|eza|eza||" + "zoxide|zoxide|zoxide||" + "starship|starship|starship||" + "lazygit|lazygit|lazygit||" + "Helm|helm|helm||" + "k3s|k3s|k3s|k3s|" + "Python|python3 py3-pip python3-dev|python3||" + "PHP|php84|php84||" + "Ruby|ruby ruby-dev|ruby||" + "Wireshark|wireshark|wireshark||" + "nmap|nmap|nmap||" + "Ollama|ollama|ollama|ollama|" + "Java JDK|openjdk25-jdk|javac||" ) # Registered utilities whose own installer file has an Alpine branch. diff --git a/lib/installers/emacs.sh b/lib/installers/emacs.sh new file mode 100644 index 0000000..f1d0d3c --- /dev/null +++ b/lib/installers/emacs.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Emacs installer functions +# +# GNU Emacs with its graphical window. The emacs package in every supported +# distro's repositories, Alpine included. + +# --- Emacs --- + +check_emacs() { _check_standard emacs emacs ""; } + +install_emacs() { + info "Installing Emacs..." + pkg_install emacs || return 1 + info "Emacs installed." +} + +uninstall_emacs() { + info "Uninstalling Emacs..." + pkg_remove emacs +} + +update_emacs() { + info "Updating Emacs..." + pkg_upgrade emacs +} + +get_version_emacs() { _ver_from_pkg emacs || _ver_from_cmd emacs || echo ""; } diff --git a/lib/installers/eza.sh b/lib/installers/eza.sh new file mode 100644 index 0000000..de3e76a --- /dev/null +++ b/lib/installers/eza.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# eza installer functions +# +# ls replacement with colours, icons and git status. The distro package where the repositories have one (Debian 13, Ubuntu 26.04, Fedora, Arch, openSUSE, Alpine); otherwise the GitHub release, SHA-256 checked, in /usr/local/bin (x86_64 only: upstream builds no static aarch64 file). + +# --- eza --- + +_eza_REPO="eza-community/eza" +_eza_RE='eza_@GNU@-unknown-linux-musl\.tar\.gz' + +# Latest upstream version, for System Updates. +_eza_latest_version() { github_latest_tag "$_eza_REPO" | sed 's/^v//'; } + +check_eza() { _check_standard eza eza "" || [[ -x /usr/local/bin/eza ]]; } + +install_eza() { + info "Installing eza..." + native_or_github_install eza "$_eza_REPO" "$_eza_RE" eza || return 1 + info "eza installed." +} + +uninstall_eza() { + info "Uninstalling eza..." + native_or_github_uninstall eza eza +} + +update_eza() { + info "Updating eza..." + native_or_github_update eza "$_eza_REPO" "$_eza_RE" eza eza "$(get_version_eza)" +} + +get_version_eza() { _ver_from_pkg eza || _ver_from_cmd eza --version || echo ""; } diff --git a/lib/installers/fzf.sh b/lib/installers/fzf.sh new file mode 100644 index 0000000..7d77eb2 --- /dev/null +++ b/lib/installers/fzf.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# fzf installer functions +# +# Command-line fuzzy finder: filters any list as you type, and adds Ctrl+R / +# Ctrl+T / Alt+C to the shell. The fzf package in every supported distro's +# repositories, Alpine included (EPEL on RHEL clones). The key bindings are +# loaded from ~/.bashrc, and ~/.zshrc when it exists, through `fzf --bash` / +# `fzf --zsh` (fzf 0.48 and newer; on an older fzf the line does nothing). + +# --- fzf --- + +check_fzf() { _check_standard fzf fzf ""; } + +install_fzf() { + info "Installing fzf..." + ensure_epel + pkg_install fzf || return 1 + # shellcheck disable=SC2016 # the rc file, not this script, expands these + shell_init_setup fzf \ + 'if command -v fzf >/dev/null 2>&1; then eval "$(fzf --bash 2>/dev/null)"; fi' \ + 'if command -v fzf >/dev/null 2>&1; then source <(fzf --zsh 2>/dev/null); fi' + info "fzf installed. Open a new terminal for Ctrl+R and Ctrl+T." +} + +uninstall_fzf() { + info "Uninstalling fzf..." + shell_init_remove fzf + pkg_remove fzf +} + +update_fzf() { + info "Updating fzf..." + pkg_upgrade fzf +} + +get_version_fzf() { _ver_from_pkg fzf || _ver_from_cmd fzf || echo ""; } diff --git a/lib/installers/helix.sh b/lib/installers/helix.sh new file mode 100644 index 0000000..3b2e689 --- /dev/null +++ b/lib/installers/helix.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# Helix installer functions +# +# Modal terminal editor with language-server support built in. The distro +# package where the repositories have one (Fedora, Rocky/Alma 9 and 10 through +# EPEL, Arch, openSUSE, Alpine); otherwise (Debian, Ubuntu, Rocky/Alma 8) the +# GitHub release, SHA-256 checked, unpacked whole into /opt/helix, because hx +# looks for its runtime files beside itself, with a link at /usr/local/bin/hx. + +# --- Helix --- + +_HELIX_REPO="helix-editor/helix" +_HELIX_DIR="/opt/helix" + +# Latest upstream version, for System Updates. +_helix_latest_version() { github_latest_tag "$_HELIX_REPO"; } + +check_helix() { _check_standard hx helix "" || [[ -x "${_HELIX_DIR}/hx" ]]; } + +# Unpack the release's .tar.xz needs xz. +_helix_install_release() { + local tmp file dir + if ! command -v xz &>/dev/null; then + case "$DISTRO_FAMILY" in + debian) pkg_install xz-utils || return 1 ;; + *) pkg_install xz || return 1 ;; + esac + fi + tmp=$(mktemp -d) || return 1 + CLEANUP_FILES+=("$tmp") + file=$(github_asset_download "$_HELIX_REPO" "helix-[0-9.]+-$(upstream_arch gnu)-linux\.tar\.xz" "$tmp") || { rm -rf "$tmp"; return 1; } + tar -xJf "$file" -C "$tmp" || { error "Could not unpack the Helix download."; rm -rf "$tmp"; return 1; } + dir=$(find "$tmp" -mindepth 1 -maxdepth 1 -type d | head -1) + [[ -x "${dir}/hx" && -d "${dir}/runtime" ]] || { error "The Helix download is missing hx or its runtime files."; rm -rf "$tmp"; return 1; } + sudo rm -rf "$_HELIX_DIR" + sudo mv "$dir" "$_HELIX_DIR" || { rm -rf "$tmp"; return 1; } + sudo ln -sf "${_HELIX_DIR}/hx" /usr/local/bin/hx + rm -rf "$tmp" +} + +install_helix() { + info "Installing Helix..." + pkg_refresh + ensure_epel + if pkg_in_repo helix; then + pkg_install helix || return 1 + else + info "helix is not in the ${DISTRO_NAME:-system} repositories; installing the verified release from GitHub." + _helix_install_release || return 1 + fi + info "Helix installed. Start it with: hx" +} + +uninstall_helix() { + info "Uninstalling Helix..." + pkg_check_installed helix && pkg_remove helix + if [[ -d "$_HELIX_DIR" ]]; then + sudo rm -rf "$_HELIX_DIR" + sudo rm -f /usr/local/bin/hx + fi + return 0 +} + +update_helix() { + info "Updating Helix..." + if [[ -d "$_HELIX_DIR" ]] && ! pkg_check_installed helix; then + local tag cur + tag=$(github_latest_tag "$_HELIX_REPO") || { error "Could not read the latest Helix release from GitHub."; return 1; } + cur=$(get_version_helix) + if [[ -n "$cur" && "$tag" == "$cur" ]]; then + info "Helix is already at the latest version (${cur})." + return 0 + fi + _helix_install_release + else + pkg_upgrade helix + fi +} + +get_version_helix() { _ver_from_pkg helix || _ver_from_cmd hx || echo ""; } diff --git a/lib/installers/helm.sh b/lib/installers/helm.sh new file mode 100644 index 0000000..7142383 --- /dev/null +++ b/lib/installers/helm.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# Helm installer functions +# +# The Kubernetes package manager. The distro package where the repositories +# have one (Fedora, Rocky/Alma 9 and 10 through EPEL, Arch, openSUSE, Alpine); +# otherwise (Debian, Ubuntu, Rocky/Alma 8) the release from get.helm.sh, checked +# against the SHA-256 file Helm publishes beside it, in /usr/local/bin. + +# --- Helm --- + +_HELM_REPO="helm/helm" + +# Latest upstream version, for System Updates. +_helm_latest_version() { github_latest_tag "$_HELM_REPO" | sed 's/^v//'; } + +check_helm() { _check_standard helm helm "" || [[ -x /usr/local/bin/helm ]]; } + +_helm_install_release() { + local tag arch tmp name want + tag=$(github_latest_tag "$_HELM_REPO") || { error "Could not read the latest Helm release from GitHub."; return 1; } + arch=$(upstream_arch go) || return 1 + name="helm-${tag}-linux-${arch}.tar.gz" + tmp=$(mktemp -d) || return 1 + CLEANUP_FILES+=("$tmp") + info "Downloading ${name}..." + curl -fsSL --max-time 300 "https://get.helm.sh/${name}" -o "${tmp}/${name}" \ + && want=$(curl -fsSL --max-time 30 "https://get.helm.sh/${name}.sha256sum" | awk '{print $1}') \ + && [[ "$want" =~ ^[0-9a-f]{64}$ ]] || { error "Could not download Helm ${tag} or its checksum."; rm -rf "$tmp"; return 1; } + verify_sha256 "${tmp}/${name}" "$want" "$name" || { rm -rf "$tmp"; return 1; } + tar -xzf "${tmp}/${name}" -C "$tmp" || { error "Could not unpack ${name}."; rm -rf "$tmp"; return 1; } + sudo install -Dm755 "${tmp}/linux-${arch}/helm" /usr/local/bin/helm || { rm -rf "$tmp"; return 1; } + rm -rf "$tmp" +} + +install_helm() { + info "Installing Helm..." + pkg_refresh + ensure_epel + if pkg_in_repo helm; then + pkg_install helm || return 1 + else + info "helm is not in the ${DISTRO_NAME:-system} repositories; installing the verified release from get.helm.sh." + _helm_install_release || return 1 + fi + info "Helm installed." +} + +uninstall_helm() { + info "Uninstalling Helm..." + pkg_check_installed helm && pkg_remove helm + sudo rm -f /usr/local/bin/helm + return 0 +} + +update_helm() { + info "Updating Helm..." + if upstream_binary_present helm helm; then + local tag cur + tag=$(github_latest_tag "$_HELM_REPO") || { error "Could not read the latest Helm release from GitHub."; return 1; } + cur=$(get_version_helm) + if [[ -n "$cur" && "${tag#v}" == "$cur" ]]; then + info "Helm is already at the latest version (${cur})." + return 0 + fi + _helm_install_release + else + pkg_upgrade helm + fi +} + +get_version_helm() { _ver_from_pkg helm || _ver_from_cmd helm version || echo ""; } diff --git a/lib/installers/java_jdk.sh b/lib/installers/java_jdk.sh new file mode 100644 index 0000000..be8e5e0 --- /dev/null +++ b/lib/installers/java_jdk.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# Java JDK installer functions +# +# OpenJDK with the compiler, from the distro's own packages: default-jdk on +# Debian and Ubuntu; on the others the newest of the long-term-support builds +# the repositories carry (25, then 21, then 17): java-N-openjdk-devel on Fedora, +# RHEL clones and openSUSE, jdk-openjdk on Arch. Alpine +# installs openjdk25-jdk through alpine_packages.sh. + +# --- Java JDK --- + +_java_candidates() { + case "$DISTRO_FAMILY" in + debian) echo "default-jdk" ;; + fedora) echo "java-25-openjdk-devel java-21-openjdk-devel java-17-openjdk-devel" ;; + rhel) echo "java-25-openjdk-devel java-21-openjdk-devel java-17-openjdk-devel" ;; + suse) echo "java-25-openjdk-devel java-21-openjdk-devel java-17-openjdk-devel" ;; + arch) echo "jdk-openjdk" ;; + esac +} + +# The JDK package this system's repositories carry. +_java_package() { + local p + for p in $(_java_candidates); do + pkg_in_repo "$p" && { printf '%s\n' "$p"; return 0; } + done + return 1 +} + +_java_installed_package() { + local p + for p in $(_java_candidates); do + pkg_check_installed "$p" && { printf '%s\n' "$p"; return 0; } + done + return 1 +} + +check_java_jdk() { _have_cmd javac || _java_installed_package >/dev/null; } + +install_java_jdk() { + info "Installing the Java JDK..." + pkg_refresh + local pkg + pkg=$(_java_package) || { error "No OpenJDK is in the ${DISTRO_NAME:-system} repositories."; return 1; } + pkg_install "$pkg" || return 1 + info "Java JDK installed (package ${pkg})." +} + +uninstall_java_jdk() { + info "Uninstalling the Java JDK..." + local pkg + pkg=$(_java_installed_package) || return 0 + pkg_remove "$pkg" +} + +update_java_jdk() { + info "Updating the Java JDK..." + local pkg + pkg=$(_java_installed_package) || return 1 + pkg_upgrade "$pkg" +} + +get_version_java_jdk() { + local v + v=$(_run_native javac -version 2>&1 | grep -oP '[0-9]+(\.[0-9]+)*' | head -1) + printf '%s\n' "$v" +} diff --git a/lib/installers/k3s.sh b/lib/installers/k3s.sh new file mode 100644 index 0000000..ab16fbf --- /dev/null +++ b/lib/installers/k3s.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# k3s installer functions +# +# Lightweight Kubernetes: one binary that runs a cluster node. Alpine: the +# distro package with its OpenRC service. Everywhere else k3s's own install +# script from get.k3s.io, saved and run from a file; it downloads the k3s +# binary and checks it against the release's published SHA-256 itself, installs +# the service (and k3s-selinux on RHEL clones) and starts a server, with its +# data in /var/lib/rancher/k3s. Uninstalling runs k3s's own remover, which +# DELETES that cluster data. + +# --- k3s --- + +_K3S_SCRIPT_URL="https://get.k3s.io" +_K3S_UNINSTALL="/usr/local/bin/k3s-uninstall.sh" + +# Latest stable release, e.g. 1.34.1: k3s's stable channel redirects to its tag. +_k3s_latest_version() { + local url + url=$(curl -fsSL --max-time 20 -o /dev/null -w '%{url_effective}' "https://update.k3s.io/v1-release/channels/stable" 2>/dev/null) || return 1 + grep -oP '/v\K[0-9]+\.[0-9]+\.[0-9]+' <<<"$url" | head -1 +} + +check_k3s() { _check_standard k3s k3s ""; } + +install_k3s() { + info "Installing k3s..." + ensure_tools + local script + script=$(mktemp) || return 1 + CLEANUP_FILES+=("$script") + curl -fsSL --max-time 60 "$_K3S_SCRIPT_URL" -o "$script" || { error "Could not download the k3s install script."; rm -f "$script"; return 1; } + head -1 "$script" | grep -q '^#!' || { error "The k3s install script is not a script."; rm -f "$script"; return 1; } + sudo sh "$script" + local rc=$? + rm -f "$script" + [[ $rc -eq 0 ]] || { error "The k3s install script failed."; return 1; } + info "k3s installed and running. Use it with: sudo k3s kubectl get nodes" +} + +uninstall_k3s() { + info "Uninstalling k3s..." + if [[ -x "$_K3S_UNINSTALL" ]]; then + sudo "$_K3S_UNINSTALL" + else + pkg_remove k3s + fi +} + +update_k3s() { + info "Updating k3s..." + if [[ ! -x "$_K3S_UNINSTALL" ]]; then + pkg_upgrade k3s + return $? + fi + local cur latest + cur=$(get_version_k3s) + latest=$(_k3s_latest_version) || { error "Could not read the latest k3s version."; return 1; } + if [[ -n "$cur" && "$cur" == "$latest" ]]; then + info "k3s is already at the latest version (${cur})." + return 0 + fi + install_k3s +} + +get_version_k3s() { _ver_from_pkg k3s || _ver_from_cmd k3s --version || echo ""; } diff --git a/lib/installers/lazygit.sh b/lib/installers/lazygit.sh new file mode 100644 index 0000000..22c33fa --- /dev/null +++ b/lib/installers/lazygit.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# lazygit installer functions +# +# Terminal UI for git: stage hunks, resolve conflicts and browse history with the keyboard. The distro package where the repositories have one (Debian 13, Ubuntu 26.04, Fedora, Arch, openSUSE, Alpine); otherwise the GitHub release, SHA-256 checked, in /usr/local/bin. + +# --- lazygit --- + +_lazygit_REPO="jesseduffield/lazygit" +_lazygit_RE='lazygit_[0-9.]+_linux_@GOX@\.tar\.gz' + +# Latest upstream version, for System Updates. +_lazygit_latest_version() { github_latest_tag "$_lazygit_REPO" | sed 's/^v//'; } + +check_lazygit() { _check_standard lazygit lazygit "" || [[ -x /usr/local/bin/lazygit ]]; } + +install_lazygit() { + info "Installing lazygit..." + native_or_github_install lazygit "$_lazygit_REPO" "$_lazygit_RE" lazygit || return 1 + info "lazygit installed." +} + +uninstall_lazygit() { + info "Uninstalling lazygit..." + native_or_github_uninstall lazygit lazygit +} + +update_lazygit() { + info "Updating lazygit..." + native_or_github_update lazygit "$_lazygit_REPO" "$_lazygit_RE" lazygit lazygit "$(get_version_lazygit)" +} + +get_version_lazygit() { _ver_from_pkg lazygit || _ver_from_cmd lazygit --version || echo ""; } diff --git a/lib/installers/minikube.sh b/lib/installers/minikube.sh new file mode 100644 index 0000000..0bdff53 --- /dev/null +++ b/lib/installers/minikube.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# minikube installer functions +# +# Runs a local single-node Kubernetes cluster for development. The distro package on Arch and openSUSE Tumbleweed; otherwise the GitHub release, SHA-256 checked, in /usr/local/bin. Needs a driver such as Docker, Podman or KVM, which this does not install. + +# --- minikube --- + +_minikube_REPO="kubernetes/minikube" +_minikube_RE='minikube-linux-@GO@' + +# Latest upstream version, for System Updates. +_minikube_latest_version() { github_latest_tag "$_minikube_REPO" | sed 's/^v//'; } + +check_minikube() { _check_standard minikube minikube "" || [[ -x /usr/local/bin/minikube ]]; } + +install_minikube() { + info "Installing minikube..." + native_or_github_install minikube "$_minikube_REPO" "$_minikube_RE" minikube || return 1 + info "minikube installed." +} + +uninstall_minikube() { + info "Uninstalling minikube..." + native_or_github_uninstall minikube minikube +} + +update_minikube() { + info "Updating minikube..." + native_or_github_update minikube "$_minikube_REPO" "$_minikube_RE" minikube minikube "$(get_version_minikube)" +} + +get_version_minikube() { _ver_from_pkg minikube || _ver_from_cmd minikube version || echo ""; } diff --git a/lib/installers/nmap.sh b/lib/installers/nmap.sh new file mode 100644 index 0000000..198a7e7 --- /dev/null +++ b/lib/installers/nmap.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# nmap installer functions +# +# Network scanner: finds hosts and open ports. In every supported distro's +# repositories (Alpine included). + +# --- nmap --- + +check_nmap() { _check_standard nmap nmap ""; } + +install_nmap() { + info "Installing nmap..." + pkg_install nmap || return 1 + info "nmap installed." +} + +uninstall_nmap() { + info "Uninstalling nmap..." + pkg_remove nmap +} + +update_nmap() { + info "Updating nmap..." + pkg_upgrade nmap +} + +get_version_nmap() { _ver_from_pkg nmap || _ver_from_cmd nmap || echo ""; } diff --git a/lib/installers/ollama.sh b/lib/installers/ollama.sh new file mode 100644 index 0000000..8414913 --- /dev/null +++ b/lib/installers/ollama.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# Ollama installer functions +# +# Runs large language models locally. The distro package where the repositories +# have one (Fedora, Arch, openSUSE, Alpine), started as a service; otherwise +# the release from GitHub, checked against its published SHA-256, unpacked into +# /usr/local, with an `ollama` system user and a systemd service, the setup +# Ollama documents for a manual install. It uses the CPU and NVIDIA GPUs; AMD +# GPUs need Ollama's separate ROCm add-on, which this does not install. +# Uninstalling keeps the downloaded models in /usr/share/ollama and the user. + +# --- Ollama --- + +_OLLAMA_REPO="ollama/ollama" +_OLLAMA_LIB="/usr/local/lib/ollama" +_OLLAMA_UNIT="/etc/systemd/system/ollama.service" + +# Latest upstream version, for System Updates. +_ollama_latest_version() { github_latest_tag "$_OLLAMA_REPO" | sed 's/^v//'; } + +check_ollama() { _check_standard ollama ollama "" || [[ -x /usr/local/bin/ollama ]]; } + +_ollama_install_release() { + local tmp file + has_systemd || { error "The Ollama release install needs systemd."; return 1; } + command -v zstd &>/dev/null || pkg_install zstd || return 1 + tmp=$(mktemp -d) || return 1 + CLEANUP_FILES+=("$tmp") + file=$(github_asset_download "$_OLLAMA_REPO" "ollama-linux-$(upstream_arch go)\.tar\.zst" "$tmp") || { rm -rf "$tmp"; return 1; } + sudo rm -rf "$_OLLAMA_LIB" + zstd -dc "$file" | sudo tar -xf - -C /usr/local || { error "Could not unpack the Ollama download."; rm -rf "$tmp"; return 1; } + rm -rf "$tmp" + id ollama &>/dev/null || sudo useradd -r -s /bin/false -U -m -d /usr/share/ollama ollama || return 1 + sudo usermod -aG ollama "${SUDO_USER:-$USER}" 2>/dev/null || true + printf '%s\n' \ + '[Unit]' \ + 'Description=Ollama Service' \ + 'After=network-online.target' \ + '' \ + '[Service]' \ + 'ExecStart=/usr/local/bin/ollama serve' \ + 'User=ollama' \ + 'Group=ollama' \ + 'Restart=always' \ + 'RestartSec=3' \ + '' \ + '[Install]' \ + 'WantedBy=multi-user.target' | sudo tee "$_OLLAMA_UNIT" >/dev/null + sudo systemctl daemon-reload + sudo systemctl enable ollama >/dev/null 2>&1 + sudo systemctl restart ollama || warn "Could not start the ollama service; it will start at the next boot." +} + +install_ollama() { + info "Installing Ollama..." + pkg_refresh + if pkg_in_repo ollama; then + pkg_install ollama || return 1 + svc_enable_now ollama || warn "Could not start the ollama service; it will start at the next boot." + else + info "ollama is not in the ${DISTRO_NAME:-system} repositories; installing the verified release from GitHub." + _ollama_install_release || return 1 + fi + info "Ollama installed. Try: ollama run llama3.2" +} + +uninstall_ollama() { + info "Uninstalling Ollama..." + svc_disable_now ollama 2>/dev/null || true + pkg_check_installed ollama && pkg_remove ollama + if [[ -x /usr/local/bin/ollama ]] && ! pkg_check_installed ollama; then + sudo rm -f "$_OLLAMA_UNIT" /usr/local/bin/ollama + sudo rm -rf "$_OLLAMA_LIB" + has_systemd && sudo systemctl daemon-reload + fi + return 0 +} + +update_ollama() { + info "Updating Ollama..." + if ! upstream_binary_present ollama ollama; then + pkg_upgrade ollama + return $? + fi + local tag cur + tag=$(github_latest_tag "$_OLLAMA_REPO") || { error "Could not read the latest Ollama release from GitHub."; return 1; } + cur=$(get_version_ollama) + if [[ -n "$cur" && "${tag#v}" == "$cur" ]]; then + info "Ollama is already at the latest version (${cur})." + return 0 + fi + _ollama_install_release +} + +get_version_ollama() { _ver_from_pkg ollama || _ver_from_cmd ollama || echo ""; } diff --git a/lib/installers/pay_respects.sh b/lib/installers/pay_respects.sh index 342e8f9..fff6767 100644 --- a/lib/installers/pay_respects.sh +++ b/lib/installers/pay_respects.sh @@ -205,18 +205,12 @@ _payr_apply_rc() { info "Added Pay Respects ${shell} block to ${rcfile}" } -# Remove a begin/end marker block using exact string matching (awk), avoiding -# regex-escaping issues with BRE and sed. +# Remove a begin/end marker block (the shared shell_rc_block_remove does the work). _payr_remove_rc() { local rcfile="$1" begin="$2" end="$3" [[ -f "$rcfile" ]] || return 0 grep -qF "$begin" "$rcfile" 2>/dev/null || return 0 - awk -v begin="$begin" -v end="$end" ' - $0 == begin { skip=1 } - skip { if ($0 == end) { skip=0 } next } - { print } - ' "$rcfile" > "${rcfile}.tmp" && mv "${rcfile}.tmp" "$rcfile" - info "Removed Pay Respects block from ${rcfile}" + shell_rc_block_remove "$rcfile" "$begin" "$end" } # The binary alone does nothing: the shell has to be told to bind F to it. diff --git a/lib/installers/php.sh b/lib/installers/php.sh new file mode 100644 index 0000000..0fc8b68 --- /dev/null +++ b/lib/installers/php.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# PHP installer functions +# +# The PHP command-line interpreter, from the distro's own packages: php-cli on +# Debian, Ubuntu, Fedora and RHEL clones; php on Arch; php8 on openSUSE; php84 +# on Alpine. Versions follow the distro. Not a web +# server module: add the one you need (php-fpm, mod_php) yourself. + +# --- PHP --- + +_php_pkg() { + case "$DISTRO_FAMILY" in + arch) echo php ;; + suse) echo php8 ;; + alpine) echo php84 ;; + *) echo php-cli ;; + esac +} + +check_php() { _check_standard php "$(_php_pkg)" ""; } + +install_php() { + info "Installing PHP..." + ensure_epel + pkg_install "$(_php_pkg)" || return 1 + info "PHP installed." +} + +uninstall_php() { + info "Uninstalling PHP..." + pkg_remove "$(_php_pkg)" +} + +update_php() { + info "Updating PHP..." + pkg_upgrade "$(_php_pkg)" +} + +get_version_php() { _ver_from_pkg "$(_php_pkg)" || _ver_from_cmd php || echo ""; } diff --git a/lib/installers/podman_desktop.sh b/lib/installers/podman_desktop.sh new file mode 100644 index 0000000..f354b7f --- /dev/null +++ b/lib/installers/podman_desktop.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Podman Desktop installer functions +# +# Graphical manager for Podman containers, pods and Kubernetes. The distro +# package on Arch; everywhere else Flathub. It drives a Podman engine, which the +# Podman entry installs. Not offered on Alpine. + +# --- Podman Desktop --- + +check_podman_desktop() { _check_standard podman-desktop podman-desktop io.podman_desktop.PodmanDesktop; } + +install_podman_desktop() { + info "Installing Podman Desktop..." + native_or_flatpak_install io.podman_desktop.PodmanDesktop podman-desktop || return 1 + info "Podman Desktop installed." +} + +uninstall_podman_desktop() { + info "Uninstalling Podman Desktop..." + native_or_flatpak_uninstall io.podman_desktop.PodmanDesktop podman-desktop +} + +update_podman_desktop() { + info "Updating Podman Desktop..." + native_or_flatpak_update io.podman_desktop.PodmanDesktop podman-desktop +} + +get_version_podman_desktop() { native_or_flatpak_version io.podman_desktop.PodmanDesktop podman-desktop; } diff --git a/lib/installers/python.sh b/lib/installers/python.sh new file mode 100644 index 0000000..29c332e --- /dev/null +++ b/lib/installers/python.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Python installer functions +# +# The distro's own Python 3 with pip and virtual environments: python3, +# python3-pip, python3-venv and python3-dev on Debian and Ubuntu; python3, +# python3-pip and python3-devel on Fedora, RHEL clones and openSUSE; python and +# python-pip on Arch; python3, py3-pip and python3-dev on Alpine. The version is +# whatever the distro ships; pyenv (its own entry) installs others. + +# --- Python --- + +_python_pkgs() { + case "$DISTRO_FAMILY" in + debian) echo "python3 python3-pip python3-venv python3-dev" ;; + fedora|rhel) echo "python3 python3-pip python3-devel" ;; + suse) echo "python3 python3-pip python3-devel" ;; + arch) echo "python python-pip" ;; + alpine) echo "python3 py3-pip python3-dev" ;; + esac +} + +check_python() { _have_cmd python3 && { _have_cmd pip3 || _have_cmd pip || python3 -m pip --version &>/dev/null; }; } + +install_python() { + info "Installing Python..." + local pkgs + pkgs=$(_python_pkgs) + # shellcheck disable=SC2086 # the list is intentionally split + pkg_install $pkgs || return 1 + info "Python installed." +} + +# Only the pip, venv and header packages go: python3 itself is needed by the +# system on most distros, so removing it would take the desktop with it. +uninstall_python() { + info "Uninstalling Python's pip, venv and development packages..." + local pkgs + pkgs=$(_python_pkgs) + # shellcheck disable=SC2086 + pkg_remove ${pkgs#* } +} + +update_python() { + info "Updating Python..." + local pkgs + pkgs=$(_python_pkgs) + # shellcheck disable=SC2086 + pkg_upgrade $pkgs +} + +get_version_python() { _ver_from_cmd python3 || echo ""; } diff --git a/lib/installers/ruby.sh b/lib/installers/ruby.sh new file mode 100644 index 0000000..f6d083e --- /dev/null +++ b/lib/installers/ruby.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Ruby installer functions +# +# Ruby with the headers gems need to build native extensions, from the distro's +# own packages: ruby-full on Debian and Ubuntu; ruby and ruby-devel on Fedora, +# RHEL clones and openSUSE; ruby on Arch; ruby and ruby-dev on Alpine. + +# --- Ruby --- + +_ruby_pkgs() { + case "$DISTRO_FAMILY" in + debian) echo ruby-full ;; + arch) echo ruby ;; + alpine) echo "ruby ruby-dev" ;; + *) echo "ruby ruby-devel" ;; + esac +} + +check_ruby() { _check_standard ruby "$(_ruby_pkgs | cut -d' ' -f1)" ""; } + +install_ruby() { + info "Installing Ruby..." + local pkgs + pkgs=$(_ruby_pkgs) + # shellcheck disable=SC2086 # the list is intentionally split + pkg_install $pkgs || return 1 + info "Ruby installed." +} + +uninstall_ruby() { + info "Uninstalling Ruby..." + local pkgs + pkgs=$(_ruby_pkgs) + # shellcheck disable=SC2086 + pkg_remove $pkgs +} + +update_ruby() { + info "Updating Ruby..." + local pkgs + pkgs=$(_ruby_pkgs) + # shellcheck disable=SC2086 + pkg_upgrade $pkgs +} + +get_version_ruby() { _ver_from_pkg "$(_ruby_pkgs | cut -d' ' -f1)" || _ver_from_cmd ruby || echo ""; } diff --git a/lib/installers/starship.sh b/lib/installers/starship.sh new file mode 100644 index 0000000..b77f965 --- /dev/null +++ b/lib/installers/starship.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# starship installer functions +# +# Fast, themeable shell prompt. The distro package where the repositories have one (Debian 13, Ubuntu 26.04, Arch, openSUSE, Alpine); otherwise the GitHub release, SHA-256 checked, in /usr/local/bin. Loaded from ~/.bashrc (and ~/.zshrc when it exists). + +# --- starship --- + +_starship_REPO="starship/starship" +_starship_RE='starship-@GNU@-unknown-linux-musl\.tar\.gz' + +# Latest upstream version, for System Updates. +_starship_latest_version() { github_latest_tag "$_starship_REPO" | sed 's/^v//'; } + +check_starship() { _check_standard starship starship "" || [[ -x /usr/local/bin/starship ]]; } + +install_starship() { + info "Installing starship..." + native_or_github_install starship "$_starship_REPO" "$_starship_RE" starship || return 1 + # shellcheck disable=SC2016 # the rc file, not this script, expands these + shell_init_setup starship \ + 'if command -v starship >/dev/null 2>&1; then eval "$(starship init bash)"; fi' \ + 'if command -v starship >/dev/null 2>&1; then eval "$(starship init zsh)"; fi' + info "starship installed. Open a new terminal to use it." +} + +uninstall_starship() { + info "Uninstalling starship..." + shell_init_remove starship + native_or_github_uninstall starship starship +} + +update_starship() { + info "Updating starship..." + native_or_github_update starship "$_starship_REPO" "$_starship_RE" starship starship "$(get_version_starship)" +} + +get_version_starship() { _ver_from_pkg starship || _ver_from_cmd starship --version || echo ""; } diff --git a/lib/installers/sublime_text.sh b/lib/installers/sublime_text.sh new file mode 100644 index 0000000..532161f --- /dev/null +++ b/lib/installers/sublime_text.sh @@ -0,0 +1,105 @@ +#!/bin/bash +# Sublime Text installer functions +# +# Debian/Ubuntu, Fedora, RHEL clones and openSUSE use Sublime HQ's own signed +# repository (download.sublimetext.com), so updates arrive with the system; the +# signing key is checked against the pinned fingerprint before it is trusted. +# Arch has no vendor package this tool can use: it comes from the AUR, which is +# only used when AUR_ENABLED=true. Sublime publishes no Alpine package, and +# Rocky/Alma 9 and 10 cannot import its RPM key (a SHA-1 signature their RPM +# refuses), so it is not offered there. + +# --- Sublime Text --- + +_SUBL_KEY_URL="https://download.sublimetext.com/sublimehq-pub.gpg" +# Primary fingerprint of the Sublime HQ signing key. +_SUBL_KEY_FPR="1EDDE2CDFC025D17F6DA9EC0ADAE6AD28A8F901A" +_SUBL_APT_KEYRING="/usr/share/keyrings/sublimehq-archive.gpg" +_SUBL_APT_LIST="/etc/apt/sources.list.d/sublime-text.list" +_SUBL_REPO_FILE="/etc/yum.repos.d/sublime-text.repo" + +check_sublime_text() { _check_standard subl sublime-text "" sublime-text-4 subl; } + +# x86_64 or aarch64, the two names the vendor repository uses. +_subl_arch() { + case "$(uname -m)" in + x86_64|aarch64) uname -m ;; + *) error "Sublime Text publishes no package for the $(uname -m) CPU."; return 1 ;; + esac +} + +install_sublime_text() { + info "Installing Sublime Text..." + ensure_tools + local arch + case "$DISTRO_FAMILY" in + debian) + _add_apt_repo "$_SUBL_KEY_URL" "$_SUBL_APT_KEYRING" \ + "deb [signed-by=${_SUBL_APT_KEYRING}] https://download.sublimetext.com/ apt/stable/" \ + "$_SUBL_APT_LIST" "$_SUBL_KEY_FPR" || return 1 + pkg_install sublime-text + ;; + fedora|rhel) + arch=$(_subl_arch) || return 1 + rpm_import_key_checked "$_SUBL_KEY_URL" "$_SUBL_KEY_FPR" || return 1 + printf '%s\n' \ + '[sublime-text]' \ + 'name=Sublime Text - stable' \ + "baseurl=https://download.sublimetext.com/rpm/stable/${arch}" \ + 'enabled=1' \ + 'gpgcheck=1' \ + "gpgkey=${_SUBL_KEY_URL}" | sudo tee "$_SUBL_REPO_FILE" >/dev/null + pkg_install sublime-text + ;; + suse) + arch=$(_subl_arch) || return 1 + rpm_import_key_checked "$_SUBL_KEY_URL" "$_SUBL_KEY_FPR" || return 1 + sudo zypper --non-interactive removerepo sublime-text &>/dev/null || true + sudo zypper --non-interactive addrepo --refresh \ + "https://download.sublimetext.com/rpm/stable/${arch}/sublime-text.repo" || return 1 + sudo zypper --non-interactive --gpg-auto-import-keys refresh sublime-text || return 1 + pkg_install sublime-text + ;; + arch) + repo_or_aur sublime-text-4 || return 1 + ;; + *) + error "Sublime Text publishes no package for ${DISTRO_NAME}." + return 1 + ;; + esac + info "Sublime Text installed." +} + +# Settings, packages and the licence in ~/.config/sublime-text are kept. +uninstall_sublime_text() { + info "Uninstalling Sublime Text..." + case "$DISTRO_FAMILY" in + debian) + pkg_remove sublime-text + sudo rm -f "$_SUBL_APT_LIST" "$_SUBL_APT_KEYRING" + ;; + fedora|rhel) + pkg_remove sublime-text + sudo rm -f "$_SUBL_REPO_FILE" + ;; + suse) + pkg_remove sublime-text + sudo zypper --non-interactive removerepo sublime-text 2>/dev/null || true + ;; + arch) + aur_remove sublime-text-4 2>/dev/null || pkg_remove sublime-text-4 + ;; + esac +} + +update_sublime_text() { + info "Updating Sublime Text..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur sublime-text-4 + else + pkg_upgrade sublime-text + fi +} + +get_version_sublime_text() { _ver_from_pkg sublime-text || _ver_from_pkg sublime-text-4 || echo ""; } diff --git a/lib/installers/tldr.sh b/lib/installers/tldr.sh new file mode 100644 index 0000000..cb5154f --- /dev/null +++ b/lib/installers/tldr.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# tldr installer functions +# +# Short, example-first help pages for shell commands: `tldr tar`. Installs the +# command-line client the distro carries, in this order: tealdeer (Debian 13 and +# 12, Ubuntu 26.04, Arch, openSUSE Tumbleweed), tlrc (openSUSE Leap), tldr (the +# Python client: Fedora, Rocky/Alma through EPEL, Ubuntu 22.04). All of them +# provide the `tldr` command. Alpine has none, so it is not offered there. + +# --- tldr --- + +_TLDR_CANDIDATES=(tealdeer tlrc tldr) + +# The client package this system's repositories carry; prints nothing if none. +_tldr_package() { + local p + for p in "${_TLDR_CANDIDATES[@]}"; do + pkg_in_repo "$p" && { printf '%s\n' "$p"; return 0; } + done + return 1 +} + +# The client package that is installed right now. +_tldr_installed_package() { + local p + for p in "${_TLDR_CANDIDATES[@]}"; do + pkg_check_installed "$p" && { printf '%s\n' "$p"; return 0; } + done + return 1 +} + +check_tldr() { _tldr_installed_package >/dev/null; } + +install_tldr() { + info "Installing tldr..." + pkg_refresh + ensure_epel + local pkg + pkg=$(_tldr_package) || { error "No tldr client is in the ${DISTRO_NAME:-system} repositories."; return 1; } + pkg_install "$pkg" || return 1 + info "tldr installed (package ${pkg}). Try: tldr tar" +} + +uninstall_tldr() { + info "Uninstalling tldr..." + local pkg + pkg=$(_tldr_installed_package) || return 0 + pkg_remove "$pkg" +} + +update_tldr() { + info "Updating tldr..." + local pkg + pkg=$(_tldr_installed_package) || return 1 + pkg_upgrade "$pkg" +} + +get_version_tldr() { + local pkg + pkg=$(_tldr_installed_package) || { echo ""; return 0; } + _ver_from_pkg "$pkg" || echo "" +} diff --git a/lib/installers/vim.sh b/lib/installers/vim.sh new file mode 100644 index 0000000..2315873 --- /dev/null +++ b/lib/installers/vim.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Vim installer functions +# +# The classic modal editor. In every supported distro's repositories: vim on +# Debian, Ubuntu, Arch, openSUSE and Alpine; vim-enhanced on Fedora and RHEL +# clones (their plain vim package is the minimal build). + +# --- Vim --- + +_vim_pkg() { + case "$DISTRO_FAMILY" in + fedora|rhel) echo vim-enhanced ;; + *) echo vim ;; + esac +} + +check_vim() { _check_standard vim "$(_vim_pkg)" ""; } + +install_vim() { + info "Installing Vim..." + pkg_install "$(_vim_pkg)" || return 1 + info "Vim installed." +} + +uninstall_vim() { + info "Uninstalling Vim..." + pkg_remove "$(_vim_pkg)" +} + +update_vim() { + info "Updating Vim..." + pkg_upgrade "$(_vim_pkg)" +} + +get_version_vim() { _ver_from_pkg "$(_vim_pkg)" || _ver_from_cmd vim || echo ""; } diff --git a/lib/installers/virtualbox.sh b/lib/installers/virtualbox.sh new file mode 100644 index 0000000..006b41d --- /dev/null +++ b/lib/installers/virtualbox.sh @@ -0,0 +1,153 @@ +#!/bin/bash +# VirtualBox installer functions +# +# Ubuntu, Arch and openSUSE: the distro's own virtualbox package (on Arch with +# the DKMS host modules and headers for each installed kernel). Debian, Fedora +# and RHEL clones have none, so those use Oracle's own signed repository +# (download.virtualbox.org), the signing key checked against the pinned +# fingerprint; Oracle publishes it for Debian 12 and 13, Fedora up to 44 and +# EL 8 to 10, and the installer says so on a release it does not cover. The +# kernel module is built for the running kernel, which needs the kernel +# headers; with Secure Boot on it must be signed before it loads. The +# installing user joins vboxusers (log out and in). Not offered on Alpine. + +# --- VirtualBox --- + +_VB_KEY_URL="https://www.virtualbox.org/download/oracle_vbox_2016.asc" +# Primary fingerprint of Oracle's 2016 VirtualBox signing key. +_VB_KEY_FPR="B9F8D658297AF3EFC18D5CDFA2F683C52980AECF" +_VB_APT_KEYRING="/usr/share/keyrings/oracle-virtualbox-2016.gpg" +_VB_APT_LIST="/etc/apt/sources.list.d/virtualbox.list" +_VB_REPO_FILE="/etc/yum.repos.d/virtualbox.repo" + +check_virtualbox() { _check_standard VBoxManage virtualbox "" virtualbox VBoxManage || _have_cmd virtualbox; } + +# Newest versioned Oracle package name (virtualbox-7.2 / VirtualBox-7.2). +_vb_vendor_package() { + case "$DISTRO_FAMILY" in + debian) apt-cache pkgnames virtualbox- 2>/dev/null | grep -E '^virtualbox-[0-9]+\.[0-9]+$' | sort -V | tail -1 ;; + *) "$PKG_MGR" -q repoquery --qf '%{name}\n' 'VirtualBox-*' 2>/dev/null | grep -E '^VirtualBox-[0-9]+\.[0-9]+$' | sort -V | tail -1 ;; + esac +} + +# Oracle's repository exists for this release? $1 is the URL of its directory. +_vb_url_exists() { curl -fsSL --max-time 20 -o /dev/null -I "$1"; } + +_vb_install_debian() { + local codename + codename=$(. /etc/os-release; printf '%s' "${VERSION_CODENAME:-}") + if pkg_in_repo virtualbox; then + pkg_install virtualbox || return 1 + return 0 + fi + if [[ "$DISTRO_ID" != "debian" ]] || ! _vb_url_exists "https://download.virtualbox.org/virtualbox/debian/dists/${codename}/"; then + error "VirtualBox is not in the ${DISTRO_NAME} repositories and Oracle publishes no repository for it. Nothing was changed." + return 1 + fi + ensure_tools + _add_apt_repo "$_VB_KEY_URL" "$_VB_APT_KEYRING" \ + "deb [arch=$(dpkg --print-architecture) signed-by=${_VB_APT_KEYRING}] https://download.virtualbox.org/virtualbox/debian ${codename} contrib" \ + "$_VB_APT_LIST" "$_VB_KEY_FPR" || return 1 + local pkg + pkg=$(_vb_vendor_package) + [[ -n "$pkg" ]] || { error "Oracle's repository lists no VirtualBox package."; return 1; } + pkg_install dkms "linux-headers-$(uname -r)" 2>/dev/null || pkg_install dkms || true + pkg_install "$pkg" +} + +_vb_install_rpm() { + local osdir rel + if [[ "$DISTRO_FAMILY" == "fedora" ]]; then + osdir=fedora; rel=${DISTRO_VERSION_ID%%.*} + else + osdir=el; rel=${DISTRO_VERSION_ID%%.*} + fi + if ! _vb_url_exists "https://download.virtualbox.org/virtualbox/rpm/${osdir}/${rel}/"; then + error "Oracle publishes no VirtualBox repository for ${DISTRO_NAME} ${DISTRO_VERSION_ID}. Nothing was changed." + return 1 + fi + ensure_tools + ensure_epel + rpm_import_key_checked "$_VB_KEY_URL" "$_VB_KEY_FPR" || return 1 + local tmp + tmp=$(mktemp) || return 1 + curl -fsSL --max-time 30 "https://download.virtualbox.org/virtualbox/rpm/${osdir}/virtualbox.repo" -o "$tmp" \ + || { rm -f "$tmp"; error "Could not download Oracle's repository file."; return 1; } + sudo install -m 0644 "$tmp" "$_VB_REPO_FILE" + rm -f "$tmp" + pkg_refresh + local pkg + pkg=$(_vb_vendor_package) + [[ -n "$pkg" ]] || { error "Oracle's repository lists no VirtualBox package."; return 1; } + pkg_install gcc make perl bzip2 elfutils-libelf-devel "kernel-devel-$(uname -r)" 2>/dev/null \ + || pkg_install gcc make perl bzip2 elfutils-libelf-devel kernel-devel || true + pkg_install "$pkg" || return 1 + sudo /sbin/vboxconfig 2>/dev/null || warn "The VirtualBox kernel module was not built now; run 'sudo /sbin/vboxconfig' after installing kernel-devel for the running kernel." +} + +_vb_install_arch() { + local pkgs=(virtualbox virtualbox-host-dkms) k + # Headers for every installed kernel, so DKMS can build for each of them. + while IFS= read -r k; do + arch_repo_has "${k}-headers" && pkgs+=("${k}-headers") + done < <(pacman -Qqs '^linux[a-z0-9-]*$' 2>/dev/null | grep -Ev -- '-(headers|docs|api-headers)$|^linux-firmware|^linux-api') + pkg_install "${pkgs[@]}" +} + +install_virtualbox() { + info "Installing VirtualBox..." + pkg_refresh + case "$DISTRO_FAMILY" in + debian) _vb_install_debian || return 1 ;; + fedora|rhel) _vb_install_rpm || return 1 ;; + arch) _vb_install_arch || return 1 ;; + suse) pkg_install virtualbox || return 1 ;; + *) error "VirtualBox is not offered on ${DISTRO_NAME}."; return 1 ;; + esac + getent group vboxusers >/dev/null 2>&1 && sudo usermod -aG vboxusers "${SUDO_USER:-$USER}" 2>/dev/null \ + && info "Added ${SUDO_USER:-$USER} to the vboxusers group; log out and back in for USB access." + info "VirtualBox installed. With Secure Boot on, the kernel module must be signed before it loads." +} + +# Virtual machines and settings under ~/VirtualBox VMs and ~/.config/VirtualBox are kept. +uninstall_virtualbox() { + info "Uninstalling VirtualBox..." + case "$DISTRO_FAMILY" in + debian) + local pkgs + pkgs=$(dpkg -l 'virtualbox*' 2>/dev/null | awk '/^ii/{print $2}' | tr '\n' ' ') + # shellcheck disable=SC2086 + [[ -n "$pkgs" ]] && pkg_remove $pkgs + sudo rm -f "$_VB_APT_LIST" "$_VB_APT_KEYRING" + ;; + fedora|rhel) + local pkgs + pkgs=$(rpm -qa --qf '%{NAME}\n' 'VirtualBox-*' 2>/dev/null | tr '\n' ' ') + # shellcheck disable=SC2086 + [[ -n "$pkgs" ]] && pkg_remove $pkgs + sudo rm -f "$_VB_REPO_FILE" + ;; + arch) pkg_remove virtualbox virtualbox-host-dkms ;; + suse) pkg_remove virtualbox ;; + esac +} + +update_virtualbox() { + info "Updating VirtualBox..." + case "$DISTRO_FAMILY" in + debian) + local pkg + pkg=$(dpkg -l 'virtualbox*' 2>/dev/null | awk '/^ii/{print $2}' | head -1) + [[ -n "$pkg" ]] && pkg_upgrade "$pkg" + ;; + fedora|rhel) + local pkg + pkg=$(rpm -qa --qf '%{NAME}\n' 'VirtualBox-*' 2>/dev/null | head -1) + [[ -n "$pkg" ]] && pkg_upgrade "$pkg" + ;; + arch) pkg_upgrade virtualbox ;; + suse) pkg_upgrade virtualbox ;; + esac +} + +get_version_virtualbox() { _ver_from_cmd VBoxManage || echo ""; } diff --git a/lib/installers/wireshark.sh b/lib/installers/wireshark.sh new file mode 100644 index 0000000..9691036 --- /dev/null +++ b/lib/installers/wireshark.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# Wireshark installer functions +# +# Packet analyser. Debian/Ubuntu: wireshark, with the question about letting +# non-root users capture answered yes; Fedora, RHEL clones, Arch: the Qt +# window and the command-line tools; openSUSE and Alpine: wireshark. The +# installing user joins the wireshark group so they can capture without root; +# that applies after logging out and in. + +# --- Wireshark --- + +_ws_pkgs() { + case "$DISTRO_FAMILY" in + fedora|rhel) echo "wireshark wireshark-cli" ;; + arch) echo "wireshark-qt wireshark-cli" ;; + *) echo "wireshark" ;; + esac +} + +check_wireshark() { _check_standard wireshark "$(_ws_pkgs | cut -d" " -f1)" ""; } + +install_wireshark() { + info "Installing Wireshark..." + local pkgs + pkgs=$(_ws_pkgs) + if [[ "$DISTRO_FAMILY" == "debian" ]]; then + # Without this the package asks on a terminal; yes lets the wireshark + # group capture without root. + echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections 2>/dev/null || true + fi + # shellcheck disable=SC2086 # the list is intentionally split + pkg_install $pkgs || return 1 + if getent group wireshark >/dev/null 2>&1; then + sudo usermod -aG wireshark "${SUDO_USER:-$USER}" 2>/dev/null \ + && info "Added ${SUDO_USER:-$USER} to the wireshark group; log out and back in to capture without root." + fi + info "Wireshark installed." +} + +uninstall_wireshark() { + info "Uninstalling Wireshark..." + local pkgs + pkgs=$(_ws_pkgs) + # shellcheck disable=SC2086 + pkg_remove $pkgs +} + +update_wireshark() { + info "Updating Wireshark..." + local pkgs + pkgs=$(_ws_pkgs) + # shellcheck disable=SC2086 + pkg_upgrade $pkgs +} + +get_version_wireshark() { _ver_from_pkg "$(_ws_pkgs | cut -d" " -f1)" || echo ""; } diff --git a/lib/installers/zed.sh b/lib/installers/zed.sh new file mode 100644 index 0000000..8189df6 --- /dev/null +++ b/lib/installers/zed.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Zed installer functions +# +# Fast code editor with built-in collaboration and AI. The distro package on +# Arch and openSUSE Tumbleweed (it installs the zeditor command); everywhere +# else Zed's own Flathub listing. Not offered on Alpine. + +# --- Zed --- + +check_zed() { _check_standard "" zed dev.zed.Zed; } + +install_zed() { + info "Installing Zed..." + native_or_flatpak_install dev.zed.Zed zed || return 1 + info "Zed installed." +} + +uninstall_zed() { + info "Uninstalling Zed..." + native_or_flatpak_uninstall dev.zed.Zed zed +} + +update_zed() { + info "Updating Zed..." + native_or_flatpak_update dev.zed.Zed zed +} + +get_version_zed() { native_or_flatpak_version dev.zed.Zed zed; } diff --git a/lib/installers/zoxide.sh b/lib/installers/zoxide.sh new file mode 100644 index 0000000..a1754a0 --- /dev/null +++ b/lib/installers/zoxide.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# zoxide installer functions +# +# Smarter cd: remembers the folders you use and jumps to them with z. The distro package where the repositories have one (every release except Rocky/Alma 10); otherwise the GitHub release, SHA-256 checked, in /usr/local/bin. Loaded from ~/.bashrc (and ~/.zshrc when it exists). + +# --- zoxide --- + +_zoxide_REPO="ajeetdsouza/zoxide" +_zoxide_RE='zoxide-[0-9.]+-@GNU@-unknown-linux-musl\.tar\.gz' + +# Latest upstream version, for System Updates. +_zoxide_latest_version() { github_latest_tag "$_zoxide_REPO" | sed 's/^v//'; } + +check_zoxide() { _check_standard zoxide zoxide "" || [[ -x /usr/local/bin/zoxide ]]; } + +install_zoxide() { + info "Installing zoxide..." + native_or_github_install zoxide "$_zoxide_REPO" "$_zoxide_RE" zoxide || return 1 + # shellcheck disable=SC2016 # the rc file, not this script, expands these + shell_init_setup zoxide \ + 'if command -v zoxide >/dev/null 2>&1; then eval "$(zoxide init bash)"; fi' \ + 'if command -v zoxide >/dev/null 2>&1; then eval "$(zoxide init zsh)"; fi' + info "zoxide installed. Open a new terminal to use it." +} + +uninstall_zoxide() { + info "Uninstalling zoxide..." + shell_init_remove zoxide + native_or_github_uninstall zoxide zoxide +} + +update_zoxide() { + info "Updating zoxide..." + native_or_github_update zoxide "$_zoxide_REPO" "$_zoxide_RE" zoxide zoxide "$(get_version_zoxide)" +} + +get_version_zoxide() { _ver_from_pkg zoxide || _ver_from_cmd zoxide --version || echo ""; } diff --git a/lib/pkg_manager.sh b/lib/pkg_manager.sh index b1f8de5..b4a95bd 100644 --- a/lib/pkg_manager.sh +++ b/lib/pkg_manager.sh @@ -2086,6 +2086,18 @@ _ver_from_snap() { # APT REPOSITORY HELPER # ============================================================================ +# True when the key file $1 (armored or binary) holds a key with fingerprint $2. +# A throwaway GNUPGHOME so reading the key never creates ~/.gnupg. Used by +# _add_apt_repo and rpm_import_key_checked. +gpg_key_has_fingerprint() { + local keyfile="$1" want="$2" home fprs + home=$(mktemp -d) + fprs=$(GNUPGHOME="$home" gpg --show-keys --with-colons "$keyfile" 2>/dev/null | + awk -F: '$1 == "fpr" { print $10 }') + rm -rf "$home" + grep -qx "$want" <<< "$fprs" +} + # Add an APT repository with a GPG keyring. # Usage: _add_apt_repo KEY_URL KEYRING_PATH SOURCES_LINE SOURCES_LIST_PATH # KEY_URL — URL to the GPG public key @@ -2115,18 +2127,10 @@ _add_apt_repo() { error "Failed to download GPG key from: $key_url" return 1 fi - if [[ -n "$key_fingerprint" ]]; then - # Throwaway GNUPGHOME so reading the key never creates ~/.gnupg. - local _gnupghome _fprs - _gnupghome=$(mktemp -d) - _fprs=$(GNUPGHOME="$_gnupghome" gpg --show-keys --with-colons "$_tmpkey" 2>/dev/null | - awk -F: '$1 == "fpr" { print $10 }') - rm -rf "$_gnupghome" - if ! grep -qx "$key_fingerprint" <<< "$_fprs"; then - rm -f "$_tmpkey" - error "GPG key from $key_url does not match fingerprint $key_fingerprint" - return 1 - fi + if [[ -n "$key_fingerprint" ]] && ! gpg_key_has_fingerprint "$_tmpkey" "$key_fingerprint"; then + rm -f "$_tmpkey" + error "GPG key from $key_url does not match fingerprint $key_fingerprint" + return 1 fi if grep -q "BEGIN PGP PUBLIC KEY BLOCK" "$_tmpkey" 2>/dev/null; then gpg --dearmor < "$_tmpkey" | sudo tee "$keyring_path" > /dev/null diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 47f7480..2e17afb 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -3030,6 +3030,7 @@ echo "" echo "=== Pay Respects Tests ===" # Only defines functions, so sourcing is side-effect free. +source "${SCRIPT_DIR}/lib/installers/_shared.sh" # shell_rc_block_remove, used by _payr_remove_rc source "${SCRIPT_DIR}/lib/installers/pay_respects.sh" # Upstream's real release shape: a rolling "nightly" release sits at the top of @@ -4735,7 +4736,7 @@ test_hermes_agent_registered() { local fn gaps=0 grep -qE '^register_utility "Hermes Agent"[[:space:]]+install_hermes_agent ' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '^UTILITY_CATEGORY\["Hermes Agent"\]="Development"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 - grep -q '^UTILITY_SUBCATEGORY\["Hermes Agent"\]="IDEs & Editors"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + grep -q '^UTILITY_SUBCATEGORY\["Hermes Agent"\]="AI Tools"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '^UTILITY_DESCRIPTION\["Hermes Agent"\]=' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '"Hermes Agent=\$HOME/.hermes/hermes-agent"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 for fn in install check uninstall update get_version; do @@ -4778,7 +4779,7 @@ test_codex_registered() { local fn gaps=0 grep -qE '^register_utility "Codex"[[:space:]]+install_codex ' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '^UTILITY_CATEGORY\["Codex"\]="Development"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 - grep -q '^UTILITY_SUBCATEGORY\["Codex"\]="IDEs & Editors"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + grep -q '^UTILITY_SUBCATEGORY\["Codex"\]="AI Tools"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '^UTILITY_DESCRIPTION\["Codex"\]=' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 for fn in install check uninstall update get_version; do grep -q "^${fn}_codex()" "${SCRIPT_DIR}/lib/installers/codex.sh" || gaps=1 @@ -4813,7 +4814,7 @@ test_lm_studio_registered() { local fn gaps=0 grep -qE '^register_utility "LM Studio"[[:space:]]+install_lm_studio ' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '^UTILITY_CATEGORY\["LM Studio"\]="Development"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 - grep -q '^UTILITY_SUBCATEGORY\["LM Studio"\]="IDEs & Editors"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + grep -q '^UTILITY_SUBCATEGORY\["LM Studio"\]="AI Tools"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '^UTILITY_DESCRIPTION\["LM Studio"\]=' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '"LM Studio=\$_LMS_APPIMAGE"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 grep -q '"LM Studio=_lms_latest_version"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 @@ -5834,6 +5835,334 @@ test_tlp_and_auto_cpufreq_exclude_each_other test_auto_cpufreq_version_and_update test_cups_service_name +# ---------------------------------------------------------------------------- +echo "" +echo "=== Development apps and shell tools (#91) ===" + +_DEV_APPS=( + "Emacs|emacs|Development" "eza|eza|System Tools" "fzf|fzf|System Tools" "Helix|helix|Development" + "Helm|helm|Development" "Java JDK|java_jdk|Development" "k3s|k3s|Development" + "lazygit|lazygit|Development" "minikube|minikube|Development" "nmap|nmap|Development" + "Ollama|ollama|Development" "PHP|php|Development" "Podman Desktop|podman_desktop|Development" + "Python|python|Development" "Ruby|ruby|Development" "starship|starship|System Tools" + "Sublime Text|sublime_text|Development" "tldr|tldr|System Tools" "Vim|vim|Development" + "VirtualBox|virtualbox|Development" "Wireshark|wireshark|Development" "Zed|zed|Development" + "zoxide|zoxide|System Tools" +) + +test_dev_apps_registered() { + local entry name slug cat fn gaps=0 + for entry in "${_DEV_APPS[@]}"; do + IFS='|' read -r name slug cat <<<"$entry" + grep -qE "^[[:space:]]*register_utility \"${name}\"[[:space:]]+install_${slug} " "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing register: $name"; } + grep -qF "UTILITY_CATEGORY[\"${name}\"]=\"${cat}\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing category: $name"; } + grep -qF "UTILITY_DESCRIPTION[\"${name}\"]=" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing description: $name"; } + for fn in install check uninstall update get_version; do + grep -q "^${fn}_${slug}()" "${SCRIPT_DIR}/lib/installers/${slug}.sh" 2>/dev/null || { gaps=1; echo " missing ${fn}_${slug}"; } + done + grep -qxF " '${name}'" "${SCRIPT_DIR}/completions/_linux_util" || { gaps=1; echo " missing zsh completion: $name"; } + grep -qxF "${name}" "${SCRIPT_DIR}/completions/linux_util.bash" || { gaps=1; echo " missing bash completion: $name"; } + done + assert_eq "0" "$gaps" "The 23 new Development apps and shell tools are registered with category, description, completions and all five functions" +} + +test_dev_subcategories() { + local entry name sub gaps=0 + for entry in "Vim|IDEs & Editors" "Emacs|IDEs & Editors" "Helix|IDEs & Editors" "Sublime Text|IDEs & Editors" "Zed|IDEs & Editors" "Neovim|IDEs & Editors" "Visual Studio Code|IDEs & Editors" \ + "Claude Code|AI Tools" "Claude Desktop|AI Tools" "Codex|AI Tools" "Hermes Agent|AI Tools" "LM Studio|AI Tools" "Ollama|AI Tools" \ + "Python|Languages & Runtimes" "Java JDK|Languages & Runtimes" "PHP|Languages & Runtimes" "Ruby|Languages & Runtimes" "Go SDK|Languages & Runtimes" "Node.js|Languages & Runtimes" "Rustup|Languages & Runtimes" "pyenv|Languages & Runtimes" "NVM|Languages & Runtimes" \ + "GitHub CLI|Git" "lazygit|Git" \ + "Docker|Containers & Kubernetes" "Podman|Containers & Kubernetes" "Podman Desktop|Containers & Kubernetes" "kubectl|Containers & Kubernetes" "k9s|Containers & Kubernetes" "Helm|Containers & Kubernetes" "minikube|Containers & Kubernetes" "k3s|Containers & Kubernetes" \ + "VirtualBox|Virtualization" "Virt-Manager|Virtualization" "Firecracker|Virtualization" \ + "Wireshark|Network & Security" "nmap|Network & Security" \ + "fzf|Shell Tools" "eza|Shell Tools" "zoxide|Shell Tools" "starship|Shell Tools" "tldr|Shell Tools" \ + "Distrobox|Distrobox"; do + IFS='|' read -r name sub <<<"$entry" + grep -qF "UTILITY_SUBCATEGORY[\"${name}\"]=\"${sub}\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " ${name} not in ${sub}"; } + done + grep -qF 'SUBCATEGORY_ORDER["Development"]="IDEs & Editors|AI Tools|Languages & Runtimes|Git|Containers & Kubernetes|Virtualization|Network & Security|Distrobox"' "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " no folder order"; } + assert_eq "0" "$gaps" "Development apps are sorted into IDEs & Editors, AI Tools, Languages & Runtimes, Git, Containers & Kubernetes, Virtualization and Network & Security" +} + +test_dev_upstream_marks() { + local f="${SCRIPT_DIR}/lib/installers.sh" gaps=0 n + grep -qF '"Sublime Text=sublime-text-4"' "$f" || { gaps=1; echo " Sublime Text not AUR-only on Arch"; } + for n in Helix Helm lazygit eza zoxide starship minikube k3s Ollama; do + grep -qE "\"${n}=[^\"]+\"" "$f" || { gaps=1; echo " $n has no upstream marker"; } + grep -qE "\"${n}=_[a-z0-9]+_latest_version\"" "$f" || { gaps=1; echo " $n has no latest-version lookup"; } + done + local line + line=$(grep -n 'register_utility "Sublime Text"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF -- '-lt 9' || { gaps=1; echo " Sublime Text not held back on Rocky/Alma 9 and 10"; } + line=$(grep -n 'register_utility "nmap"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF 'opensuse-leap' || { gaps=1; echo " nmap not held back on openSUSE Leap"; } + assert_eq "0" "$gaps" "Upstream-installed apps are marked so System Updates refreshes them; Sublime Text is AUR-only on Arch; Sublime Text and nmap are held back where they cannot install" +} + +test_dev_alpine_rows() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + have=""; for row in "${_ALPINE_TABLE[@]}"; do have+=" ${row%%|*}"; done + for n in Vim Emacs Helix fzf eza zoxide starship lazygit Helm k3s Python "Java JDK" PHP Ruby Wireshark nmap Ollama; do + [[ " $have " == *" $n "* ]] || printf 'missing:%s ' "$n" + done + for n in "Sublime Text" Zed tldr "Podman Desktop" minikube VirtualBox; do + [[ " $have " == *" $n "* ]] && printf 'unexpected:%s ' "$n" + done + printf 'k3s=%s ollama=%s ' "$(_alpine_field k3s 4)" "$(_alpine_field Ollama 4)" + echo done + ) + assert_eq "k3s=k3s ollama=ollama done" "$out" "Alpine offers the apps its repositories carry, with their services, and hides the rest" +} + +# --- Verified GitHub downloads --- +_GH_FIXTURE='{"tag_name": "v1.2.3","assets": [ + {"name": "tool_1.2.3_linux_x86_64.tar.gz","uploader": {"login": "bot"},"size": 9,"digest": "sha256:'"$(printf 'a%.0s' {1..64})"'","browser_download_url": "https://x/tool_1.2.3_linux_x86_64.tar.gz"}, + {"name": "tool_1.2.3_linux_arm64.tar.gz","uploader": {"login": "bot"},"size": 9,"browser_download_url": "https://x/tool_1.2.3_linux_arm64.tar.gz"}, + {"name": "tool_1.2.3_darwin.tar.gz","uploader": {"login": "bot"},"digest": "sha256:'"$(printf 'b%.0s' {1..64})"'","browser_download_url": "https://x/tool_1.2.3_darwin.tar.gz"}]}' + +test_github_asset_info() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + curl() { printf '%s' "$_GH_FIXTURE"; } + github_asset_info o/r 'tool_[0-9.]+_linux_x86_64\.tar\.gz' + echo "tag=$(github_latest_tag o/r)" + github_asset_info o/r 'tool_[0-9.]+_linux_arm64\.tar\.gz' || echo "arm64-none" + github_asset_info o/r 'tool_[0-9.]+_darwin\.tar\.gz' + ) + assert_contains "$out" "^tool_1.2.3_linux_x86_64.tar.gz https://x/tool_1.2.3_linux_x86_64.tar.gz a{64}$" "github_asset_info returns the file's own URL and digest" + assert_contains "$out" "^tag=v1.2.3$" "github_latest_tag reads the release tag" + assert_contains "$out" "^arm64-none$" "a file with no published digest is never returned, and no other file's digest is borrowed" + assert_contains "$out" "^tool_1.2.3_darwin.tar.gz https://x/tool_1.2.3_darwin.tar.gz b{64}$" "each file keeps its own digest" +} + +test_github_asset_download_checks_digest() { + local out good bad + good=$(printf 'a%.0s' {1..64}) + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + error() { printf 'ERR:%s ' "$*"; }; info() { :; } + verify_sha256() { [[ "$2" == "$_want" ]]; } + _gh_release_json() { return 0; } + github_asset_info() { echo "f.tar.gz https://x/f.tar.gz $good"; } + curl() { while [[ $# -gt 0 ]]; do [[ "$1" == -o ]] && echo data > "$2"; shift; done; } + d=$(mktemp -d) + _want="$good"; r=$(github_asset_download o/r 'f\\.tar\\.gz' "$d") && echo "ok:${r##*/}" + _want="$bad"; github_asset_download o/r 'f\\.tar\\.gz' "$d" >/dev/null || echo "mismatch-refused" + github_asset_info() { return 1; } + github_asset_download o/r 'f\\.tar\\.gz' "$d" >/dev/null || echo "no-digest-refused" + rm -rf "$d" + ) + assert_contains "$out" "ok:f.tar.gz" "github_asset_download returns the file when the digest matches" + assert_contains "$out" "mismatch-refused" "github_asset_download refuses a file whose digest differs" + assert_contains "$out" "no-digest-refused" "github_asset_download refuses a release file with no published digest" +} + +# A rate-limit answer from GitHub is not a release, and the message says so. +test_github_rate_limit_message() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + error() { printf 'ERR:%s' "$*"; } + curl() { printf '{"message": "API rate limit exceeded for 1.2.3.4."}'; } + github_asset_download o/r 'f' "$(mktemp -d)" || printf ' rc=1' + github_latest_tag o/r || printf ' no-tag' + ) + assert_contains "$out" "ERR:Could not read the latest o/r release from GitHub \(offline, or its rate limit is used up" "a GitHub rate-limit answer is reported as such, not as a missing file" + assert_contains "$out" "rc=1 no-tag$" "a rate-limit answer yields no release tag" +} + +test_upstream_arch_and_regex() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + error() { :; } + uname() { echo "$_m"; } + _m=x86_64; printf '%s,' "$(upstream_arch gnu)" "$(upstream_arch go)" "$(_upstream_expand_regex 'a_@GOX@_@GNU@_@GO@')" + _m=aarch64; printf '%s,' "$(upstream_arch gnu)" "$(upstream_arch go)" "$(_upstream_expand_regex 'a_@GOX@_@GNU@_@GO@')" + _m=riscv64; upstream_arch go || printf 'none' + ) + assert_eq "x86_64,amd64,a_x86_64_x86_64_amd64,aarch64,arm64,a_arm64_aarch64_arm64,none" "$out" "upstream_arch maps the CPU to each upstream naming style and refuses unknown CPUs" +} + +# --- Shell profile blocks --- +test_shell_rc_blocks() { + local out d + d=$(mktemp -d) + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + info() { :; } + export HOME="$d" + printf 'export A=1\n' > "$d/.bashrc" + shell_init_setup tool 'eval "$(tool init bash)"' 'eval "$(tool init zsh)"' + shell_init_setup tool 'eval "$(tool init bash)"' 'eval "$(tool init zsh)"' + printf 'bash-blocks=%s zsh-file=%s ' "$(grep -c 'tool init bash' "$d/.bashrc")" "$([[ -f "$d/.zshrc" ]] && echo yes || echo no)" + printf 'export Z=1\n' > "$d/.zshrc" + shell_init_setup tool 'eval "$(tool init bash)"' 'eval "$(tool init zsh)"' + printf 'zsh-blocks=%s ' "$(grep -c 'tool init zsh' "$d/.zshrc")" + shell_init_remove tool + printf 'after-remove=%s,%s ' "$(grep -c 'tool init' "$d/.bashrc")" "$(grep -c 'tool init' "$d/.zshrc")" + printf 'kept=%s' "$(grep -c '^export' "$d/.bashrc")" + ) + rm -rf "$d" + assert_eq "bash-blocks=1 zsh-file=no zsh-blocks=1 after-remove=0,0 kept=1" "$out" "shell blocks are added once, only to an existing .zshrc, and removed leaving the rest of the file" +} + +# --- Package or upstream binary --- +_nog_run() { # $1 in-repo (y/n) + ( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + _log=$(mktemp); _inrepo="$1" + pkg_refresh() { :; }; ensure_epel() { :; }; info() { :; } + pkg_in_repo() { [[ "$_inrepo" == y ]]; } + pkg_install() { echo "pkg_install $*" >> "$_log"; } + github_binary_install() { echo "github $*" >> "$_log"; } + native_or_github_install tool o/r 're' tool + tr '\n' '|' < "$_log"; rm -f "$_log" + ) +} +test_native_or_github_install_order() { + assert_eq "pkg_install tool|" "$(_nog_run y)" "native_or_github_install uses the distro package when the repository has it" + assert_eq "github o/r re tool|" "$(_nog_run n)" "native_or_github_install uses the verified release when the repository has no such package" +} + +test_native_or_github_update_route() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + info() { :; }; error() { :; } + pkg_upgrade() { printf 'pkg_upgrade '; } + github_binary_install() { printf 'reinstall '; } + github_latest_tag() { echo v2.0.0; } + upstream_binary_present() { [[ "$UP" == y ]]; } + UP=n; native_or_github_update tool o/r re tool tool 1.0.0 + UP=y; native_or_github_update tool o/r re tool tool 1.0.0 + UP=y; native_or_github_update tool o/r re tool tool 2.0.0; printf 'rc=%s' "$?" + ) + assert_eq "pkg_upgrade reinstall rc=0" "$out" "update follows the install route: the package manager, or the release only when it is newer" +} + +# --- Choosing the package this system carries --- +test_tldr_and_java_package_choice() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/tldr.sh" + source "${SCRIPT_DIR}/lib/installers/java_jdk.sh" + pkg_in_repo() { [[ " $_have " == *" $1 "* ]]; } + _have="tealdeer tldr"; printf '%s,' "$(_tldr_package)" + _have="tlrc"; printf '%s,' "$(_tldr_package)" + _have="tldr"; printf '%s,' "$(_tldr_package)" + _have=""; _tldr_package || printf 'none,' + DISTRO_FAMILY=rhel; _have="java-17-openjdk-devel java-21-openjdk-devel"; printf '%s,' "$(_java_package)" + _have="java-25-openjdk-devel java-21-openjdk-devel"; printf '%s,' "$(_java_package)" + DISTRO_FAMILY=debian; _have="default-jdk"; printf '%s,' "$(_java_package)" + DISTRO_FAMILY=arch; _have=""; _java_package || printf 'none' + ) + assert_eq "tealdeer,tlrc,tldr,none,java-21-openjdk-devel,java-25-openjdk-devel,default-jdk,none" "$out" "tldr and the JDK pick the newest client or build the repositories carry" +} + +# --- Per-family package names --- +test_runtime_package_names() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/php.sh" + source "${SCRIPT_DIR}/lib/installers/ruby.sh" + source "${SCRIPT_DIR}/lib/installers/python.sh" + source "${SCRIPT_DIR}/lib/installers/vim.sh" + source "${SCRIPT_DIR}/lib/installers/wireshark.sh" + for f in debian fedora rhel arch suse alpine; do + DISTRO_FAMILY=$f + printf '%s: %s | %s | %s | %s | %s\n' "$f" "$(_php_pkg)" "$(_ruby_pkgs)" "$(_python_pkgs)" "$(_vim_pkg)" "$(_ws_pkgs)" + done + ) + assert_contains "$out" "^debian: php-cli \| ruby-full \| python3 python3-pip python3-venv python3-dev \| vim \| wireshark$" "Debian package names for PHP, Ruby, Python, Vim and Wireshark" + assert_contains "$out" "^rhel: php-cli \| ruby ruby-devel \| python3 python3-pip python3-devel \| vim-enhanced \| wireshark wireshark-cli$" "RHEL package names for PHP, Ruby, Python, Vim and Wireshark" + assert_contains "$out" "^arch: php \| ruby \| python python-pip \| vim \| wireshark-qt wireshark-cli$" "Arch package names for PHP, Ruby, Python, Vim and Wireshark" + assert_contains "$out" "^alpine: php84 \| ruby ruby-dev \| python3 py3-pip python3-dev \| vim \| wireshark$" "Alpine package names for PHP, Ruby, Python, Vim and Wireshark" +} + +# Uninstalling Python keeps python3 itself. +test_python_uninstall_keeps_interpreter() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/python.sh" + info() { :; }; pkg_remove() { echo "$*"; } + DISTRO_FAMILY=debian; uninstall_python + DISTRO_FAMILY=arch; uninstall_python + ) + assert_eq "python3-pip python3-venv python3-dev +python-pip" "$out" "Python uninstall removes pip, venv and headers but never python3 itself" +} + +# Helix and Helm choose the package when the repository has one. +test_helix_helm_route() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/helix.sh" + source "${SCRIPT_DIR}/lib/installers/helm.sh" + info() { :; }; error() { :; }; pkg_refresh() { :; }; ensure_epel() { :; } + pkg_in_repo() { [[ "$_in" == y ]]; } + pkg_install() { printf 'pkg(%s) ' "$*"; } + _helix_install_release() { printf 'helix-release '; } + _helm_install_release() { printf 'helm-release '; } + _in=y; install_helix; install_helm + _in=n; install_helix; install_helm + ) + assert_eq "pkg(helix) pkg(helm) helix-release helm-release " "$out" "Helix and Helm use the distro package when there is one and the verified release otherwise" +} + +# Ollama: package route starts the service; release route needs systemd. +test_ollama_routes() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/ollama.sh" + info() { :; }; error() { printf 'ERR '; }; warn() { :; }; pkg_refresh() { :; } + pkg_in_repo() { [[ "$_in" == y ]]; } + pkg_install() { printf 'pkg(%s) ' "$*"; } + svc_enable_now() { printf 'svc(%s) ' "$1"; } + has_systemd() { return 1; } + _in=y; install_ollama + _in=n; install_ollama; printf 'rc=%s' "$?" + ) + assert_eq "pkg(ollama) svc(ollama) ERR rc=1" "$out" "Ollama: the package route starts the service; the release route stops without systemd" +} + +# VirtualBox and Sublime Text refuse on releases their vendor does not cover, changing nothing. +test_virtualbox_refuses_unsupported_release() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/virtualbox.sh" + info() { :; }; error() { printf 'ERR '; }; pkg_refresh() { :; }; ensure_tools() { :; }; ensure_epel() { :; } + pkg_in_repo() { return 1; } + _vb_url_exists() { return 1; } + pkg_install() { printf 'INSTALLED '; } + _add_apt_repo() { printf 'REPO '; } + DISTRO_FAMILY=fedora; DISTRO_NAME=Fedora; DISTRO_VERSION_ID=99; install_virtualbox; printf 'f=%s ' "$?" + DISTRO_FAMILY=debian; DISTRO_NAME=Debian; DISTRO_ID=debian; install_virtualbox; printf 'd=%s' "$?" + ) + assert_eq "ERR f=1 ERR d=1" "$out" "VirtualBox stops without adding a repository or installing when Oracle has none for the release" +} + +test_dev_apps_registered +test_dev_subcategories +test_dev_upstream_marks +test_dev_alpine_rows +test_github_asset_info +test_github_asset_download_checks_digest +test_upstream_arch_and_regex +test_github_rate_limit_message +test_shell_rc_blocks +test_native_or_github_install_order +test_native_or_github_update_route +test_tldr_and_java_package_choice +test_runtime_package_names +test_python_uninstall_keeps_interpreter +test_helix_helm_route +test_ollama_routes +test_virtualbox_refuses_unsupported_release + echo "" echo "════════════════════════════════════════════════════════════════" echo "Test Results: ${_TESTS_PASSED} passed, ${_TESTS_FAILED} failed, ${_TESTS_SKIPPED} skipped" From 78379d31aca51067fc53a049b28e610af4e0faca Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 12:42:05 -0500 Subject: [PATCH 10/14] feat: add Opera, WhatsApp, Teams, Mattermost and VPN installers Add seven Internet apps (part of #91): - Browser: Opera - Messaging: WhatsApp (via ZapZap), Microsoft Teams (Teams for Linux), Mattermost - VPN: Mullvad VPN, NordVPN, OpenVPN Opera, Mullvad VPN and NordVPN install from the vendor's signed repository with the key fingerprint checked. NordVPN also enables its service and adds the user to the nordvpn group. It is hidden on Rocky/Alma 8 and 9 (glibc too old) and is AUR-only on Arch. On Alpine only OpenVPN is offered. Register the apps with category, folder and description, add shell completions and docs rows, and add unit tests (502 -> 599). --- CHANGELOG.md | 11 +++ README.md | 4 +- completions/_linux_util | 7 ++ completions/linux_util.bash | 7 ++ docs/utilities.md | 7 ++ lib/installers.sh | 35 ++++++++- lib/installers/alpine_packages.sh | 1 + lib/installers/mattermost.sh | 28 ++++++++ lib/installers/microsoft_teams.sh | 32 +++++++++ lib/installers/mullvad_vpn.sh | 93 ++++++++++++++++++++++++ lib/installers/nordvpn.sh | 112 +++++++++++++++++++++++++++++ lib/installers/openvpn.sh | 32 +++++++++ lib/installers/opera.sh | 113 ++++++++++++++++++++++++++++++ lib/installers/whatsapp.sh | 29 ++++++++ tests/test_linux_util.sh | 100 ++++++++++++++++++++++++++ 15 files changed, 608 insertions(+), 3 deletions(-) create mode 100644 lib/installers/mattermost.sh create mode 100644 lib/installers/microsoft_teams.sh create mode 100644 lib/installers/mullvad_vpn.sh create mode 100644 lib/installers/nordvpn.sh create mode 100644 lib/installers/openvpn.sh create mode 100644 lib/installers/opera.sh create mode 100644 lib/installers/whatsapp.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 45a69aa..75d2c12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,17 @@ when a release is cut. ### Added +- **7 more Internet apps** (part of #91). Browser: Opera. Messaging: WhatsApp + (ZapZap, an open-source client for WhatsApp Web, as WhatsApp has no Linux + app), Microsoft Teams (Teams for Linux, as Microsoft ended its own Linux app + in 2022) and Mattermost. VPN: Mullvad VPN, NordVPN and OpenVPN. Opera, + Mullvad VPN and NordVPN use their vendor's signed repository (key fingerprint + checked), so updates arrive with the system; OpenVPN uses the distro package; + WhatsApp, Teams and Mattermost use the distro package where there is one, else + Flathub. NordVPN also starts its service and adds you to the `nordvpn` group + (log out and in again before `nordvpn login`). Not offered: Skype (Microsoft + closed it in May 2025), NordVPN on Rocky/Alma 8 and 9 (needs a newer glibc), + and on Alpine everything except OpenVPN. - **23 more Development apps and shell tools** (part of #91). Editors: Vim, Emacs, Helix, Sublime Text and Zed. Shell tools: fzf, eza, zoxide, starship and tldr (in System Tools > Shell Tools, beside bat and ripgrep); zoxide, diff --git a/README.md b/README.md index 14e6890..42b6b9f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Unique cloners](https://img.shields.io/badge/unique%20cloners-30-brightgreen)](https://github.com/acebmxer/linux_util/graphs/traffic) [![Shell: Bash](https://img.shields.io/badge/shell-bash-4EAA25?logo=gnubash&logoColor=white)](linux_util.sh) [![Platform: Linux](https://img.shields.io/badge/platform-linux-333333?logo=linux&logoColor=white)](#supported-distributions) -[![Tests](https://img.shields.io/badge/tests-502%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Tests](https://img.shields.io/badge/tests-599%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) [![Distros tested](https://img.shields.io/badge/distros%20tested-6-informational)](#supported-distributions) [![ShellCheck](https://img.shields.io/badge/shellcheck-clean-brightgreen)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) @@ -129,7 +129,7 @@ selection rules and the profile table: [docs/menu.md](docs/menu.md). | **Disk Utilities** | GParted, Ventoy, KDiskMark, and a Btrfs toolset (Assistant, btrfsmaintenance, btrbk, duperemove) | | **Development** | Folders for IDEs & Editors (VS Code, VSCodium, Cursor, JetBrains Toolbox, Neovim, Vim, Emacs, Helix, Sublime Text, Zed), AI Tools (Claude Code, Claude Desktop, Codex, Hermes Agent, LM Studio, Ollama), Languages & Runtimes (Python, Java JDK, PHP, Ruby, Go, Node/NVM, Rust, pyenv), Git (GitHub CLI, lazygit), Containers & Kubernetes (Docker, Podman, Podman Desktop, kubectl, k9s, Helm, minikube, k3s), Virtualization (VirtualBox, Virt-Manager, Firecracker), Network & Security (Wireshark, nmap) and Distrobox, plus Terraform, OpenTofu, Ansible, DBeaver, Postman, PowerShell and Toolbx | | **Gaming** | Steam, Lutris, Heroic, Bottles, Xodus Nexus, Wine, ProtonUp-Qt, MangoHud, Gamemode, Boxflat | -| **Internet** | Browsers (Firefox, Brave, Chrome, Chromium, Vivaldi, LibreWolf, Zen, Thorium, Tor), email clients, messaging, and VPNs (ProtonVPN, PIA, Tailscale, WireGuard) | +| **Internet** | Browsers (Firefox, Brave, Chrome, Chromium, Vivaldi, Opera, LibreWolf, Zen, Thorium, Tor), email clients, messaging (Signal, Discord, Slack, Telegram, Zoom, WhatsApp, Microsoft Teams, Mattermost), and VPNs (ProtonVPN, Mullvad, NordVPN, OpenVPN, PIA, Tailscale, WireGuard) | | **Package Managers** | Flatpak, Homebrew, Nix, Snap, deb-get, Pacstall, yay, paru — added alongside the native manager, never replacing it | | **Productivity** | ArtCraft Launcher, LibreOffice, OnlyOffice, WPS, GIMP, Inkscape, Krita, Kdenlive, OBS, VLC, Multimedia Codecs, Obsidian, Joplin, Logseq, Bitwarden, 1Password, KeePassXC, Cryptomator, VeraCrypt, Nextcloud, NVIDIA PAIR, WinApps, and more: media (mpv, Kodi, Spotify), creative (Blender, Darktable, RawTherapee, Shotcut, Scribus) and documents (Calibre, Anki, Okular, Xournal++) | | **Remote Admin** | Cockpit, Enable RDP (xrdp or krdp), OpenSSH, Remmina, RustDesk, AnyDesk, Termius, Devolutions RDM, OpenRSAT | diff --git a/completions/_linux_util b/completions/_linux_util index 545690d..d9558be 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -96,13 +96,17 @@ _linux_util_utilities=( 'Mainline' 'MangoHud' 'MATE Desktop' + 'Mattermost' + 'Microsoft Teams' 'minikube' 'mpv' + 'Mullvad VPN' 'Multimedia Codecs' 'ncdu' 'NeoMutt' 'Nextcloud Desktop' 'nmap' + 'NordVPN' 'Num Lock at Boot' 'NVIDIA Drivers' 'NVIDIA PAIR' @@ -115,6 +119,8 @@ _linux_util_utilities=( 'OnlyOffice' 'OpenLogi' 'OpenSSH Server' + 'OpenVPN' + 'Opera' 'PHP' 'Podman Desktop' 'Python' @@ -167,6 +173,7 @@ _linux_util_utilities=( 'VSCodium' 'Vivaldi Browser' 'WezTerm' + 'WhatsApp' 'WinApps' 'Wine' 'WireGuard Client' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index d61a9e3..fee85c8 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -95,13 +95,17 @@ LXQt Desktop Mainline MangoHud MATE Desktop +Mattermost +Microsoft Teams minikube mpv +Mullvad VPN Multimedia Codecs ncdu NeoMutt Nextcloud Desktop nmap +NordVPN NVIDIA Drivers NVIDIA PAIR NVM @@ -113,6 +117,8 @@ Ollama OnlyOffice OpenLogi OpenSSH Server +OpenVPN +Opera PHP Podman Desktop Python @@ -166,6 +172,7 @@ Visual Studio Code VSCodium Vivaldi Browser WezTerm +WhatsApp WinApps Wine WireGuard Client diff --git a/docs/utilities.md b/docs/utilities.md index d727ece..40b9b89 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -259,7 +259,13 @@ Grouped into folders inside the Development tab: | **KMail** | KDE's email client with PGP encryption | | **LibreWolf** | Privacy-hardened Firefox fork | | **LocalSend** | Open-source AirDrop alternative — sends files and text between devices on the same network with no account or cloud; uses port 53317. Official `.deb` on Debian/Ubuntu, Flathub elsewhere *(File Transfer)* | +| **Mattermost** | Desktop app for Mattermost team chat. Distro package on Arch, Flathub elsewhere; not available on Alpine *(Messaging)* | +| **Microsoft Teams** | Teams for Linux, the open-source client that wraps the Teams web app (Microsoft stopped its own Linux app in 2022). Flathub, or the distro package where one exists; not available on Alpine *(Messaging)* | +| **Mullvad VPN** | Mullvad's VPN app. Mullvad's signed repository on Debian, Ubuntu, Fedora, RHEL clones and openSUSE, the distro package on Arch; not available on Alpine *(VPN)* | | **NeoMutt** | Terminal email client, a maintained fork of Mutt | +| **NordVPN** | NordVPN client and service; adds you to the `nordvpn` group. NordVPN's signed repository on Debian, Ubuntu, Fedora, RHEL clones 10+ (x86_64) and openSUSE, the AUR on Arch (AUR support must be on); not available on Alpine or Rocky/Alma 8 and 9 *(VPN)* | +| **OpenVPN** | OpenVPN client for `.ovpn` profiles. Distro package on every family (EPEL on RHEL clones) *(VPN)* | +| **Opera** | Browser with built-in ad blocker and sidebar messengers. Opera's signed repository on Debian, Ubuntu, Fedora, RHEL clones (x86_64) and openSUSE; Flathub, else the AUR, on Arch; not available on Alpine *(Web Browsers)* | | **PIA VPN** | Private Internet Access VPN client | | **Proton Mail Bridge** | Local IMAP/SMTP gateway for Proton Mail — needs a paid plan | | **ProtonVPN** | Free and open-source VPN by Proton | @@ -276,6 +282,7 @@ Grouped into folders inside the Development tab: | **Trojita** | Fast Qt-native IMAP client — Fedora, Arch (AUR), and openSUSE only | | **UniFi Endpoint** | Ubiquiti's UniFi Identity VPN client for UniFi-managed networks — `.deb` / `.rpm` | | **Vivaldi Browser** | Highly customizable Chromium browser | +| **WhatsApp** | ZapZap, an open-source desktop client that wraps WhatsApp Web (WhatsApp has no official Linux app). Distro package on openSUSE, Flathub elsewhere; not available on Alpine *(Messaging)* | | **WireGuard Client** | Lightweight VPN client using WireGuard protocol | | **WireGuard Server** | Sets up a WireGuard VPN server | | **Zen Browser** | Privacy-focused Firefox-based browser with vertical tabs and split view (beta) | diff --git a/lib/installers.sh b/lib/installers.sh index 30c05b2..73256cc 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -463,6 +463,17 @@ if [[ "$DISTRO_FAMILY" != "rhel" || "${DISTRO_VERSION_ID%.*}" -lt 10 ]]; then register_utility "inxi" install_inxi check_inxi uninstall_inxi update_inxi get_version_inxi register_utility "TLP" install_tlp check_tlp uninstall_tlp update_tlp get_version_tlp fi +# Internet (#91): browser, messengers and VPNs. Alpine keeps only OpenVPN (alpine_packages.sh). +register_utility "Mattermost" install_mattermost check_mattermost uninstall_mattermost update_mattermost get_version_mattermost +register_utility "Microsoft Teams" install_microsoft_teams check_microsoft_teams uninstall_microsoft_teams update_microsoft_teams get_version_microsoft_teams +register_utility "Mullvad VPN" install_mullvad_vpn check_mullvad_vpn uninstall_mullvad_vpn update_mullvad_vpn get_version_mullvad_vpn +# NordVPN's package needs glibc 2.35: RHEL clones have it from release 10. +if [[ "$DISTRO_FAMILY" != "rhel" || "${DISTRO_VERSION_ID%%.*}" -ge 10 ]]; then + register_utility "NordVPN" install_nordvpn check_nordvpn uninstall_nordvpn update_nordvpn get_version_nordvpn +fi +register_utility "OpenVPN" install_openvpn check_openvpn uninstall_openvpn update_openvpn get_version_openvpn +register_utility "Opera" install_opera check_opera uninstall_opera update_opera get_version_opera +register_utility "WhatsApp" install_whatsapp check_whatsapp uninstall_whatsapp update_whatsapp get_version_whatsapp # COSMIC: requires Ubuntu 24.10+/Debian Trixie, Fedora 42+, or Arch. # Not packaged for the RHEL ecosystem or openSUSE Leap/SLES. @@ -801,6 +812,13 @@ UTILITY_CATEGORY["fzf"]="System Tools" UTILITY_CATEGORY["eza"]="System Tools" UTILITY_CATEGORY["starship"]="System Tools" UTILITY_CATEGORY["tldr"]="System Tools" +UTILITY_CATEGORY["Mattermost"]="Internet" +UTILITY_CATEGORY["Microsoft Teams"]="Internet" +UTILITY_CATEGORY["Mullvad VPN"]="Internet" +UTILITY_CATEGORY["NordVPN"]="Internet" +UTILITY_CATEGORY["OpenVPN"]="Internet" +UTILITY_CATEGORY["Opera"]="Internet" +UTILITY_CATEGORY["WhatsApp"]="Internet" UTILITY_CATEGORY["zoxide"]="System Tools" UTILITY_CATEGORY["auto-cpufreq"]="System Tools" UTILITY_CATEGORY["BleachBit"]="System Tools" @@ -978,6 +996,13 @@ UTILITY_SUBCATEGORY["RustDesk"]="Remote Access" UTILITY_SUBCATEGORY["Slack"]="Messaging" UTILITY_SUBCATEGORY["Tor Browser"]="Web Browsers" UTILITY_SUBCATEGORY["Zoom"]="Messaging" +UTILITY_SUBCATEGORY["Opera"]="Web Browsers" +UTILITY_SUBCATEGORY["WhatsApp"]="Messaging" +UTILITY_SUBCATEGORY["Microsoft Teams"]="Messaging" +UTILITY_SUBCATEGORY["Mattermost"]="Messaging" +UTILITY_SUBCATEGORY["Mullvad VPN"]="VPN" +UTILITY_SUBCATEGORY["NordVPN"]="VPN" +UTILITY_SUBCATEGORY["OpenVPN"]="VPN" UTILITY_SUBCATEGORY["Timeshift"]="Timeshift" UTILITY_SUBCATEGORY["Create Snapshot"]="Timeshift" UTILITY_SUBCATEGORY["Restore Snapshot"]="Timeshift" @@ -1366,6 +1391,13 @@ UTILITY_DESCRIPTION["VirtualBox"]="Runs virtual machines. Distro package on Ubun UTILITY_DESCRIPTION["Wireshark"]="Network packet analyser. Distro package; the installing user joins the wireshark group to capture without root (log out and in)." UTILITY_DESCRIPTION["Zed"]="Fast code editor with built-in collaboration and AI. Distro package on Arch and openSUSE Tumbleweed, Flathub elsewhere. Not available on Alpine." UTILITY_DESCRIPTION["zoxide"]="Smarter cd: remembers the folders you use and jumps to them with z, loaded from ~/.bashrc (and ~/.zshrc when it exists). Distro package (every release except Rocky/Alma 10); elsewhere the GitHub release, SHA-256 checked, in /usr/local/bin." +UTILITY_DESCRIPTION["Opera"]="Opera web browser with a built-in ad blocker, free VPN-style proxy and sidebar messengers. Installed from Opera's own signed repository on Debian, Ubuntu, Fedora, RHEL clones (x86_64) and openSUSE, so updates arrive with the system; on Arch from Flathub when Flatpak is set up, otherwise the AUR (only with AUR support enabled). Not available on Alpine. Uninstall keeps your profile." +UTILITY_DESCRIPTION["WhatsApp"]="WhatsApp has no official Linux app; this installs ZapZap, an open-source desktop client that wraps WhatsApp Web (link it with your phone's QR code). Distro package on openSUSE, Flathub elsewhere. Not available on Alpine. Uninstall keeps the linked session." +UTILITY_DESCRIPTION["Microsoft Teams"]="Microsoft stopped its own Linux Teams app in 2022; this installs Teams for Linux, the open-source client that wraps the Teams web app (chat, meetings, notifications, screen sharing). Flathub, or the distro package where a repository has one. Not available on Alpine. Uninstall keeps your sign-in." +UTILITY_DESCRIPTION["Mattermost"]="Desktop app for Mattermost, the self-hosted team chat. Distro package on Arch, Flathub elsewhere. Not available on Alpine. Uninstall keeps your saved servers." +UTILITY_DESCRIPTION["Mullvad VPN"]="Mullvad's VPN app (WireGuard, no account email needed). Installed from Mullvad's own signed repository on Debian, Ubuntu, Fedora, RHEL clones and openSUSE, so updates arrive with the system; on Arch from the distro repository. The background service is enabled. Not available on Alpine." +UTILITY_DESCRIPTION["NordVPN"]="NordVPN's command-line client and service. Installed from NordVPN's own signed repository on Debian, Ubuntu, Fedora, RHEL clones 10 and newer (x86_64) and openSUSE, so updates arrive with the system; on Arch from the AUR (only with AUR support enabled). Enables the service and adds you to the nordvpn group (log out and in again, then run nordvpn login). Not available on Alpine." +UTILITY_DESCRIPTION["OpenVPN"]="The OpenVPN client for connecting with a provider's .ovpn file. The distro package on every family (RHEL clones take it from EPEL). Uninstall keeps your .ovpn files and /etc/openvpn." UTILITY_DESCRIPTION["Alacritty"]="Fast GPU-accelerated terminal emulator configured by a text file. Distro package; not available on Rocky/Alma/RHEL or Ubuntu 22.04, which have none." UTILITY_DESCRIPTION["auto-cpufreq"]="Adjusts CPU speed and power use to the battery and load, with a background service; for laptops. No distro carries it: on Arch it comes from the AUR (only with AUR support enabled), elsewhere upstream's own installer runs from the GitHub release (upstream publishes no checksum), into /opt/auto-cpufreq. Cannot run beside TLP. Not available on Alpine, openSUSE Leap or Rocky/Alma 8 and 9." UTILITY_DESCRIPTION["BleachBit"]="Disk cleaner that clears caches, logs, history and temporary files for the system and many applications. Distro package (EPEL on Rocky/Alma 8 and 9), or Flathub on Rocky/Alma 10. Not available on Alpine." @@ -1474,7 +1506,8 @@ mark_aur_only_arch \ "Euro-Office=euro-office-desktopeditors-git" \ "Snap (snapd)=snapd" "Snapper GUI=snapper-gui-git" \ "Trojita=trojita" "Zotero=zotero" "1Password=1password" \ - "auto-cpufreq=auto-cpufreq" "Sublime Text=sublime-text-4" + "auto-cpufreq=auto-cpufreq" "Sublime Text=sublime-text-4" \ + "NordVPN=nordvpn-bin" # Utilities that can install from upstream's own binary when no package source # carries them (the third tier of arch_install_ordered, reached on Arch because diff --git a/lib/installers/alpine_packages.sh b/lib/installers/alpine_packages.sh index 2355ebf..19c90c2 100644 --- a/lib/installers/alpine_packages.sh +++ b/lib/installers/alpine_packages.sh @@ -39,6 +39,7 @@ _ALPINE_TABLE=( "Krita|krita|krita||" "LibreOffice|libreoffice|soffice||" "Neovim|neovim|nvim||" + "OpenVPN|openvpn|openvpn||" "Node.js|nodejs npm|node||" "OpenSSH Server|openssh-server|sshd|sshd|" "tmux|tmux|tmux||" diff --git a/lib/installers/mattermost.sh b/lib/installers/mattermost.sh new file mode 100644 index 0000000..a0825d2 --- /dev/null +++ b/lib/installers/mattermost.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Mattermost desktop app installer functions +# +# The distro package on Arch (mattermost-desktop); everywhere else Mattermost's +# own Flathub listing (com.mattermost.Desktop). Not offered on Alpine. + +# --- Mattermost --- + +check_mattermost() { _check_standard "" mattermost-desktop com.mattermost.Desktop; } + +install_mattermost() { + info "Installing Mattermost..." + native_or_flatpak_install com.mattermost.Desktop mattermost-desktop || return 1 + info "Mattermost installed." +} + +# The saved server connections and sign-in are kept. +uninstall_mattermost() { + info "Uninstalling Mattermost..." + native_or_flatpak_uninstall com.mattermost.Desktop mattermost-desktop +} + +update_mattermost() { + info "Updating Mattermost..." + native_or_flatpak_update com.mattermost.Desktop mattermost-desktop +} + +get_version_mattermost() { native_or_flatpak_version com.mattermost.Desktop mattermost-desktop; } diff --git a/lib/installers/microsoft_teams.sh b/lib/installers/microsoft_teams.sh new file mode 100644 index 0000000..e9c7859 --- /dev/null +++ b/lib/installers/microsoft_teams.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Microsoft Teams installer functions +# +# Microsoft retired its own Linux Teams app at the end of 2022. This installs +# Teams for Linux, the open source (GPL-3.0) client that wraps the Teams web +# app: Flathub (com.github.IsmaelMartinez.teams_for_linux), or the distro +# package where a repository carries one. Not offered on Alpine. + +# --- Microsoft Teams (Teams for Linux) --- + +_TEAMS_FLATPAK="com.github.IsmaelMartinez.teams_for_linux" + +check_microsoft_teams() { _check_standard "" teams-for-linux "$_TEAMS_FLATPAK"; } + +install_microsoft_teams() { + info "Installing Microsoft Teams (Teams for Linux)..." + native_or_flatpak_install "$_TEAMS_FLATPAK" teams-for-linux || return 1 + info "Microsoft Teams (Teams for Linux) installed." +} + +# The signed-in account and settings are kept. +uninstall_microsoft_teams() { + info "Uninstalling Microsoft Teams (Teams for Linux)..." + native_or_flatpak_uninstall "$_TEAMS_FLATPAK" teams-for-linux +} + +update_microsoft_teams() { + info "Updating Microsoft Teams (Teams for Linux)..." + native_or_flatpak_update "$_TEAMS_FLATPAK" teams-for-linux +} + +get_version_microsoft_teams() { native_or_flatpak_version "$_TEAMS_FLATPAK" teams-for-linux; } diff --git a/lib/installers/mullvad_vpn.sh b/lib/installers/mullvad_vpn.sh new file mode 100644 index 0000000..b6f6be4 --- /dev/null +++ b/lib/installers/mullvad_vpn.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# Mullvad VPN installer functions +# +# Debian/Ubuntu, Fedora, RHEL clones and openSUSE use Mullvad's own signed +# repository (repository.mullvad.net), so updates arrive with the system. +# Arch carries mullvad-vpn in its own repositories. The package enables and +# starts its own background service. Not offered on Alpine +# (glibc build). + +# --- Mullvad VPN --- + +_MULLVAD_APT_KEY_URL="https://repository.mullvad.net/deb/mullvad-keyring.asc" +_MULLVAD_RPM_KEY_URL="https://repository.mullvad.net/rpm/mullvad-keyring.asc" +# Primary fingerprint of Mullvad's code-signing key (key ID D5A1D4F266DE8DDF), +# checked against the downloaded key before it is trusted. +_MULLVAD_KEY_FPR="A1198702FC3E0A09A9AE5B75D5A1D4F266DE8DDF" +_MULLVAD_APT_KEYRING="/usr/share/keyrings/mullvad-keyring.gpg" +_MULLVAD_APT_LIST="/etc/apt/sources.list.d/mullvad.list" +_MULLVAD_REPO_FILE="/etc/yum.repos.d/mullvad.repo" + +check_mullvad_vpn() { _check_standard mullvad mullvad-vpn ""; } + +install_mullvad_vpn() { + info "Installing Mullvad VPN..." + ensure_tools + case "$DISTRO_FAMILY" in + debian) + local arch + arch=$(dpkg --print-architecture) + _add_apt_repo "$_MULLVAD_APT_KEY_URL" "$_MULLVAD_APT_KEYRING" \ + "deb [arch=${arch} signed-by=${_MULLVAD_APT_KEYRING}] https://repository.mullvad.net/deb/stable stable main" \ + "$_MULLVAD_APT_LIST" "$_MULLVAD_KEY_FPR" || return 1 + pkg_install mullvad-vpn || return 1 + ;; + fedora|rhel|suse) + # libXScrnSaver, which the app needs, is in EPEL on RHEL clones 10. + ensure_epel + rpm_import_key_checked "$_MULLVAD_RPM_KEY_URL" "$_MULLVAD_KEY_FPR" || return 1 + if [[ "$DISTRO_FAMILY" == "suse" ]]; then + sudo zypper --non-interactive removerepo mullvad-stable &>/dev/null || true + sudo zypper --non-interactive addrepo --refresh \ + "https://repository.mullvad.net/rpm/stable/$(uname -m)" mullvad-stable || return 1 + sudo zypper --non-interactive --gpg-auto-import-keys refresh mullvad-stable || return 1 + else + printf '%s\n' \ + '[mullvad-stable]' \ + 'name=Mullvad VPN' \ + 'baseurl=https://repository.mullvad.net/rpm/stable/$basearch' \ + 'type=rpm' \ + 'enabled=1' \ + 'gpgcheck=1' \ + "gpgkey=${_MULLVAD_RPM_KEY_URL}" | sudo tee "$_MULLVAD_REPO_FILE" >/dev/null + fi + pkg_install mullvad-vpn || return 1 + ;; + arch) + pkg_install mullvad-vpn || return 1 + ;; + *) + error "Mullvad publishes no package for ${DISTRO_NAME}." + return 1 + ;; + esac + info "Mullvad VPN installed." +} + +uninstall_mullvad_vpn() { + info "Uninstalling Mullvad VPN..." + case "$DISTRO_FAMILY" in + debian) + pkg_remove mullvad-vpn + sudo rm -f "$_MULLVAD_APT_LIST" "$_MULLVAD_APT_KEYRING" + ;; + fedora|rhel) + pkg_remove mullvad-vpn + sudo rm -f "$_MULLVAD_REPO_FILE" + ;; + suse) + pkg_remove mullvad-vpn + sudo zypper --non-interactive removerepo mullvad-stable 2>/dev/null || true + ;; + arch) + pkg_remove mullvad-vpn + ;; + esac +} + +update_mullvad_vpn() { + info "Updating Mullvad VPN..." + pkg_upgrade mullvad-vpn +} + +get_version_mullvad_vpn() { _ver_from_pkg mullvad-vpn || echo ""; } diff --git a/lib/installers/nordvpn.sh b/lib/installers/nordvpn.sh new file mode 100644 index 0000000..0ee7775 --- /dev/null +++ b/lib/installers/nordvpn.sh @@ -0,0 +1,112 @@ +#!/bin/bash +# NordVPN installer functions +# +# Debian/Ubuntu, Fedora, RHEL clones and openSUSE use NordVPN's own signed +# repository (repo.nordvpn.com), so updates arrive with the system. Arch has no +# repository package: nordvpn-bin comes from the AUR, which this tool only uses +# when AUR_ENABLED=true. The package needs glibc 2.35, so it is not offered on +# Rocky/Alma/RHEL 8 and 9. The command-line client needs its background service +# and a "nordvpn" group; both are set up here. Not offered on Alpine +# (glibc build). + +# --- NordVPN --- + +_NORD_KEY_URL="https://repo.nordvpn.com/gpg/nordvpn_public.asc" +# Primary fingerprint of NordVPN's signing key (key ID 6B219E535C964CA1), checked +# against the downloaded key before it is trusted. +_NORD_KEY_FPR="BC5480EFEC5C081CE5BCFBE26B219E535C964CA1" +_NORD_APT_KEYRING="/usr/share/keyrings/nordvpn-archive-keyring.gpg" +_NORD_APT_LIST="/etc/apt/sources.list.d/nordvpn.list" +_NORD_REPO_FILE="/etc/yum.repos.d/nordvpn.repo" +_NORD_RPM_URL="https://repo.nordvpn.com/yum/nordvpn/centos/x86_64" + +check_nordvpn() { _check_standard nordvpn nordvpn "" nordvpn-bin; } + +install_nordvpn() { + info "Installing NordVPN..." + ensure_tools + case "$DISTRO_FAMILY" in + debian) + _add_apt_repo "$_NORD_KEY_URL" "$_NORD_APT_KEYRING" \ + "deb [signed-by=${_NORD_APT_KEYRING}] https://repo.nordvpn.com/deb/nordvpn/debian stable main" \ + "$_NORD_APT_LIST" "$_NORD_KEY_FPR" || return 1 + pkg_install nordvpn || return 1 + ;; + fedora|rhel|suse) + if [[ "$(uname -m)" != "x86_64" ]]; then + error "NordVPN's RPM repository is x86_64 only." + return 1 + fi + rpm_import_key_checked "$_NORD_KEY_URL" "$_NORD_KEY_FPR" || return 1 + if [[ "$DISTRO_FAMILY" == "suse" ]]; then + sudo zypper --non-interactive removerepo nordvpn &>/dev/null || true + sudo zypper --non-interactive addrepo --refresh "$_NORD_RPM_URL" nordvpn || return 1 + sudo zypper --non-interactive --gpg-auto-import-keys refresh nordvpn || return 1 + else + printf '%s\n' \ + '[nordvpn]' \ + 'name=NordVPN' \ + "baseurl=${_NORD_RPM_URL}" \ + 'enabled=1' \ + 'gpgcheck=1' \ + "gpgkey=${_NORD_KEY_URL}" | sudo tee "$_NORD_REPO_FILE" >/dev/null + fi + pkg_install nordvpn || return 1 + ;; + arch) + repo_or_aur nordvpn-bin || return 1 + ;; + *) + error "NordVPN publishes no package for ${DISTRO_NAME}." + return 1 + ;; + esac + _nordvpn_setup_access + info "NordVPN installed. Log in with: nordvpn login (log out and in again first so the new group applies)." +} + +# The nordvpn command talks to a service that only members of the "nordvpn" +# group may use, so the user who ran this is added to it, as NordVPN's own +# installer does. A change that applies at the next login. +_nordvpn_setup_access() { + if command -v systemctl &>/dev/null && [[ -d /run/systemd/system ]]; then + sudo systemctl enable --now nordvpnd.service 2>/dev/null || true + fi + local user="${SUDO_USER:-$USER}" + if [[ -n "$user" && "$user" != "root" ]] && getent group nordvpn &>/dev/null; then + sudo usermod -aG nordvpn "$user" || warn "Could not add ${user} to the nordvpn group." + fi +} + +# The nordvpn group stays, as it may be shared with a reinstall. +uninstall_nordvpn() { + info "Uninstalling NordVPN..." + case "$DISTRO_FAMILY" in + debian) + pkg_remove nordvpn + sudo rm -f "$_NORD_APT_LIST" "$_NORD_APT_KEYRING" + ;; + fedora|rhel) + pkg_remove nordvpn + sudo rm -f "$_NORD_REPO_FILE" + ;; + suse) + pkg_remove nordvpn + sudo zypper --non-interactive removerepo nordvpn 2>/dev/null || true + ;; + arch) + aur_remove nordvpn-bin 2>/dev/null || pkg_remove nordvpn-bin + ;; + esac +} + +update_nordvpn() { + info "Updating NordVPN..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur nordvpn-bin + else + pkg_upgrade nordvpn + fi +} + +get_version_nordvpn() { _ver_from_pkg nordvpn || _ver_from_pkg nordvpn-bin || echo ""; } diff --git a/lib/installers/openvpn.sh b/lib/installers/openvpn.sh new file mode 100644 index 0000000..3dfcd2e --- /dev/null +++ b/lib/installers/openvpn.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# OpenVPN installer functions +# +# The OpenVPN client from the distro's own repositories on every family +# (RHEL clones take it from EPEL). Import a provider's .ovpn file with +# `sudo openvpn --config file.ovpn`, or add it in the desktop's network +# settings (the network-manager-openvpn plugin is a separate package). + +# --- OpenVPN --- + +check_openvpn() { _check_standard openvpn openvpn ""; } + +install_openvpn() { + info "Installing OpenVPN..." + pkg_refresh + ensure_epel + pkg_install openvpn || return 1 + info "OpenVPN installed." +} + +# Connection profiles (.ovpn files) and /etc/openvpn are left in place. +uninstall_openvpn() { + info "Uninstalling OpenVPN..." + pkg_remove openvpn +} + +update_openvpn() { + info "Updating OpenVPN..." + pkg_upgrade openvpn +} + +get_version_openvpn() { _ver_from_pkg openvpn || echo ""; } diff --git a/lib/installers/opera.sh b/lib/installers/opera.sh new file mode 100644 index 0000000..435e535 --- /dev/null +++ b/lib/installers/opera.sh @@ -0,0 +1,113 @@ +#!/bin/bash +# Opera browser installer functions +# +# Debian/Ubuntu, Fedora, RHEL clones and openSUSE use Opera's own signed +# repositories (deb.opera.com, rpm.opera.com), so updates arrive with the +# system. Opera's RPM repository is x86_64 only. Arch has no repository +# package: Flathub's com.opera.Opera when Flatpak is set up, else the AUR +# (only when AUR support is on). Not offered on Alpine (glibc build). + +# --- Opera --- + +_OPERA_APT_KEY_URL="https://deb.opera.com/archive.key" +_OPERA_RPM_KEY_URL="https://rpm.opera.com/rpmrepo.key" +# Primary fingerprint of Opera's archive signing key (key ID 11EE8C00B693A745), +# checked against the downloaded key before it is trusted. +_OPERA_KEY_FPR="6C86BE214648376680CA957B11EE8C00B693A745" +_OPERA_APT_KEYRING="/usr/share/keyrings/opera-archive-keyring.gpg" +_OPERA_APT_LIST="/etc/apt/sources.list.d/opera-stable.list" +_OPERA_REPO_FILE="/etc/yum.repos.d/opera.repo" + +check_opera() { _check_standard opera opera-stable com.opera.Opera; } + +install_opera() { + info "Installing Opera..." + ensure_tools + case "$DISTRO_FAMILY" in + debian) + local arch + arch=$(dpkg --print-architecture) + _add_apt_repo "$_OPERA_APT_KEY_URL" "$_OPERA_APT_KEYRING" \ + "deb [arch=${arch} signed-by=${_OPERA_APT_KEYRING}] https://deb.opera.com/opera-stable/ stable non-free" \ + "$_OPERA_APT_LIST" "$_OPERA_KEY_FPR" || return 1 + # Opera's package would otherwise ask whether to add its own repository + # entry, which this has just done. + command -v debconf-set-selections &>/dev/null && \ + echo "opera-stable opera-stable/add-deb-repo boolean false" | sudo debconf-set-selections + pkg_install opera-stable || return 1 + ;; + fedora|rhel|suse) + if [[ "$(uname -m)" != "x86_64" ]]; then + error "Opera publishes RPM packages for x86_64 only." + return 1 + fi + # Opera's RPM needs the Qt 5 libraries, which RHEL clones 10 carry in EPEL. + ensure_epel + rpm_import_key_checked "$_OPERA_RPM_KEY_URL" "$_OPERA_KEY_FPR" || return 1 + if [[ "$DISTRO_FAMILY" == "suse" ]]; then + sudo zypper --non-interactive removerepo opera &>/dev/null || true + sudo zypper --non-interactive addrepo --refresh https://rpm.opera.com/rpm opera || return 1 + sudo zypper --non-interactive --gpg-auto-import-keys refresh opera || return 1 + else + printf '%s\n' \ + '[opera]' \ + 'name=Opera packages' \ + 'type=rpm-md' \ + 'baseurl=https://rpm.opera.com/rpm' \ + 'gpgcheck=1' \ + 'gpgkey=https://rpm.opera.com/rpmrepo.key' \ + 'enabled=1' | sudo tee "$_OPERA_REPO_FILE" >/dev/null + fi + pkg_install opera-stable || return 1 + ;; + arch) + flatpak_or_aur com.opera.Opera opera || return 1 + ;; + *) + error "Opera publishes no package for ${DISTRO_NAME}." + return 1 + ;; + esac + info "Opera installed." +} + +# Profiles, bookmarks and passwords (~/.config/opera) are kept. +uninstall_opera() { + info "Uninstalling Opera..." + if flatpak_is_installed com.opera.Opera; then + flatpak uninstall -y --user com.opera.Opera 2>/dev/null || \ + sudo flatpak uninstall -y --system com.opera.Opera + return + fi + case "$DISTRO_FAMILY" in + debian) + pkg_remove opera-stable + sudo rm -f "$_OPERA_APT_LIST" "${_OPERA_APT_LIST%.list}.sources" "$_OPERA_APT_KEYRING" + ;; + fedora|rhel) + pkg_remove opera-stable + sudo rm -f "$_OPERA_REPO_FILE" + ;; + suse) + pkg_remove opera-stable + sudo zypper --non-interactive removerepo opera 2>/dev/null || true + ;; + arch) + aur_remove opera 2>/dev/null || pkg_remove opera + ;; + esac +} + +update_opera() { + info "Updating Opera..." + if flatpak_is_installed com.opera.Opera; then + flatpak update -y --user com.opera.Opera 2>/dev/null || \ + sudo flatpak update -y --system com.opera.Opera + elif [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur opera + else + pkg_upgrade opera-stable + fi +} + +get_version_opera() { _ver_from_pkg opera-stable || _ver_from_pkg opera || _ver_from_flatpak com.opera.Opera || echo ""; } diff --git a/lib/installers/whatsapp.sh b/lib/installers/whatsapp.sh new file mode 100644 index 0000000..ad2f493 --- /dev/null +++ b/lib/installers/whatsapp.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# WhatsApp installer functions +# +# WhatsApp publishes no desktop app for Linux. This installs ZapZap, an open +# source (GPL-3.0) desktop client that wraps WhatsApp Web: the distro package on +# openSUSE, Flathub (com.rtosta.zapzap) everywhere else. Not offered on Alpine. + +# --- WhatsApp (ZapZap) --- + +check_whatsapp() { _check_standard "" zapzap com.rtosta.zapzap; } + +install_whatsapp() { + info "Installing WhatsApp (ZapZap)..." + native_or_flatpak_install com.rtosta.zapzap zapzap || return 1 + info "WhatsApp (ZapZap) installed." +} + +# The linked WhatsApp session and settings are kept. +uninstall_whatsapp() { + info "Uninstalling WhatsApp (ZapZap)..." + native_or_flatpak_uninstall com.rtosta.zapzap zapzap +} + +update_whatsapp() { + info "Updating WhatsApp (ZapZap)..." + native_or_flatpak_update com.rtosta.zapzap zapzap +} + +get_version_whatsapp() { native_or_flatpak_version com.rtosta.zapzap zapzap; } diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 2e17afb..53a63b5 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -5916,6 +5916,101 @@ test_dev_alpine_rows() { assert_eq "k3s=k3s ollama=ollama done" "$out" "Alpine offers the apps its repositories carry, with their services, and hides the rest" } +# --- Internet apps (#91, stage 4) --- +echo "" +echo "=== Internet apps and VPNs (#91) ===" + +_NET_APPS=( + "Mattermost|mattermost|Messaging" "Microsoft Teams|microsoft_teams|Messaging" "Mullvad VPN|mullvad_vpn|VPN" + "NordVPN|nordvpn|VPN" "OpenVPN|openvpn|VPN" "Opera|opera|Web Browsers" "WhatsApp|whatsapp|Messaging" +) + +test_net_apps_registered() { + local entry name slug sub fn gaps=0 + for entry in "${_NET_APPS[@]}"; do + IFS='|' read -r name slug sub <<<"$entry" + grep -qE "^[[:space:]]*register_utility \"${name}\"[[:space:]]+install_${slug} " "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing register: $name"; } + grep -qF "UTILITY_CATEGORY[\"${name}\"]=\"Internet\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing category: $name"; } + grep -qF "UTILITY_SUBCATEGORY[\"${name}\"]=\"${sub}\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " ${name} not in ${sub}"; } + grep -qF "UTILITY_DESCRIPTION[\"${name}\"]=" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing description: $name"; } + for fn in install check uninstall update get_version; do + grep -q "^${fn}_${slug}()" "${SCRIPT_DIR}/lib/installers/${slug}.sh" 2>/dev/null || { gaps=1; echo " missing ${fn}_${slug}"; } + done + grep -qxF " '${name}'" "${SCRIPT_DIR}/completions/_linux_util" || { gaps=1; echo " missing zsh completion: $name"; } + grep -qxF "${name}" "${SCRIPT_DIR}/completions/linux_util.bash" || { gaps=1; echo " missing bash completion: $name"; } + grep -qF "| **${name}** |" "${SCRIPT_DIR}/docs/utilities.md" || { gaps=1; echo " missing docs row: $name"; } + done + assert_eq "0" "$gaps" "The 7 new Internet apps are registered with category, folder, description, completions, docs row and all five functions" +} + +test_net_apps_held_back() { + local f="${SCRIPT_DIR}/lib/installers.sh" gaps=0 line out + grep -qF '"NordVPN=nordvpn-bin"' "$f" || { gaps=1; echo " NordVPN not AUR-only on Arch"; } + line=$(grep -n 'register_utility "NordVPN"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF -- '-ge 10' || { gaps=1; echo " NordVPN not held back on Rocky/Alma 8 and 9"; } + out=$( + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + have=""; for row in "${_ALPINE_TABLE[@]}"; do have+=" ${row%%|*}"; done + [[ " $have " == *" OpenVPN "* ]] || printf 'missing:OpenVPN ' + for n in Opera "Mullvad VPN" NordVPN WhatsApp "Microsoft Teams" Mattermost; do + [[ " $have " == *" $n "* ]] && printf 'unexpected:%s ' "$n" + done + echo done + ) + assert_eq "0 done" "${gaps} ${out}" "NordVPN is AUR-only on Arch and held back on Rocky/Alma 8 and 9; Alpine offers OpenVPN only" +} + +# A repository whose signing key does not match the pinned fingerprint must stop the install +# before any package is touched; a failed package install must not be reported as installed. +test_net_vendor_repo_installs_stop_on_failure() { + local out slug fn + out=$( + for slug in opera mullvad_vpn nordvpn; do + ( + source "${SCRIPT_DIR}/lib/installers/${slug}.sh" + info() { printf 'INFO(%s) ' "$*"; }; error() { :; }; warn() { :; }; ensure_tools() { :; } + dpkg() { echo amd64; } + pkg_install() { printf 'PKG '; return "$_pkg_rc"; } + DISTRO_FAMILY=debian + _add_apt_repo() { return 1; } + _pkg_rc=0; "install_${slug}"; printf '%s:repo-fail=%s ' "$slug" "$?" + _add_apt_repo() { return 0; } + _pkg_rc=1; "install_${slug}"; printf '%s:pkg-fail=%s ' "$slug" "$?" + ) 2>/dev/null + done + ) + assert_eq "INFO(Installing Opera...) opera:repo-fail=1 INFO(Installing Opera...) PKG opera:pkg-fail=1 INFO(Installing Mullvad VPN...) mullvad_vpn:repo-fail=1 INFO(Installing Mullvad VPN...) PKG mullvad_vpn:pkg-fail=1 INFO(Installing NordVPN...) nordvpn:repo-fail=1 INFO(Installing NordVPN...) PKG nordvpn:pkg-fail=1 " "$out" "Opera, Mullvad VPN and NordVPN stop without installing when the key or the package step fails" +} + +test_nordvpn_adds_user_to_group() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/nordvpn.sh" + info() { :; }; warn() { :; } + systemctl() { :; } + sudo() { printf 'sudo(%s) ' "$*"; } + getent() { return 0; } + SUDO_USER=""; USER=nick; _nordvpn_setup_access + USER=root; _nordvpn_setup_access + getent() { return 2; }; USER=nick; _nordvpn_setup_access + echo done + ) + assert_eq "sudo(usermod -aG nordvpn nick) done" "$out" "NordVPN adds the installing user to the nordvpn group, but not root and not when the group is missing" +} + +# Opera's package writes its own repository entry (opera-stable.sources), so uninstall removes that too. +test_opera_uninstall_removes_repo_entries() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/opera.sh" + info() { :; }; flatpak_is_installed() { return 1; } + pkg_remove() { printf 'pkg_remove(%s) ' "$*"; } + sudo() { printf 'sudo(%s) ' "$*"; } + DISTRO_FAMILY=debian; uninstall_opera + ) + assert_eq "pkg_remove(opera-stable) sudo(rm -f /etc/apt/sources.list.d/opera-stable.list /etc/apt/sources.list.d/opera-stable.sources /usr/share/keyrings/opera-archive-keyring.gpg) " "$out" "Opera uninstall removes its repository entries and key" +} + # --- Verified GitHub downloads --- _GH_FIXTURE='{"tag_name": "v1.2.3","assets": [ {"name": "tool_1.2.3_linux_x86_64.tar.gz","uploader": {"login": "bot"},"size": 9,"digest": "sha256:'"$(printf 'a%.0s' {1..64})"'","browser_download_url": "https://x/tool_1.2.3_linux_x86_64.tar.gz"}, @@ -6149,6 +6244,11 @@ test_dev_apps_registered test_dev_subcategories test_dev_upstream_marks test_dev_alpine_rows +test_net_apps_registered +test_net_apps_held_back +test_net_vendor_repo_installs_stop_on_failure +test_nordvpn_adds_user_to_group +test_opera_uninstall_removes_repo_entries test_github_asset_info test_github_asset_download_checks_digest test_upstream_arch_and_regex From 602cd45c93ebda448f082d4693ebb31a040a53d6 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 13:01:34 -0500 Subject: [PATCH 11/14] feat: add 8 Gaming apps and sort Gaming into folders Add Prism Launcher, RetroArch, Dolphin Emulator, PPSSPP, Sunshine, Moonlight, Flatseal and Gear Lever (part of #91). Each uses the distro package where a repository has one, otherwise Flathub. Sunshine always installs from Flathub and then runs its documented setup step for virtual input devices, which asks for a password in a desktop session (otherwise the command is printed). Uninstalling it removes the rules that step wrote. Gaming is now grouped into Game Launchers, Emulators, Game Streaming and Gaming Utilities. Alpine gets Prism Launcher, Moonlight, RetroArch, Dolphin Emulator and PPSSPP; Sunshine, Flatseal and Gear Lever are not offered there. Also update shell completions, docs, changelog and unit tests. --- CHANGELOG.md | 10 ++++ README.md | 4 +- completions/_linux_util | 8 +++ completions/linux_util.bash | 8 +++ docs/utilities.md | 8 +++ lib/installers.sh | 34 +++++++++++ lib/installers/alpine_packages.sh | 5 ++ lib/installers/dolphin_emulator.sh | 29 +++++++++ lib/installers/flatseal.sh | 29 +++++++++ lib/installers/gear_lever.sh | 29 +++++++++ lib/installers/moonlight.sh | 35 +++++++++++ lib/installers/ppsspp.sh | 28 +++++++++ lib/installers/prism_launcher.sh | 29 +++++++++ lib/installers/retroarch.sh | 29 +++++++++ lib/installers/sunshine.sh | 54 +++++++++++++++++ tests/test_linux_util.sh | 95 ++++++++++++++++++++++++++++++ 16 files changed, 432 insertions(+), 2 deletions(-) create mode 100644 lib/installers/dolphin_emulator.sh create mode 100644 lib/installers/flatseal.sh create mode 100644 lib/installers/gear_lever.sh create mode 100644 lib/installers/moonlight.sh create mode 100644 lib/installers/ppsspp.sh create mode 100644 lib/installers/prism_launcher.sh create mode 100644 lib/installers/retroarch.sh create mode 100644 lib/installers/sunshine.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 75d2c12..ded0f88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,16 @@ when a release is cut. ### Added +- **8 more Gaming apps** (part of #91). Launcher: Prism Launcher (Minecraft). + Emulators: RetroArch, Dolphin Emulator and PPSSPP. Game streaming: Sunshine + (host) and Moonlight (client). Utilities: Flatseal (Flatpak permissions) and + Gear Lever (AppImage manager). Each uses the distro package where a + repository has one, otherwise Flathub. Sunshine always uses Flathub and then + runs its documented setup step for virtual keyboards and gamepads, which asks + for your password in a desktop session (otherwise the command is printed); + uninstalling it removes the rules that step wrote. Gaming is now sorted into + folders: **Game Launchers**, **Emulators**, **Game Streaming** and **Gaming + Utilities**. Not offered on Alpine: Sunshine, Flatseal and Gear Lever. - **7 more Internet apps** (part of #91). Browser: Opera. Messaging: WhatsApp (ZapZap, an open-source client for WhatsApp Web, as WhatsApp has no Linux app), Microsoft Teams (Teams for Linux, as Microsoft ended its own Linux app diff --git a/README.md b/README.md index 42b6b9f..d92b299 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Unique cloners](https://img.shields.io/badge/unique%20cloners-30-brightgreen)](https://github.com/acebmxer/linux_util/graphs/traffic) [![Shell: Bash](https://img.shields.io/badge/shell-bash-4EAA25?logo=gnubash&logoColor=white)](linux_util.sh) [![Platform: Linux](https://img.shields.io/badge/platform-linux-333333?logo=linux&logoColor=white)](#supported-distributions) -[![Tests](https://img.shields.io/badge/tests-599%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Tests](https://img.shields.io/badge/tests-604%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) [![Distros tested](https://img.shields.io/badge/distros%20tested-6-informational)](#supported-distributions) [![ShellCheck](https://img.shields.io/badge/shellcheck-clean-brightgreen)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) @@ -128,7 +128,7 @@ selection rules and the profile table: [docs/menu.md](docs/menu.md). | **Backup** | Timeshift and Snapper (create/restore/delete), Déjà Dup, Kup, Vorta, Duplicati | | **Disk Utilities** | GParted, Ventoy, KDiskMark, and a Btrfs toolset (Assistant, btrfsmaintenance, btrbk, duperemove) | | **Development** | Folders for IDEs & Editors (VS Code, VSCodium, Cursor, JetBrains Toolbox, Neovim, Vim, Emacs, Helix, Sublime Text, Zed), AI Tools (Claude Code, Claude Desktop, Codex, Hermes Agent, LM Studio, Ollama), Languages & Runtimes (Python, Java JDK, PHP, Ruby, Go, Node/NVM, Rust, pyenv), Git (GitHub CLI, lazygit), Containers & Kubernetes (Docker, Podman, Podman Desktop, kubectl, k9s, Helm, minikube, k3s), Virtualization (VirtualBox, Virt-Manager, Firecracker), Network & Security (Wireshark, nmap) and Distrobox, plus Terraform, OpenTofu, Ansible, DBeaver, Postman, PowerShell and Toolbx | -| **Gaming** | Steam, Lutris, Heroic, Bottles, Xodus Nexus, Wine, ProtonUp-Qt, MangoHud, Gamemode, Boxflat | +| **Gaming** | Folders for Game Launchers (Steam, Lutris, Heroic, Bottles, Prism Launcher, Xodus Nexus), Emulators (RetroArch, Dolphin Emulator, PPSSPP), Game Streaming (Sunshine, Moonlight) and Gaming Utilities (Wine, ProtonUp-Qt, MangoHud, Gamemode, Boxflat, Flatseal, Gear Lever) | | **Internet** | Browsers (Firefox, Brave, Chrome, Chromium, Vivaldi, Opera, LibreWolf, Zen, Thorium, Tor), email clients, messaging (Signal, Discord, Slack, Telegram, Zoom, WhatsApp, Microsoft Teams, Mattermost), and VPNs (ProtonVPN, Mullvad, NordVPN, OpenVPN, PIA, Tailscale, WireGuard) | | **Package Managers** | Flatpak, Homebrew, Nix, Snap, deb-get, Pacstall, yay, paru — added alongside the native manager, never replacing it | | **Productivity** | ArtCraft Launcher, LibreOffice, OnlyOffice, WPS, GIMP, Inkscape, Krita, Kdenlive, OBS, VLC, Multimedia Codecs, Obsidian, Joplin, Logseq, Bitwarden, 1Password, KeePassXC, Cryptomator, VeraCrypt, Nextcloud, NVIDIA PAIR, WinApps, and more: media (mpv, Kodi, Spotify), creative (Blender, Darktable, RawTherapee, Shotcut, Scribus) and documents (Calibre, Anki, Okular, Xournal++) | diff --git a/completions/_linux_util b/completions/_linux_util index d9558be..d4c2c3d 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -44,6 +44,7 @@ _linux_util_utilities=( 'Devolutions RDM' 'Discord' 'Docker' + 'Dolphin Emulator' 'earlyoom' 'Emacs' 'Enable RDP' @@ -56,8 +57,10 @@ _linux_util_utilities=( 'Firecracker' 'Firefox' 'Flatpak Setup' + 'Flatseal' 'Full System Upgrade/Update' 'fzf' + 'Gear Lever' 'Geary' 'Ghostty' 'GIMP' @@ -99,6 +102,7 @@ _linux_util_utilities=( 'Mattermost' 'Microsoft Teams' 'minikube' + 'Moonlight' 'mpv' 'Mullvad VPN' 'Multimedia Codecs' @@ -123,8 +127,11 @@ _linux_util_utilities=( 'Opera' 'PHP' 'Podman Desktop' + 'PPSSPP' + 'Prism Launcher' 'Python' 'RawTherapee' + 'RetroArch' 'Ruby' 'Scribus' 'Shotcut' @@ -132,6 +139,7 @@ _linux_util_utilities=( 'Spotify' 'starship' 'Sublime Text' + 'Sunshine' 'tldr' 'TLP' 'tmux' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index fee85c8..568e813 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -42,6 +42,7 @@ Deepin Desktop Devolutions RDM Discord Docker +Dolphin Emulator earlyoom Emacs Enable RDP @@ -55,8 +56,10 @@ FileZilla Firecracker Firefox Flatpak Setup +Flatseal Full System Upgrade/Update fzf +Gear Lever Geary Ghostty GIMP @@ -98,6 +101,7 @@ MATE Desktop Mattermost Microsoft Teams minikube +Moonlight mpv Mullvad VPN Multimedia Codecs @@ -121,8 +125,11 @@ OpenVPN Opera PHP Podman Desktop +PPSSPP +Prism Launcher Python RawTherapee +RetroArch Ruby Scribus Shotcut @@ -130,6 +137,7 @@ smartmontools Spotify starship Sublime Text +Sunshine tldr TLP tmux diff --git a/docs/utilities.md b/docs/utilities.md index 40b9b89..54c2d58 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -227,12 +227,20 @@ Grouped into folders inside the Development tab: |---------|-------------| | **Bottles** | Wine prefix manager for running Windows software | | **Boxflat** | Settings manager for Moza Racing sim-racing hardware (Flatpak) | +| **Dolphin Emulator** | Nintendo GameCube and Wii emulator. Distro package; Flathub on RHEL clones *(Emulators)* | | **Feral Gamemode** | Optimizes system performance while gaming | +| **Flatseal** | Shows and changes the permissions of Flatpak apps. Distro package where there is one, else Flathub; not available on Alpine *(Gaming Utilities)* | +| **Gear Lever** | Manages AppImage files (menu entries, updates, removal). Distro package on openSUSE, Flathub elsewhere; not available on Alpine *(Gaming Utilities)* | | **Heroic Games Launcher** | Open-source launcher for Epic, GOG, and Amazon Prime Gaming | | **Lutris** | Open gaming platform for multiple game sources | | **MangoHud** | Vulkan/OpenGL overlay for FPS, frame times, and hardware monitoring | +| **Moonlight** | Streams games from a Sunshine or GeForce PC to this one. Distro package on Fedora, Arch, openSUSE and Alpine, Flathub elsewhere *(Game Streaming)* | +| **PPSSPP** | Sony PSP emulator. Distro package on Arch, openSUSE and Alpine, Flathub elsewhere *(Emulators)* | +| **Prism Launcher** | Minecraft launcher with separate instances per version and mod loader. Distro package where there is one, else Flathub *(Game Launchers)* | | **ProtonUp-Qt** | Manages Proton-GE and Wine-GE compatibility layers | +| **RetroArch** | Frontend for the libretro emulator cores (consoles, arcade, computers). Distro package; Flathub on RHEL clones *(Emulators)* | | **Steam App** | Valve's gaming platform — native packages / RPM Fusion / flatpak | +| **Sunshine** | Game-streaming server for Moonlight clients. Flathub plus Sunshine's own setup step for virtual input (asks for your password in a desktop session); not available on Alpine *(Game Streaming)* | | **Wine** | Compatibility layer for running Windows applications and games on Linux | | **Xodus Nexus** | Unofficial Xbox-inspired launcher for Microsoft Store PC games (owned or Game Pass), x86_64 AppImage | diff --git a/lib/installers.sh b/lib/installers.sh index 73256cc..6c53fd1 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -474,6 +474,15 @@ fi register_utility "OpenVPN" install_openvpn check_openvpn uninstall_openvpn update_openvpn get_version_openvpn register_utility "Opera" install_opera check_opera uninstall_opera update_opera get_version_opera register_utility "WhatsApp" install_whatsapp check_whatsapp uninstall_whatsapp update_whatsapp get_version_whatsapp +# Gaming apps (#91): launcher, emulators, game streaming and Flatpak/AppImage helpers. Alpine keeps the five in alpine_packages.sh. +register_utility "Dolphin Emulator" install_dolphin_emulator check_dolphin_emulator uninstall_dolphin_emulator update_dolphin_emulator get_version_dolphin_emulator +register_utility "Flatseal" install_flatseal check_flatseal uninstall_flatseal update_flatseal get_version_flatseal +register_utility "Gear Lever" install_gear_lever check_gear_lever uninstall_gear_lever update_gear_lever get_version_gear_lever +register_utility "Moonlight" install_moonlight check_moonlight uninstall_moonlight update_moonlight get_version_moonlight +register_utility "PPSSPP" install_ppsspp check_ppsspp uninstall_ppsspp update_ppsspp get_version_ppsspp +register_utility "Prism Launcher" install_prism_launcher check_prism_launcher uninstall_prism_launcher update_prism_launcher get_version_prism_launcher +register_utility "RetroArch" install_retroarch check_retroarch uninstall_retroarch update_retroarch get_version_retroarch +register_utility "Sunshine" install_sunshine check_sunshine uninstall_sunshine update_sunshine get_version_sunshine # COSMIC: requires Ubuntu 24.10+/Debian Trixie, Fedora 42+, or Arch. # Not packaged for the RHEL ecosystem or openSUSE Leap/SLES. @@ -819,6 +828,14 @@ UTILITY_CATEGORY["NordVPN"]="Internet" UTILITY_CATEGORY["OpenVPN"]="Internet" UTILITY_CATEGORY["Opera"]="Internet" UTILITY_CATEGORY["WhatsApp"]="Internet" +UTILITY_CATEGORY["Dolphin Emulator"]="Gaming" +UTILITY_CATEGORY["Flatseal"]="Gaming" +UTILITY_CATEGORY["Gear Lever"]="Gaming" +UTILITY_CATEGORY["Moonlight"]="Gaming" +UTILITY_CATEGORY["PPSSPP"]="Gaming" +UTILITY_CATEGORY["Prism Launcher"]="Gaming" +UTILITY_CATEGORY["RetroArch"]="Gaming" +UTILITY_CATEGORY["Sunshine"]="Gaming" UTILITY_CATEGORY["zoxide"]="System Tools" UTILITY_CATEGORY["auto-cpufreq"]="System Tools" UTILITY_CATEGORY["BleachBit"]="System Tools" @@ -1003,6 +1020,14 @@ UTILITY_SUBCATEGORY["Mattermost"]="Messaging" UTILITY_SUBCATEGORY["Mullvad VPN"]="VPN" UTILITY_SUBCATEGORY["NordVPN"]="VPN" UTILITY_SUBCATEGORY["OpenVPN"]="VPN" +UTILITY_SUBCATEGORY["Dolphin Emulator"]="Emulators" +UTILITY_SUBCATEGORY["Flatseal"]="Gaming Utilities" +UTILITY_SUBCATEGORY["Gear Lever"]="Gaming Utilities" +UTILITY_SUBCATEGORY["Moonlight"]="Game Streaming" +UTILITY_SUBCATEGORY["PPSSPP"]="Emulators" +UTILITY_SUBCATEGORY["Prism Launcher"]="Game Launchers" +UTILITY_SUBCATEGORY["RetroArch"]="Emulators" +UTILITY_SUBCATEGORY["Sunshine"]="Game Streaming" UTILITY_SUBCATEGORY["Timeshift"]="Timeshift" UTILITY_SUBCATEGORY["Create Snapshot"]="Timeshift" UTILITY_SUBCATEGORY["Restore Snapshot"]="Timeshift" @@ -1143,6 +1168,7 @@ UTILITY_SUBCATEGORY["Manage Share"]="Mount / Unmount Shares" SUBCATEGORY_ORDER["Development"]="IDEs & Editors|AI Tools|Languages & Runtimes|Git|Containers & Kubernetes|Virtualization|Network & Security|Distrobox" SUBCATEGORY_ORDER["Drivers"]="CPU Microcode|GPU Drivers" SUBCATEGORY_ORDER["File Managers"]="Graphical|Terminal" +SUBCATEGORY_ORDER["Gaming"]="Game Launchers|Emulators|Game Streaming|Gaming Utilities" SUBCATEGORY_ORDER["Internet"]="Web Browsers|Web Browser Tweaks|Web Browser Extensions|Messaging|Email Clients|File Transfer|VPN" SUBCATEGORY_ORDER["Productivity"]="Office Suites|Notes|Password Managers|Encryption|Documents & Reading|Graphics & Photo|Video & Audio|Media" SUBCATEGORY_ORDER["Remote Admin Tools"]="Remote Access" @@ -1393,6 +1419,14 @@ UTILITY_DESCRIPTION["Zed"]="Fast code editor with built-in collaboration and AI. UTILITY_DESCRIPTION["zoxide"]="Smarter cd: remembers the folders you use and jumps to them with z, loaded from ~/.bashrc (and ~/.zshrc when it exists). Distro package (every release except Rocky/Alma 10); elsewhere the GitHub release, SHA-256 checked, in /usr/local/bin." UTILITY_DESCRIPTION["Opera"]="Opera web browser with a built-in ad blocker, free VPN-style proxy and sidebar messengers. Installed from Opera's own signed repository on Debian, Ubuntu, Fedora, RHEL clones (x86_64) and openSUSE, so updates arrive with the system; on Arch from Flathub when Flatpak is set up, otherwise the AUR (only with AUR support enabled). Not available on Alpine. Uninstall keeps your profile." UTILITY_DESCRIPTION["WhatsApp"]="WhatsApp has no official Linux app; this installs ZapZap, an open-source desktop client that wraps WhatsApp Web (link it with your phone's QR code). Distro package on openSUSE, Flathub elsewhere. Not available on Alpine. Uninstall keeps the linked session." +UTILITY_DESCRIPTION["Dolphin Emulator"]="Nintendo GameCube and Wii emulator. Distro package on Debian, Ubuntu, Fedora, Arch, openSUSE and Alpine; Flathub on RHEL clones. Uninstall keeps your saves and settings." +UTILITY_DESCRIPTION["Flatseal"]="Shows and changes the permissions of Flatpak apps (files, devices, network), for example for the Flatpak game apps here. Distro package where a repository has one, otherwise Flathub. Not available on Alpine. Uninstall keeps your permission overrides." +UTILITY_DESCRIPTION["Gear Lever"]="Manages AppImage files: menu entries, updates and removal. Distro package on openSUSE, Flathub elsewhere. Not available on Alpine. Uninstall keeps the AppImages it manages." +UTILITY_DESCRIPTION["Moonlight"]="Streams games from a Sunshine or GeForce PC to this computer. Distro package on Fedora, Arch, openSUSE and Alpine; Flathub elsewhere. Uninstall keeps your paired hosts." +UTILITY_DESCRIPTION["PPSSPP"]="Sony PSP emulator with upscaling and save states. Distro package on Arch, openSUSE and Alpine; Flathub elsewhere. Uninstall keeps your saves and settings." +UTILITY_DESCRIPTION["Prism Launcher"]="Minecraft launcher with separate instances per game version and mod loader. Distro package on Ubuntu 26.04, Arch, openSUSE and Alpine; Flathub elsewhere. Uninstall keeps your instances and accounts." +UTILITY_DESCRIPTION["RetroArch"]="Frontend for the libretro emulator cores (consoles, arcade, computers); fetch cores in the app's Online Updater. Distro package on Debian, Ubuntu, Fedora, Arch, openSUSE and Alpine; Flathub on RHEL clones. Uninstall keeps your saves and settings." +UTILITY_DESCRIPTION["Sunshine"]="Self-hosted game-streaming server for Moonlight clients. Flathub on every family, plus Sunshine's own setup step (virtual keyboard and gamepad rules, asks for your password in a desktop session). Web page at https://localhost:47990. Not available on Alpine. Uninstall removes those rules and keeps your pairings." UTILITY_DESCRIPTION["Microsoft Teams"]="Microsoft stopped its own Linux Teams app in 2022; this installs Teams for Linux, the open-source client that wraps the Teams web app (chat, meetings, notifications, screen sharing). Flathub, or the distro package where a repository has one. Not available on Alpine. Uninstall keeps your sign-in." UTILITY_DESCRIPTION["Mattermost"]="Desktop app for Mattermost, the self-hosted team chat. Distro package on Arch, Flathub elsewhere. Not available on Alpine. Uninstall keeps your saved servers." UTILITY_DESCRIPTION["Mullvad VPN"]="Mullvad's VPN app (WireGuard, no account email needed). Installed from Mullvad's own signed repository on Debian, Ubuntu, Fedora, RHEL clones and openSUSE, so updates arrive with the system; on Arch from the distro repository. The background service is enabled. Not available on Alpine." diff --git a/lib/installers/alpine_packages.sh b/lib/installers/alpine_packages.sh index 19c90c2..5ef1f1a 100644 --- a/lib/installers/alpine_packages.sh +++ b/lib/installers/alpine_packages.sh @@ -40,6 +40,11 @@ _ALPINE_TABLE=( "LibreOffice|libreoffice|soffice||" "Neovim|neovim|nvim||" "OpenVPN|openvpn|openvpn||" + "Prism Launcher|prismlauncher|prismlauncher||" + "Moonlight|moonlight-qt|moonlight||" + "RetroArch|retroarch|retroarch||" + "Dolphin Emulator|dolphin-emu|dolphin-emu||" + "PPSSPP|ppsspp|||" "Node.js|nodejs npm|node||" "OpenSSH Server|openssh-server|sshd|sshd|" "tmux|tmux|tmux||" diff --git a/lib/installers/dolphin_emulator.sh b/lib/installers/dolphin_emulator.sh new file mode 100644 index 0000000..2a95bb3 --- /dev/null +++ b/lib/installers/dolphin_emulator.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Dolphin Emulator installer functions +# +# GameCube and Wii emulator (registered as Dolphin Emulator because Dolphin is +# the KDE file manager's name here). The distro package on Debian, Ubuntu, +# Fedora, Arch, openSUSE and Alpine; Flathub on RHEL clones. + +# --- Dolphin Emulator --- + +check_dolphin_emulator() { _check_standard dolphin-emu dolphin-emu org.DolphinEmu.dolphin-emu; } + +install_dolphin_emulator() { + info "Installing Dolphin Emulator..." + native_or_flatpak_install org.DolphinEmu.dolphin-emu dolphin-emu || return 1 + info "Dolphin Emulator installed." +} + +# Your saves and settings are kept. +uninstall_dolphin_emulator() { + info "Uninstalling Dolphin Emulator..." + native_or_flatpak_uninstall org.DolphinEmu.dolphin-emu dolphin-emu +} + +update_dolphin_emulator() { + info "Updating Dolphin Emulator..." + native_or_flatpak_update org.DolphinEmu.dolphin-emu dolphin-emu +} + +get_version_dolphin_emulator() { native_or_flatpak_version org.DolphinEmu.dolphin-emu dolphin-emu; } diff --git a/lib/installers/flatseal.sh b/lib/installers/flatseal.sh new file mode 100644 index 0000000..aa03f6d --- /dev/null +++ b/lib/installers/flatseal.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Flatseal installer functions +# +# Permissions manager for Flatpak apps (useful for the Flatpak game apps +# here). The distro package where a repository has one, otherwise Flathub. Not +# offered on Alpine. + +# --- Flatseal --- + +check_flatseal() { _check_standard "" flatseal com.github.tchx84.Flatseal; } + +install_flatseal() { + info "Installing Flatseal..." + native_or_flatpak_install com.github.tchx84.Flatseal flatseal || return 1 + info "Flatseal installed." +} + +# Per-app permission overrides in ~/.local/share/flatpak/overrides are kept. +uninstall_flatseal() { + info "Uninstalling Flatseal..." + native_or_flatpak_uninstall com.github.tchx84.Flatseal flatseal +} + +update_flatseal() { + info "Updating Flatseal..." + native_or_flatpak_update com.github.tchx84.Flatseal flatseal +} + +get_version_flatseal() { native_or_flatpak_version com.github.tchx84.Flatseal flatseal; } diff --git a/lib/installers/gear_lever.sh b/lib/installers/gear_lever.sh new file mode 100644 index 0000000..8cbab61 --- /dev/null +++ b/lib/installers/gear_lever.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Gear Lever installer functions +# +# Manager for AppImage files (menu entries, updates, removal). The distro +# package on openSUSE; everywhere else its Flathub listing. Not offered on +# Alpine. + +# --- Gear Lever --- + +check_gear_lever() { _check_standard "" gearlever it.mijorus.gearlever; } + +install_gear_lever() { + info "Installing Gear Lever..." + native_or_flatpak_install it.mijorus.gearlever gearlever || return 1 + info "Gear Lever installed." +} + +# The AppImages it manages are kept. +uninstall_gear_lever() { + info "Uninstalling Gear Lever..." + native_or_flatpak_uninstall it.mijorus.gearlever gearlever +} + +update_gear_lever() { + info "Updating Gear Lever..." + native_or_flatpak_update it.mijorus.gearlever gearlever +} + +get_version_gear_lever() { native_or_flatpak_version it.mijorus.gearlever gearlever; } diff --git a/lib/installers/moonlight.sh b/lib/installers/moonlight.sh new file mode 100644 index 0000000..6d0dec4 --- /dev/null +++ b/lib/installers/moonlight.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Moonlight installer functions +# +# Game-streaming client for a Sunshine or GeForce host. The distro package +# (moonlight-qt; openSUSE calls it moonlight) on Fedora, Arch, openSUSE and +# Alpine; everywhere else Moonlight's own Flathub listing. + +# --- Moonlight --- + +_MOONLIGHT_FLATPAK="com.moonlight_stream.Moonlight" + +_moonlight_pkg() { + if [[ "${DISTRO_FAMILY:-}" == "suse" ]]; then echo moonlight; else echo moonlight-qt; fi +} + +check_moonlight() { _check_standard "" "$(_moonlight_pkg)" "$_MOONLIGHT_FLATPAK"; } + +install_moonlight() { + info "Installing Moonlight..." + native_or_flatpak_install "$_MOONLIGHT_FLATPAK" "$(_moonlight_pkg)" || return 1 + info "Moonlight installed." +} + +# The paired hosts and settings are kept. +uninstall_moonlight() { + info "Uninstalling Moonlight..." + native_or_flatpak_uninstall "$_MOONLIGHT_FLATPAK" "$(_moonlight_pkg)" +} + +update_moonlight() { + info "Updating Moonlight..." + native_or_flatpak_update "$_MOONLIGHT_FLATPAK" "$(_moonlight_pkg)" +} + +get_version_moonlight() { native_or_flatpak_version "$_MOONLIGHT_FLATPAK" "$(_moonlight_pkg)"; } diff --git a/lib/installers/ppsspp.sh b/lib/installers/ppsspp.sh new file mode 100644 index 0000000..b2bdaee --- /dev/null +++ b/lib/installers/ppsspp.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# PPSSPP installer functions +# +# PSP emulator. The distro package on Arch, openSUSE and Alpine; everywhere +# else its Flathub listing. + +# --- PPSSPP --- + +check_ppsspp() { _check_standard "" ppsspp org.ppsspp.PPSSPP; } + +install_ppsspp() { + info "Installing PPSSPP..." + native_or_flatpak_install org.ppsspp.PPSSPP ppsspp || return 1 + info "PPSSPP installed." +} + +# Your saves and settings are kept. +uninstall_ppsspp() { + info "Uninstalling PPSSPP..." + native_or_flatpak_uninstall org.ppsspp.PPSSPP ppsspp +} + +update_ppsspp() { + info "Updating PPSSPP..." + native_or_flatpak_update org.ppsspp.PPSSPP ppsspp +} + +get_version_ppsspp() { native_or_flatpak_version org.ppsspp.PPSSPP ppsspp; } diff --git a/lib/installers/prism_launcher.sh b/lib/installers/prism_launcher.sh new file mode 100644 index 0000000..1802d7d --- /dev/null +++ b/lib/installers/prism_launcher.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Prism Launcher installer functions +# +# The distro package where a repository has one (Ubuntu 26.04, Arch, openSUSE, +# Alpine); everywhere else Prism's own Flathub listing. Minecraft launcher +# with separate instances per game version and mod loader. + +# --- Prism Launcher --- + +check_prism_launcher() { _check_standard prismlauncher prismlauncher org.prismlauncher.PrismLauncher; } + +install_prism_launcher() { + info "Installing Prism Launcher..." + native_or_flatpak_install org.prismlauncher.PrismLauncher prismlauncher || return 1 + info "Prism Launcher installed." +} + +# Your instances, worlds and accounts are kept. +uninstall_prism_launcher() { + info "Uninstalling Prism Launcher..." + native_or_flatpak_uninstall org.prismlauncher.PrismLauncher prismlauncher +} + +update_prism_launcher() { + info "Updating Prism Launcher..." + native_or_flatpak_update org.prismlauncher.PrismLauncher prismlauncher +} + +get_version_prism_launcher() { native_or_flatpak_version org.prismlauncher.PrismLauncher prismlauncher; } diff --git a/lib/installers/retroarch.sh b/lib/installers/retroarch.sh new file mode 100644 index 0000000..2f6c604 --- /dev/null +++ b/lib/installers/retroarch.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# RetroArch installer functions +# +# The distro package on Debian, Ubuntu, Fedora, Arch, openSUSE and Alpine; +# Flathub on RHEL clones. Frontend for the libretro emulator cores; cores are +# fetched inside the app (Online Updater). + +# --- RetroArch --- + +check_retroarch() { _check_standard retroarch retroarch org.libretro.RetroArch; } + +install_retroarch() { + info "Installing RetroArch..." + native_or_flatpak_install org.libretro.RetroArch retroarch || return 1 + info "RetroArch installed." +} + +# Your saves, states and settings are kept. +uninstall_retroarch() { + info "Uninstalling RetroArch..." + native_or_flatpak_uninstall org.libretro.RetroArch retroarch +} + +update_retroarch() { + info "Updating RetroArch..." + native_or_flatpak_update org.libretro.RetroArch retroarch +} + +get_version_retroarch() { native_or_flatpak_version org.libretro.RetroArch retroarch; } diff --git a/lib/installers/sunshine.sh b/lib/installers/sunshine.sh new file mode 100644 index 0000000..d0dc8cd --- /dev/null +++ b/lib/installers/sunshine.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Sunshine installer functions +# +# Self-hosted game-streaming server for Moonlight clients. No distro packages +# it, and its own release packages are built per distro release, so every +# family uses Sunshine's Flathub listing. Sunshine's Flatpak needs one extra +# step, which its own page documents: additional-install.sh installs the user +# service and, through polkit, the uinput/uhid rules that let it create virtual +# keyboards and gamepads. That step needs a graphical session (the polkit +# prompt), so without one the command is printed instead. Not offered on Alpine. + +# --- Sunshine --- + +_SUNSHINE_FLATPAK="dev.lizardbyte.app.Sunshine" +_SUNSHINE_UDEV="/etc/udev/rules.d/60-sunshine.rules" +_SUNSHINE_MODULES="/etc/modules-load.d/60-sunshine.conf" +_SUNSHINE_SERVICE="$HOME/.config/systemd/user/app-dev.lizardbyte.app.Sunshine.service" + +check_sunshine() { _check_standard "" "" "$_SUNSHINE_FLATPAK"; } + +install_sunshine() { + info "Installing Sunshine..." + flatpak_install_flathub "$_SUNSHINE_FLATPAK" || return 1 + local cmd="flatpak run --command=additional-install.sh ${_SUNSHINE_FLATPAK}" + if [[ -n "${DISPLAY:-}${WAYLAND_DISPLAY:-}" ]] && command -v pkexec &>/dev/null; then + info "Setting up Sunshine's virtual input rules (a password prompt appears)..." + $cmd || warn "Sunshine's input setup did not finish. Run it again with: ${cmd}" + else + warn "Sunshine needs one more step, from a desktop session: ${cmd}" + fi + info "Sunshine installed. Its web page is https://localhost:47990 (the certificate is self-signed)." +} + +# Removes what Sunshine's setup step wrote, then the app. Its settings and +# pairings in ~/.var/app/${_SUNSHINE_FLATPAK} are kept. +uninstall_sunshine() { + info "Uninstalling Sunshine..." + systemctl --user disable --now app-dev.lizardbyte.app.Sunshine 2>/dev/null || true + rm -f "$_SUNSHINE_SERVICE" + if [[ -e "$_SUNSHINE_UDEV" || -e "$_SUNSHINE_MODULES" ]]; then + sudo rm -f "$_SUNSHINE_UDEV" "$_SUNSHINE_MODULES" + sudo udevadm control --reload-rules 2>/dev/null || true + fi + flatpak uninstall -y --user "$_SUNSHINE_FLATPAK" 2>/dev/null || \ + sudo flatpak uninstall -y --system "$_SUNSHINE_FLATPAK" +} + +update_sunshine() { + info "Updating Sunshine..." + flatpak update -y --user "$_SUNSHINE_FLATPAK" 2>/dev/null || \ + sudo flatpak update -y --system "$_SUNSHINE_FLATPAK" +} + +get_version_sunshine() { _ver_from_flatpak "$_SUNSHINE_FLATPAK" || echo ""; } diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 53a63b5..fb9c5d5 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -6011,6 +6011,96 @@ test_opera_uninstall_removes_repo_entries() { assert_eq "pkg_remove(opera-stable) sudo(rm -f /etc/apt/sources.list.d/opera-stable.list /etc/apt/sources.list.d/opera-stable.sources /usr/share/keyrings/opera-archive-keyring.gpg) " "$out" "Opera uninstall removes its repository entries and key" } +# --- Gaming apps (#91, stage 5) --- +echo "" +echo "=== Gaming apps (#91) ===" + +_GAME_APPS=( + "Dolphin Emulator|dolphin_emulator|Emulators" "Flatseal|flatseal|Gaming Utilities" "Gear Lever|gear_lever|Gaming Utilities" + "Moonlight|moonlight|Game Streaming" "PPSSPP|ppsspp|Emulators" "Prism Launcher|prism_launcher|Game Launchers" + "RetroArch|retroarch|Emulators" "Sunshine|sunshine|Game Streaming" +) + +test_game_apps_registered() { + local entry name slug sub fn gaps=0 + for entry in "${_GAME_APPS[@]}"; do + IFS='|' read -r name slug sub <<<"$entry" + grep -qE "^[[:space:]]*register_utility \"${name}\"[[:space:]]+install_${slug} " "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing register: $name"; } + grep -qF "UTILITY_CATEGORY[\"${name}\"]=\"Gaming\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing category: $name"; } + grep -qF "UTILITY_SUBCATEGORY[\"${name}\"]=\"${sub}\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " ${name} not in ${sub}"; } + grep -qF "UTILITY_DESCRIPTION[\"${name}\"]=" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing description: $name"; } + for fn in install check uninstall update get_version; do + grep -q "^${fn}_${slug}()" "${SCRIPT_DIR}/lib/installers/${slug}.sh" 2>/dev/null || { gaps=1; echo " missing ${fn}_${slug}"; } + done + grep -qxF " '${name}'" "${SCRIPT_DIR}/completions/_linux_util" || { gaps=1; echo " missing zsh completion: $name"; } + grep -qxF "${name}" "${SCRIPT_DIR}/completions/linux_util.bash" || { gaps=1; echo " missing bash completion: $name"; } + grep -qF "| **${name}** |" "${SCRIPT_DIR}/docs/utilities.md" || { gaps=1; echo " missing docs row: $name"; } + done + grep -qF 'SUBCATEGORY_ORDER["Gaming"]="Game Launchers|Emulators|Game Streaming|Gaming Utilities"' "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " no Gaming folder order"; } + assert_eq "0" "$gaps" "The 8 new Gaming apps are registered with category, folder, description, completions, docs row and all five functions" +} + +test_game_alpine_rows() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + have=""; for row in "${_ALPINE_TABLE[@]}"; do have+=" ${row%%|*}"; done + for n in "Prism Launcher" Moonlight RetroArch "Dolphin Emulator" PPSSPP; do + [[ " $have " == *" $n "* ]] || printf 'missing:%s ' "$n" + done + for n in Sunshine Flatseal "Gear Lever"; do + [[ " $have " == *" $n "* ]] && printf 'unexpected:%s ' "$n" + done + echo done + ) + assert_eq "done" "$out" "Alpine offers Prism Launcher, Moonlight, RetroArch, Dolphin Emulator and PPSSPP, and hides Sunshine, Flatseal and Gear Lever" +} + +# openSUSE calls the Moonlight package "moonlight"; every other family "moonlight-qt". +test_moonlight_package_name() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/moonlight.sh" + info() { :; } + native_or_flatpak_install() { printf '%s:%s ' "$1" "$2"; } + DISTRO_FAMILY=suse; install_moonlight + DISTRO_FAMILY=fedora; install_moonlight + ) + assert_eq "com.moonlight_stream.Moonlight:moonlight com.moonlight_stream.Moonlight:moonlight-qt " "$out" "Moonlight installs moonlight on openSUSE and moonlight-qt elsewhere" +} + +# Sunshine's input setup needs a desktop session; without one the command is printed, not run. +test_sunshine_setup_step() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/sunshine.sh" + info() { :; }; warn() { printf 'WARN(%s) ' "$*"; } + flatpak_install_flathub() { printf 'flathub(%s) ' "$1"; } + flatpak() { printf 'flatpak(%s) ' "$*"; } + pkexec() { :; } + DISPLAY=""; WAYLAND_DISPLAY=""; install_sunshine + DISPLAY=":0"; install_sunshine + ) + assert_eq "flathub(dev.lizardbyte.app.Sunshine) WARN(Sunshine needs one more step, from a desktop session: flatpak run --command=additional-install.sh dev.lizardbyte.app.Sunshine) flathub(dev.lizardbyte.app.Sunshine) flatpak(run --command=additional-install.sh dev.lizardbyte.app.Sunshine) " "$out" "Sunshine runs its setup step in a desktop session and prints the command otherwise" +} + +test_sunshine_uninstall_removes_rules() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/sunshine.sh" + info() { :; } + tmp=$(mktemp -d) + _SUNSHINE_UDEV="$tmp/60-sunshine.rules"; _SUNSHINE_MODULES="$tmp/60-sunshine.conf"; _SUNSHINE_SERVICE="$tmp/svc" + : >"$_SUNSHINE_UDEV"; : >"$_SUNSHINE_MODULES"; : >"$_SUNSHINE_SERVICE" + systemctl() { :; }; udevadm() { :; }; flatpak() { printf 'flatpak(%s) ' "$*"; } + sudo() { "$@"; } + uninstall_sunshine + ls "$tmp" | wc -l + rm -rf "$tmp" + ) + assert_eq "flatpak(uninstall -y --user dev.lizardbyte.app.Sunshine) 0" "$out" "Sunshine uninstall removes the rules and service its setup step wrote, then the app" +} + # --- Verified GitHub downloads --- _GH_FIXTURE='{"tag_name": "v1.2.3","assets": [ {"name": "tool_1.2.3_linux_x86_64.tar.gz","uploader": {"login": "bot"},"size": 9,"digest": "sha256:'"$(printf 'a%.0s' {1..64})"'","browser_download_url": "https://x/tool_1.2.3_linux_x86_64.tar.gz"}, @@ -6249,6 +6339,11 @@ test_net_apps_held_back test_net_vendor_repo_installs_stop_on_failure test_nordvpn_adds_user_to_group test_opera_uninstall_removes_repo_entries +test_game_apps_registered +test_game_alpine_rows +test_moonlight_package_name +test_sunshine_setup_step +test_sunshine_uninstall_removes_rules test_github_asset_info test_github_asset_download_checks_digest test_upstream_arch_and_regex From d2585fa2d8bea3b91b0ba7d7fba5ba36ef9afcfb Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 13:04:46 -0500 Subject: [PATCH 12/14] test: make nordvpn group test independent of systemd availability The test's sudo stub recorded every call, so its output also depended on whether the machine had systemd and enabled the service. Record only the usermod call so the assertion checks just the group membership behavior. --- tests/test_linux_util.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index fb9c5d5..51d4f74 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -5988,7 +5988,8 @@ test_nordvpn_adds_user_to_group() { source "${SCRIPT_DIR}/lib/installers/nordvpn.sh" info() { :; }; warn() { :; } systemctl() { :; } - sudo() { printf 'sudo(%s) ' "$*"; } + # Only the group command is recorded: whether the service is also enabled depends on the machine having systemd. + sudo() { [[ "$1" == usermod ]] && printf 'sudo(%s) ' "$*"; return 0; } getent() { return 0; } SUDO_USER=""; USER=nick; _nordvpn_setup_access USER=root; _nordvpn_setup_access From 1317c76b17c550777c279d2b8106260f507ac773 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 13:34:41 -0500 Subject: [PATCH 13/14] feat(backup): add 9 backup tools and group Backup into folders Add restic, rclone, Kopia, rsnapshot, Back In Time, Pika Backup, luckyBackup, Grsync and Clonezilla (fixes #92). Backup is now split into File Backup and Command Line folders beside Timeshift and Snapper. Each tool is held back where no package exists: restic and rclone on Rocky/Alma 8, Back In Time on Rocky/Alma 10, luckyBackup on RHEL clones, and Clonezilla outside Debian, Ubuntu and Arch. Back In Time and luckyBackup are AUR-only on Arch. Alpine offers restic, rclone and rsnapshot only. Kopia installs from its GitHub release with a SHA-256 check where no package exists, so add an @X64@ token for its x64/arm64 file names. Also make github_binary_install work without find on minimal images. Update the README, docs, completions, changelog and tests. --- CHANGELOG.md | 12 ++++ README.md | 4 +- completions/_linux_util | 9 +++ completions/linux_util.bash | 9 +++ docs/utilities.md | 9 +++ lib/installers.sh | 57 +++++++++++++++- lib/installers/_shared.sh | 16 +++-- lib/installers/alpine_packages.sh | 3 + lib/installers/back_in_time.sh | 49 ++++++++++++++ lib/installers/clonezilla.sh | 31 +++++++++ lib/installers/grsync.sh | 29 ++++++++ lib/installers/kopia.sh | 37 ++++++++++ lib/installers/luckybackup.sh | 41 ++++++++++++ lib/installers/pika_backup.sh | 30 +++++++++ lib/installers/rclone.sh | 30 +++++++++ lib/installers/restic.sh | 30 +++++++++ lib/installers/rsnapshot.sh | 31 +++++++++ tests/test_linux_util.sh | 108 ++++++++++++++++++++++++++++++ 18 files changed, 526 insertions(+), 9 deletions(-) create mode 100644 lib/installers/back_in_time.sh create mode 100644 lib/installers/clonezilla.sh create mode 100644 lib/installers/grsync.sh create mode 100644 lib/installers/kopia.sh create mode 100644 lib/installers/luckybackup.sh create mode 100644 lib/installers/pika_backup.sh create mode 100644 lib/installers/rclone.sh create mode 100644 lib/installers/restic.sh create mode 100644 lib/installers/rsnapshot.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index ded0f88..0a47caa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,18 @@ when a release is cut. ### Added +- **9 more Backup tools** (fixes #92). Command line: restic, rclone, Kopia and + rsnapshot. Desktop: Back In Time, Pika Backup, luckyBackup and Grsync. + Also Clonezilla (the package, for disks that are not mounted; the live disk + is still needed to clone the running system). Each uses the distro package + (EPEL on RHEL clones); Kopia otherwise uses its GitHub release, checked + against its published SHA-256, and Pika Backup uses Flathub where there is no + package. rsnapshot needs your own config and schedule. Backup is now sorted + into **File Backup** and **Command Line** folders beside Timeshift and + Snapper. Not offered: restic and rclone on Rocky/Alma 8, Back In Time on + Rocky/Alma 10, luckyBackup on RHEL clones, Clonezilla on Fedora, RHEL clones + and openSUSE; Back In Time and luckyBackup on Arch need AUR support; on + Alpine only restic, rclone and rsnapshot. - **8 more Gaming apps** (part of #91). Launcher: Prism Launcher (Minecraft). Emulators: RetroArch, Dolphin Emulator and PPSSPP. Game streaming: Sunshine (host) and Moonlight (client). Utilities: Flatseal (Flatpak permissions) and diff --git a/README.md b/README.md index d92b299..191abed 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Unique cloners](https://img.shields.io/badge/unique%20cloners-30-brightgreen)](https://github.com/acebmxer/linux_util/graphs/traffic) [![Shell: Bash](https://img.shields.io/badge/shell-bash-4EAA25?logo=gnubash&logoColor=white)](linux_util.sh) [![Platform: Linux](https://img.shields.io/badge/platform-linux-333333?logo=linux&logoColor=white)](#supported-distributions) -[![Tests](https://img.shields.io/badge/tests-604%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Tests](https://img.shields.io/badge/tests-608%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) [![Distros tested](https://img.shields.io/badge/distros%20tested-6-informational)](#supported-distributions) [![ShellCheck](https://img.shields.io/badge/shellcheck-clean-brightgreen)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) @@ -125,7 +125,7 @@ selection rules and the profile table: [docs/menu.md](docs/menu.md). | **Bootloaders** | GRUB, Limine, systemd-boot, switching between them, and five GRUB theme packs | | **Drivers** | NVIDIA, AMD and Intel GPU (with video acceleration), Intel and AMD microcode, LACT, OpenLogi, Thermalright TRCC, XEN guest tools | | **Desktop Environments** | KDE Plasma, GNOME, Xfce, Cinnamon, MATE, LXQt, Budgie, COSMIC, Deepin, Pantheon | -| **Backup** | Timeshift and Snapper (create/restore/delete), Déjà Dup, Kup, Vorta, Duplicati | +| **Backup** | Folders for File Backup (Déjà Dup, Kup, Vorta, Duplicati, Back In Time, Pika Backup, luckyBackup, Grsync), Command Line (restic, rclone, Kopia, rsnapshot), Timeshift and Snapper (create/restore/delete), plus Clonezilla | | **Disk Utilities** | GParted, Ventoy, KDiskMark, and a Btrfs toolset (Assistant, btrfsmaintenance, btrbk, duperemove) | | **Development** | Folders for IDEs & Editors (VS Code, VSCodium, Cursor, JetBrains Toolbox, Neovim, Vim, Emacs, Helix, Sublime Text, Zed), AI Tools (Claude Code, Claude Desktop, Codex, Hermes Agent, LM Studio, Ollama), Languages & Runtimes (Python, Java JDK, PHP, Ruby, Go, Node/NVM, Rust, pyenv), Git (GitHub CLI, lazygit), Containers & Kubernetes (Docker, Podman, Podman Desktop, kubectl, k9s, Helm, minikube, k3s), Virtualization (VirtualBox, Virt-Manager, Firecracker), Network & Security (Wireshark, nmap) and Distrobox, plus Terraform, OpenTofu, Ansible, DBeaver, Postman, PowerShell and Toolbx | | **Gaming** | Folders for Game Launchers (Steam, Lutris, Heroic, Bottles, Prism Launcher, Xodus Nexus), Emulators (RetroArch, Dolphin Emulator, PPSSPP), Game Streaming (Sunshine, Moonlight) and Gaming Utilities (Wine, ProtonUp-Qt, MangoHud, Gamemode, Boxflat, Flatseal, Gear Lever) | diff --git a/completions/_linux_util b/completions/_linux_util index d4c2c3d..aaaaca5 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -11,6 +11,7 @@ _linux_util_utilities=( 'Anki' 'ArtCraft Launcher' 'auto-cpufreq' + 'Back In Time' 'bat' 'Betterbird' 'Bitwarden Client' @@ -29,6 +30,7 @@ _linux_util_utilities=( 'Claude Code' 'Claude Desktop' 'Claws Mail' + 'Clonezilla' 'Cockpit' 'Codex' 'Command-Not-Found Prompt' @@ -68,6 +70,7 @@ _linux_util_utilities=( 'GNOME Desktop' 'Google Chrome' 'GPU Task Manager' + 'Grsync' 'GTK Window Fix' 'HardInfo' 'Helix' @@ -88,12 +91,14 @@ _linux_util_utilities=( 'kitty' 'KMail' 'Kodi' + 'Kopia' 'lazygit' 'LibreOffice' 'linux-tkg' 'Local Time Zone / Locale' 'LM Studio' 'LocalSend' + 'luckyBackup' 'Lutris' 'LXQt Desktop' 'Mainline' @@ -126,12 +131,16 @@ _linux_util_utilities=( 'OpenVPN' 'Opera' 'PHP' + 'Pika Backup' 'Podman Desktop' 'PPSSPP' 'Prism Launcher' 'Python' 'RawTherapee' + 'rclone' + 'restic' 'RetroArch' + 'rsnapshot' 'Ruby' 'Scribus' 'Shotcut' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index 568e813..20f1ad0 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -9,6 +9,7 @@ AMD Drivers Anki ArtCraft Launcher auto-cpufreq +Back In Time bat Betterbird Bitwarden Client @@ -27,6 +28,7 @@ Cinnamon Desktop Claude Code Claude Desktop Claws Mail +Clonezilla Cockpit Codex Command-Not-Found Prompt @@ -67,6 +69,7 @@ GitHub CLI GNOME Desktop Google Chrome GPU Task Manager +Grsync GTK Window Fix HardInfo Helix @@ -87,12 +90,14 @@ KeePassXC kitty KMail Kodi +Kopia lazygit LibreOffice linux-tkg Local Time Zone / Locale LM Studio LocalSend +luckyBackup Lutris LXQt Desktop Mainline @@ -124,12 +129,16 @@ OpenSSH Server OpenVPN Opera PHP +Pika Backup Podman Desktop PPSSPP Prism Launcher Python RawTherapee +rclone +restic RetroArch +rsnapshot Ruby Scribus Shotcut diff --git a/docs/utilities.md b/docs/utilities.md index 54c2d58..6c68dbb 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -110,6 +110,15 @@ appear when it applies. | **Kup** | KDE backup tool — incremental (bup) or synchronized (rsync) backups via System Settings | | **Vorta** | Borg Backup GUI — deduplicating, encrypted backups | | **Duplicati** | Browser-based backup tool with cloud provider support | +| **Back In Time** | Snapshot backups of your files with rsync and a Qt window. Distro package (EPEL on RHEL clones 8 and 9), AUR on Arch (AUR support must be on); not available on Rocky/Alma 10 or Alpine *(File Backup)* | +| **Pika Backup** | Scheduled home-folder backups with BorgBackup. Distro package on Arch and openSUSE Tumbleweed, Flathub elsewhere; not available on Alpine *(File Backup)* | +| **luckyBackup** | Rsync-based backup and sync with profiles and scheduling. Distro package, AUR on Arch (AUR support must be on); not available on RHEL clones or Alpine *(File Backup)* | +| **Grsync** | Graphical front-end for rsync with saved presets. Distro package (EPEL on RHEL clones); not available on Alpine *(File Backup)* | +| **restic** | Encrypted, deduplicating command-line backup to local, SFTP, S3 and cloud stores. Distro package; not available on Rocky/Alma 8 *(Command Line)* | +| **rclone** | Command-line copy and sync to dozens of cloud storage services. Distro package; not available on Rocky/Alma 8 *(Command Line)* | +| **Kopia** | Fast, encrypted, deduplicating backup with a web page (`kopia server start`). Distro package on Fedora and openSUSE, SHA-256 checked GitHub release elsewhere; command line only; not available on Alpine *(Command Line)* | +| **rsnapshot** | Scheduled rsync snapshots with hard links; you write the config and the schedule *(Command Line)* | +| **Clonezilla** | Disk and partition cloning for disks that are not mounted; the live disk is needed to clone the running system. Debian, Ubuntu and Arch only | ## Disk Utilities diff --git a/lib/installers.sh b/lib/installers.sh index 6c53fd1..01ac784 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -483,6 +483,28 @@ register_utility "PPSSPP" install_ppsspp check_ppsspp register_utility "Prism Launcher" install_prism_launcher check_prism_launcher uninstall_prism_launcher update_prism_launcher get_version_prism_launcher register_utility "RetroArch" install_retroarch check_retroarch uninstall_retroarch update_retroarch get_version_retroarch register_utility "Sunshine" install_sunshine check_sunshine uninstall_sunshine update_sunshine get_version_sunshine +# Backup tools (#91 follow-up, #92). Only the ones with no package on a family are held back; Alpine keeps only the three in alpine_packages.sh. +register_utility "Grsync" install_grsync check_grsync uninstall_grsync update_grsync get_version_grsync +register_utility "Kopia" install_kopia check_kopia uninstall_kopia update_kopia get_version_kopia +register_utility "Pika Backup" install_pika_backup check_pika_backup uninstall_pika_backup update_pika_backup get_version_pika_backup +register_utility "rsnapshot" install_rsnapshot check_rsnapshot uninstall_rsnapshot update_rsnapshot get_version_rsnapshot +# restic and rclone: no package for Rocky/Alma 8. +if [[ "$DISTRO_FAMILY" != "rhel" || "${DISTRO_VERSION_ID%%.*}" -ge 9 ]]; then + register_utility "restic" install_restic check_restic uninstall_restic update_restic get_version_restic + register_utility "rclone" install_rclone check_rclone uninstall_rclone update_rclone get_version_rclone +fi +# Back In Time: EPEL carries it for RHEL clones 8 and 9, not 10. +if [[ "$DISTRO_FAMILY" != "rhel" || "${DISTRO_VERSION_ID%%.*}" -lt 10 ]]; then + register_utility "Back In Time" install_back_in_time check_back_in_time uninstall_back_in_time update_back_in_time get_version_back_in_time +fi +# luckyBackup: no package for RHEL clones. +if [[ "$DISTRO_FAMILY" != "rhel" ]]; then + register_utility "luckyBackup" install_luckybackup check_luckybackup uninstall_luckybackup update_luckybackup get_version_luckybackup +fi +# Clonezilla: packaged for Debian, Ubuntu and Arch only. +if [[ "$DISTRO_FAMILY" == "debian" || "$DISTRO_FAMILY" == "arch" ]]; then + register_utility "Clonezilla" install_clonezilla check_clonezilla uninstall_clonezilla update_clonezilla get_version_clonezilla +fi # COSMIC: requires Ubuntu 24.10+/Debian Trixie, Fedora 42+, or Arch. # Not packaged for the RHEL ecosystem or openSUSE Leap/SLES. @@ -770,6 +792,15 @@ UTILITY_CATEGORY["Déjà Dup"]="Backup" UTILITY_CATEGORY["Kup"]="Backup" UTILITY_CATEGORY["Vorta"]="Backup" UTILITY_CATEGORY["Duplicati"]="Backup" +UTILITY_CATEGORY["Back In Time"]="Backup" +UTILITY_CATEGORY["Clonezilla"]="Backup" +UTILITY_CATEGORY["Grsync"]="Backup" +UTILITY_CATEGORY["Kopia"]="Backup" +UTILITY_CATEGORY["luckyBackup"]="Backup" +UTILITY_CATEGORY["Pika Backup"]="Backup" +UTILITY_CATEGORY["rclone"]="Backup" +UTILITY_CATEGORY["restic"]="Backup" +UTILITY_CATEGORY["rsnapshot"]="Backup" UTILITY_CATEGORY["Visual Studio Code"]="Development" UTILITY_CATEGORY["VSCodium"]="Development" UTILITY_CATEGORY["Vivaldi Browser"]="Internet" @@ -1045,6 +1076,14 @@ UTILITY_SUBCATEGORY["Déjà Dup"]="File Backup" UTILITY_SUBCATEGORY["Kup"]="File Backup" UTILITY_SUBCATEGORY["Vorta"]="File Backup" UTILITY_SUBCATEGORY["Duplicati"]="File Backup" +UTILITY_SUBCATEGORY["Back In Time"]="File Backup" +UTILITY_SUBCATEGORY["Pika Backup"]="File Backup" +UTILITY_SUBCATEGORY["luckyBackup"]="File Backup" +UTILITY_SUBCATEGORY["Grsync"]="File Backup" +UTILITY_SUBCATEGORY["restic"]="Command Line" +UTILITY_SUBCATEGORY["rclone"]="Command Line" +UTILITY_SUBCATEGORY["Kopia"]="Command Line" +UTILITY_SUBCATEGORY["rsnapshot"]="Command Line" UTILITY_SUBCATEGORY["AMD CPU Microcode & Firmware"]="CPU Microcode" UTILITY_SUBCATEGORY["AMD Drivers"]="GPU Drivers" UTILITY_SUBCATEGORY["Intel Drivers"]="GPU Drivers" @@ -1172,6 +1211,7 @@ SUBCATEGORY_ORDER["Gaming"]="Game Launchers|Emulators|Game Streaming|Gaming Util SUBCATEGORY_ORDER["Internet"]="Web Browsers|Web Browser Tweaks|Web Browser Extensions|Messaging|Email Clients|File Transfer|VPN" SUBCATEGORY_ORDER["Productivity"]="Office Suites|Notes|Password Managers|Encryption|Documents & Reading|Graphics & Photo|Video & Audio|Media" SUBCATEGORY_ORDER["Remote Admin Tools"]="Remote Access" +SUBCATEGORY_ORDER["Backup"]="File Backup|Command Line|Timeshift|Snapper" SUBCATEGORY_ORDER["Bootloaders"]="GRUB Themes" SUBCATEGORY_ORDER["Login Screens"]="Display Managers|SDDM Themes|LightDM Greeters" SUBCATEGORY_ORDER["System Tools"]="Monitors|Power & Memory|Disk & Cleanup|System Info|Shell Tools|Terminal Emulators|Kernel Managers" @@ -1464,6 +1504,15 @@ UTILITY_DESCRIPTION["Déjà Dup"]="(GNOME) Simple, beginner-friendly backup tool UTILITY_DESCRIPTION["Kup"]="(KDE) Backup tool that integrates with Plasma System Settings. Supports incremental versioned backups (via bup) and synchronized folder copies (via rsync) to local drives or external media. On Fedora, installed from the zawertun/kde-kup Copr as it is not in the official repos. Not available for RHEL-based systems." UTILITY_DESCRIPTION["Vorta"]="GUI frontend for BorgBackup — a fast, deduplicating backup tool with encryption and compression. Installs both Borg (CLI) and Vorta (GUI). On RHEL-based systems, only BorgBackup is installed via EPEL as Vorta is not packaged there." UTILITY_DESCRIPTION["Duplicati"]="Cloud backup tool with a web-based GUI supporting S3, Google Drive, OneDrive, SFTP, and many more backends. Features encryption, deduplication, and scheduling. Installed via Flatpak — run 'Flatpak Setup' from the Package Managers category first if not already configured." +UTILITY_DESCRIPTION["Back In Time"]="Simple snapshot backups of your files using rsync, with a Qt window; restore any snapshot. Distro package on Debian, Ubuntu, Fedora, RHEL clones 8 and 9 (EPEL) and openSUSE; on Arch from the AUR (only with AUR support enabled). Not available on Rocky/Alma 10 or Alpine. Uninstall keeps your snapshots and profiles." +UTILITY_DESCRIPTION["Clonezilla"]="Disk and partition cloning and imaging. Installs the Clonezilla package (Debian, Ubuntu, Arch) for use on disks that are not mounted; cloning the running system's own disk needs the live Clonezilla disk (Ventoy can boot it). Not available on Fedora, RHEL clones, openSUSE or Alpine." +UTILITY_DESCRIPTION["Grsync"]="Graphical front-end for rsync: sync and back up folders with saved presets. Distro package (EPEL on RHEL clones). Not available on Alpine. Uninstall keeps your saved sessions." +UTILITY_DESCRIPTION["Kopia"]="Fast, encrypted, deduplicating backup with snapshots and a web page (kopia server start). The command-line program: distro package on Fedora and openSUSE; elsewhere Kopia's GitHub release, SHA-256 checked, in /usr/local/bin. The KopiaUI desktop app is not installed. Not available on Alpine. Uninstall keeps your repository connections." +UTILITY_DESCRIPTION["luckyBackup"]="Graphical rsync-based backup and sync with profiles and scheduling. Distro package on Debian, Ubuntu, Fedora and openSUSE; on Arch from the AUR (only with AUR support enabled). Not available on RHEL clones or Alpine. Uninstall keeps your profiles." +UTILITY_DESCRIPTION["Pika Backup"]="Simple scheduled backups of your home folder with BorgBackup, in a desktop window. Distro package on Arch and openSUSE Tumbleweed; Flathub elsewhere. Not available on Alpine. Uninstall keeps your schedule and repository settings." +UTILITY_DESCRIPTION["rclone"]="Command-line tool that copies and syncs files to and from dozens of cloud storage services. Distro package (EPEL on RHEL clones 9 and newer). Not available on Rocky/Alma 8. Uninstall keeps your rclone.conf." +UTILITY_DESCRIPTION["restic"]="Fast, encrypted, deduplicating command-line backup to a local folder, SFTP, S3 and many cloud stores. Distro package (EPEL on RHEL clones 9 and newer). Not available on Rocky/Alma 8. Uninstall keeps your repositories." +UTILITY_DESCRIPTION["rsnapshot"]="Scheduled, space-saving snapshots of folders using rsync and hard links. Distro package (EPEL on RHEL clones). You write /etc/rsnapshot.conf and the cron or timer entry yourself; neither is created. Uninstall keeps /etc/rsnapshot.conf." UTILITY_DESCRIPTION["Snapper"]="Btrfs and LVM snapshot manager. Supports automatic pre/post snapshots on Arch, openSUSE, Debian/Ubuntu, and Fedora. Conflicts with Timeshift — the installer will prompt to remove it first." UTILITY_DESCRIPTION["Snapper GUI"]="GTK graphical interface for Snapper. Browse, create, delete, and compare snapshots visually. Works on any filesystem Snapper supports — does not require Btrfs." UTILITY_DESCRIPTION["Btrfs Assistant"]="Qt GUI for managing Btrfs filesystems and Snapper snapshots. Includes subvolume management, snapshot browsing, and scrub/balance operations. Available on Arch, Debian/Ubuntu, Fedora, and openSUSE." @@ -1541,7 +1590,7 @@ mark_aur_only_arch \ "Snap (snapd)=snapd" "Snapper GUI=snapper-gui-git" \ "Trojita=trojita" "Zotero=zotero" "1Password=1password" \ "auto-cpufreq=auto-cpufreq" "Sublime Text=sublime-text-4" \ - "NordVPN=nordvpn-bin" + "NordVPN=nordvpn-bin" "Back In Time=backintime" "luckyBackup=luckybackup" # Utilities that can install from upstream's own binary when no package source # carries them (the third tier of arch_install_ordered, reached on Arch because @@ -1575,7 +1624,8 @@ mark_upstream_binary \ "starship=/usr/local/bin/starship" \ "minikube=/usr/local/bin/minikube" \ "k3s=/usr/local/bin/k3s-uninstall.sh" \ - "Ollama=/usr/local/lib/ollama" + "Ollama=/usr/local/lib/ollama" \ + "Kopia=/usr/local/bin/kopia" # Where the current upstream version can be read for those installs. Registered # only for the ones with a cheap, stable version endpoint: these lookups gate @@ -1599,7 +1649,8 @@ mark_upstream_latest \ "starship=_starship_latest_version" \ "minikube=_minikube_latest_version" \ "k3s=_k3s_latest_version" \ - "Ollama=_ollama_latest_version" + "Ollama=_ollama_latest_version" \ + "Kopia=_kopia_latest_version" # Utilities whose own run is a complete system upgrade, so the pre-flight package # refresh must not upgrade ahead of them -- see mark_full_upgrade in utilities.sh. diff --git a/lib/installers/_shared.sh b/lib/installers/_shared.sh index 987f146..05f2140 100644 --- a/lib/installers/_shared.sh +++ b/lib/installers/_shared.sh @@ -656,14 +656,16 @@ shell_init_remove() { # package is installed. # ============================================================================ -# Fill @GNU@ (x86_64|aarch64), @GO@ (amd64|arm64) and @GOX@ (x86_64|arm64) in an +# Fill @GNU@ (x86_64|aarch64), @GO@ (amd64|arm64), @GOX@ (x86_64|arm64) and @X64@ (x64|arm64) in an # asset-name regex with this machine's names. _upstream_expand_regex() { - local re="$1" gnu go gox + local re="$1" gnu go gox x64 gnu=$(upstream_arch gnu) || return 1 go=$(upstream_arch go) || return 1 gox=$gnu; [[ "$gnu" == aarch64 ]] && gox=arm64 - re="${re//@GNU@/$gnu}"; re="${re//@GO@/$go}"; re="${re//@GOX@/$gox}" + # @X64@ (x64|arm64) is the spelling Kopia's release files use. + x64=x64; [[ "$gnu" == aarch64 ]] && x64=arm64 + re="${re//@GNU@/$gnu}"; re="${re//@GO@/$go}"; re="${re//@GOX@/$gox}"; re="${re//@X64@/$x64}" printf '%s\n' "$re" } @@ -678,7 +680,13 @@ github_binary_install() { file=$(github_asset_download "$repo" "$re" "$tmp") || { rm -rf "$tmp"; return 1; } if [[ "$file" == *.tar.gz || "$file" == *.tgz ]]; then tar -xzf "$file" -C "$tmp" || { error "Could not unpack $(basename "$file")."; rm -rf "$tmp"; return 1; } - found=$(find "$tmp" -type f -name "$bin" | head -1) + if command -v find &>/dev/null; then + found=$(find "$tmp" -type f -name "$bin" | head -1) + else + # A minimal image (Rocky) has no findutils: the binary is at the top or one folder down. + local cand + for cand in "$tmp/$bin" "$tmp"/*/"$bin"; do [[ -f "$cand" ]] && { found="$cand"; break; }; done + fi else found="$file" fi diff --git a/lib/installers/alpine_packages.sh b/lib/installers/alpine_packages.sh index 5ef1f1a..b4893d5 100644 --- a/lib/installers/alpine_packages.sh +++ b/lib/installers/alpine_packages.sh @@ -40,6 +40,9 @@ _ALPINE_TABLE=( "LibreOffice|libreoffice|soffice||" "Neovim|neovim|nvim||" "OpenVPN|openvpn|openvpn||" + "restic|restic|restic||" + "rclone|rclone|rclone||" + "rsnapshot|rsnapshot|rsnapshot||" "Prism Launcher|prismlauncher|prismlauncher||" "Moonlight|moonlight-qt|moonlight||" "RetroArch|retroarch|retroarch||" diff --git a/lib/installers/back_in_time.sh b/lib/installers/back_in_time.sh new file mode 100644 index 0000000..892e0ad --- /dev/null +++ b/lib/installers/back_in_time.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Back In Time installer functions +# +# Simple snapshot backups of your files using rsync, with a Qt window. The +# distro package on Debian, Ubuntu, Fedora, RHEL clones 8 and 9 (EPEL) and +# openSUSE; on Arch from the AUR (only with AUR support enabled). Not offered +# on Rocky/Alma 10 or Alpine. + +# --- Back In Time --- + +check_back_in_time() { _check_standard backintime-qt backintime-qt "" backintime; } + +install_back_in_time() { + info "Installing Back In Time..." + ensure_epel + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur backintime || return 1 + else + pkg_install backintime-qt || return 1 + fi + info "Back In Time installed." +} + +# Your snapshots and profiles are kept. +uninstall_back_in_time() { + info "Uninstalling Back In Time..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + aur_remove backintime 2>/dev/null || pkg_remove backintime + else + pkg_remove backintime-qt + # The command-line part comes along as a dependency: backintime-common, or + # plain "backintime" on openSUSE. + local dep + for dep in backintime-common backintime; do + if pkg_check_installed "$dep"; then pkg_remove "$dep"; fi + done + fi +} + +update_back_in_time() { + info "Updating Back In Time..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur backintime + else + pkg_upgrade backintime-qt + fi +} + +get_version_back_in_time() { _ver_from_pkg backintime-qt || _ver_from_pkg backintime || echo ""; } diff --git a/lib/installers/clonezilla.sh b/lib/installers/clonezilla.sh new file mode 100644 index 0000000..f60c208 --- /dev/null +++ b/lib/installers/clonezilla.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Clonezilla installer functions +# +# Clonezilla is mostly known as a live boot disk. Its tools also come as a +# package, which this installs: the distro package on Debian, Ubuntu and Arch. +# Fedora, RHEL clones and openSUSE have no package, so it is not offered there +# (use Ventoy to boot the live ISO). Run it as root (sudo clonezilla) on disks +# that are not mounted; cloning the running system's own disk needs the live +# version. + +# --- Clonezilla --- + +check_clonezilla() { _check_standard clonezilla clonezilla ""; } + +install_clonezilla() { + info "Installing Clonezilla..." + pkg_install clonezilla || return 1 + info "Clonezilla installed." +} + +uninstall_clonezilla() { + info "Uninstalling Clonezilla..." + pkg_remove clonezilla +} + +update_clonezilla() { + info "Updating Clonezilla..." + pkg_upgrade clonezilla +} + +get_version_clonezilla() { _ver_from_pkg clonezilla || echo ""; } diff --git a/lib/installers/grsync.sh b/lib/installers/grsync.sh new file mode 100644 index 0000000..3b86584 --- /dev/null +++ b/lib/installers/grsync.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# Grsync installer functions +# +# Graphical front-end for rsync: sync and back up folders with presets. The +# distro package (EPEL on RHEL clones); not offered on Alpine. + +# --- Grsync --- + +check_grsync() { _check_standard grsync grsync ""; } + +install_grsync() { + info "Installing Grsync..." + ensure_epel + pkg_install grsync || return 1 + info "Grsync installed." +} + +# Your saved sessions are kept. +uninstall_grsync() { + info "Uninstalling Grsync..." + pkg_remove grsync +} + +update_grsync() { + info "Updating Grsync..." + pkg_upgrade grsync +} + +get_version_grsync() { _ver_from_pkg grsync || echo ""; } diff --git a/lib/installers/kopia.sh b/lib/installers/kopia.sh new file mode 100644 index 0000000..9f3b708 --- /dev/null +++ b/lib/installers/kopia.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Kopia installer functions +# +# Fast, encrypted, deduplicating backup with snapshots and a web page +# (kopia server start). The command-line program. The distro package on Fedora +# and openSUSE; everywhere else Kopia's GitHub release (a single binary), checked +# against its published SHA-256 and put in /usr/local/bin. The KopiaUI desktop +# app is a separate download and is not installed. Not offered on Alpine. + +# --- Kopia --- + +_kopia_REPO="kopia/kopia" +_kopia_RE='kopia-[0-9.]+-linux-@X64@\.tar\.gz' + +# Latest upstream version, for System Updates. +_kopia_latest_version() { github_latest_tag "$_kopia_REPO" | sed 's/^v//'; } + +check_kopia() { _check_standard kopia kopia "" || [[ -x /usr/local/bin/kopia ]]; } + +install_kopia() { + info "Installing Kopia..." + native_or_github_install kopia "$_kopia_REPO" "$_kopia_RE" kopia || return 1 + info "Kopia installed." +} + +# Your repository connections and passwords (~/.config/kopia) are kept. +uninstall_kopia() { + info "Uninstalling Kopia..." + native_or_github_uninstall kopia kopia +} + +update_kopia() { + info "Updating Kopia..." + native_or_github_update kopia "$_kopia_REPO" "$_kopia_RE" kopia kopia "$(get_version_kopia)" +} + +get_version_kopia() { _ver_from_pkg kopia || _ver_from_cmd kopia --version || echo ""; } diff --git a/lib/installers/luckybackup.sh b/lib/installers/luckybackup.sh new file mode 100644 index 0000000..73ad4fb --- /dev/null +++ b/lib/installers/luckybackup.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# luckyBackup installer functions +# +# Graphical rsync-based backup and sync with profiles and scheduling. The +# distro package on Debian, Ubuntu, Fedora and openSUSE; on Arch from the AUR +# (only with AUR support enabled). Not offered on RHEL clones or Alpine. + +# --- luckyBackup --- + +check_luckybackup() { _check_standard luckybackup luckybackup ""; } + +install_luckybackup() { + info "Installing luckyBackup..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur luckybackup || return 1 + else + pkg_install luckybackup || return 1 + fi + info "luckyBackup installed." +} + +# Your profiles and schedules are kept. +uninstall_luckybackup() { + info "Uninstalling luckyBackup..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + aur_remove luckybackup 2>/dev/null || pkg_remove luckybackup + else + pkg_remove luckybackup + fi +} + +update_luckybackup() { + info "Updating luckyBackup..." + if [[ "$DISTRO_FAMILY" == "arch" ]]; then + repo_or_aur luckybackup + else + pkg_upgrade luckybackup + fi +} + +get_version_luckybackup() { _ver_from_pkg luckybackup || echo ""; } diff --git a/lib/installers/pika_backup.sh b/lib/installers/pika_backup.sh new file mode 100644 index 0000000..a87ba4e --- /dev/null +++ b/lib/installers/pika_backup.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Pika Backup installer functions +# +# Simple scheduled backups of your home folder with BorgBackup, in a desktop +# window. The distro package on Arch and openSUSE Tumbleweed; everywhere else +# Pika's own Flathub listing (which carries its own borg). Not offered on +# Alpine. + +# --- Pika Backup --- + +check_pika_backup() { _check_standard "" pika-backup org.gnome.World.PikaBackup; } + +install_pika_backup() { + info "Installing Pika Backup..." + native_or_flatpak_install org.gnome.World.PikaBackup pika-backup || return 1 + info "Pika Backup installed." +} + +# Your backup schedule and repository settings are kept. +uninstall_pika_backup() { + info "Uninstalling Pika Backup..." + native_or_flatpak_uninstall org.gnome.World.PikaBackup pika-backup +} + +update_pika_backup() { + info "Updating Pika Backup..." + native_or_flatpak_update org.gnome.World.PikaBackup pika-backup +} + +get_version_pika_backup() { native_or_flatpak_version org.gnome.World.PikaBackup pika-backup; } diff --git a/lib/installers/rclone.sh b/lib/installers/rclone.sh new file mode 100644 index 0000000..576578e --- /dev/null +++ b/lib/installers/rclone.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# rclone installer functions +# +# Command-line tool that copies and syncs files to and from dozens of cloud +# storage services. The distro package (EPEL on RHEL clones 9 and newer); not +# offered on Rocky/Alma 8, which have none. + +# --- rclone --- + +check_rclone() { _check_standard rclone rclone ""; } + +install_rclone() { + info "Installing rclone..." + ensure_epel + pkg_install rclone || return 1 + info "rclone installed." +} + +# Your rclone.conf (remotes and tokens) is kept. +uninstall_rclone() { + info "Uninstalling rclone..." + pkg_remove rclone +} + +update_rclone() { + info "Updating rclone..." + pkg_upgrade rclone +} + +get_version_rclone() { _ver_from_pkg rclone || echo ""; } diff --git a/lib/installers/restic.sh b/lib/installers/restic.sh new file mode 100644 index 0000000..a225742 --- /dev/null +++ b/lib/installers/restic.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# restic installer functions +# +# Fast, encrypted, deduplicating command-line backup to a local folder, SFTP, +# S3 and many cloud stores. The distro package (EPEL on RHEL clones 9 and +# newer); not offered on Rocky/Alma 8, which have none. + +# --- restic --- + +check_restic() { _check_standard restic restic ""; } + +install_restic() { + info "Installing restic..." + ensure_epel + pkg_install restic || return 1 + info "restic installed." +} + +# Your repositories and passwords are not touched. +uninstall_restic() { + info "Uninstalling restic..." + pkg_remove restic +} + +update_restic() { + info "Updating restic..." + pkg_upgrade restic +} + +get_version_restic() { _ver_from_pkg restic || echo ""; } diff --git a/lib/installers/rsnapshot.sh b/lib/installers/rsnapshot.sh new file mode 100644 index 0000000..bc33366 --- /dev/null +++ b/lib/installers/rsnapshot.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# rsnapshot installer functions +# +# Scheduled, space-saving snapshots of folders using rsync and hard links. The +# distro package everywhere (EPEL on RHEL clones). It is set up in +# /etc/rsnapshot.conf and a cron or timer entry, neither of which this +# creates. + +# --- rsnapshot --- + +check_rsnapshot() { _check_standard rsnapshot rsnapshot ""; } + +install_rsnapshot() { + info "Installing rsnapshot..." + ensure_epel + pkg_install rsnapshot || return 1 + info "rsnapshot installed." +} + +# Your /etc/rsnapshot.conf is kept. +uninstall_rsnapshot() { + info "Uninstalling rsnapshot..." + pkg_remove rsnapshot +} + +update_rsnapshot() { + info "Updating rsnapshot..." + pkg_upgrade rsnapshot +} + +get_version_rsnapshot() { _ver_from_pkg rsnapshot || echo ""; } diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 51d4f74..cd5c3e5 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -6102,6 +6102,109 @@ test_sunshine_uninstall_removes_rules() { assert_eq "flatpak(uninstall -y --user dev.lizardbyte.app.Sunshine) 0" "$out" "Sunshine uninstall removes the rules and service its setup step wrote, then the app" } +# --- Backup tools (#92) --- +echo "" +echo "=== Backup tools (#92) ===" + +_BACKUP_APPS=( + "Back In Time|back_in_time|File Backup" "Clonezilla|clonezilla|" "Grsync|grsync|File Backup" "Kopia|kopia|Command Line" + "luckyBackup|luckybackup|File Backup" "Pika Backup|pika_backup|File Backup" "rclone|rclone|Command Line" + "restic|restic|Command Line" "rsnapshot|rsnapshot|Command Line" +) + +test_backup_apps_registered() { + local entry name slug sub fn gaps=0 + for entry in "${_BACKUP_APPS[@]}"; do + IFS='|' read -r name slug sub <<<"$entry" + grep -qE "^[[:space:]]*register_utility \"${name}\"[[:space:]]+install_${slug} " "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing register: $name"; } + grep -qF "UTILITY_CATEGORY[\"${name}\"]=\"Backup\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing category: $name"; } + if [[ -n "$sub" ]]; then + grep -qF "UTILITY_SUBCATEGORY[\"${name}\"]=\"${sub}\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " ${name} not in ${sub}"; } + fi + grep -qF "UTILITY_DESCRIPTION[\"${name}\"]=" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing description: $name"; } + for fn in install check uninstall update get_version; do + grep -q "^${fn}_${slug}()" "${SCRIPT_DIR}/lib/installers/${slug}.sh" 2>/dev/null || { gaps=1; echo " missing ${fn}_${slug}"; } + done + grep -qxF " '${name}'" "${SCRIPT_DIR}/completions/_linux_util" || { gaps=1; echo " missing zsh completion: $name"; } + grep -qxF "${name}" "${SCRIPT_DIR}/completions/linux_util.bash" || { gaps=1; echo " missing bash completion: $name"; } + grep -qF "| **${name}** |" "${SCRIPT_DIR}/docs/utilities.md" || { gaps=1; echo " missing docs row: $name"; } + done + grep -qF 'SUBCATEGORY_ORDER["Backup"]="File Backup|Command Line|Timeshift|Snapper"' "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " no Backup folder order"; } + assert_eq "0" "$gaps" "The 9 new Backup tools are registered with category, folder, description, completions, docs row and all five functions" +} + +# Each tool is held back (or marked AUR-only) exactly where no package or safe download exists for it. +test_backup_apps_held_back() { + local f="${SCRIPT_DIR}/lib/installers.sh" gaps=0 line out + grep -qF '"Back In Time=backintime"' "$f" && grep -qF '"luckyBackup=luckybackup"' "$f" || { gaps=1; echo " Back In Time / luckyBackup not AUR-only on Arch"; } + grep -qF '"Kopia=/usr/local/bin/kopia"' "$f" && grep -qF '"Kopia=_kopia_latest_version"' "$f" || { gaps=1; echo " Kopia has no upstream marker"; } + line=$(grep -n 'register_utility "restic"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF -- '-ge 9' || { gaps=1; echo " restic/rclone not held back on Rocky/Alma 8"; } + line=$(grep -n 'register_utility "Back In Time"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF -- '-lt 10' || { gaps=1; echo " Back In Time not held back on Rocky/Alma 10"; } + line=$(grep -n 'register_utility "luckyBackup"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF '!= "rhel"' || { gaps=1; echo " luckyBackup not held back on RHEL clones"; } + line=$(grep -n 'register_utility "Clonezilla"' "$f" | cut -d: -f1) + sed -n "$((line-1))p" "$f" | grep -qF '"debian"' || { gaps=1; echo " Clonezilla not limited to Debian family and Arch"; } + out=$( + source "${SCRIPT_DIR}/lib/installers/alpine_packages.sh" + have=""; for row in "${_ALPINE_TABLE[@]}"; do have+=" ${row%%|*}"; done + for n in restic rclone rsnapshot; do [[ " $have " == *" $n "* ]] || printf 'missing:%s ' "$n"; done + for n in Kopia Grsync "Pika Backup" "Back In Time" luckyBackup Clonezilla; do [[ " $have " == *" $n "* ]] && printf 'unexpected:%s ' "$n"; done + echo done + ) + assert_eq "0 done" "${gaps} ${out}" "Backup tools are held back where they have no package, and Alpine offers restic, rclone and rsnapshot only" +} + +# Kopia's release files say x64, not x86_64 or amd64. +test_kopia_release_name() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + source "${SCRIPT_DIR}/lib/installers/kopia.sh" + error() { :; } + uname() { echo "$_m"; } + _m=x86_64; printf '%s,' "$(_upstream_expand_regex "$_kopia_RE")" + _m=aarch64; printf '%s' "$(_upstream_expand_regex "$_kopia_RE")" + [[ "kopia-0.23.1-linux-x64.tar.gz" =~ ^(kopia-[0-9.]+-linux-x64\.tar\.gz)$ ]] && printf ',match' + ) + assert_eq 'kopia-[0-9.]+-linux-x64\.tar\.gz,kopia-[0-9.]+-linux-arm64\.tar\.gz,match' "$out" "Kopia's release file pattern follows the CPU (x64, arm64)" +} + +# Back In Time's command-line half comes with it and goes with it; a missing half must not fail the uninstall. +test_back_in_time_uninstall_removes_dependency() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/back_in_time.sh" + info() { :; } + pkg_remove() { printf 'remove(%s) ' "$*"; } + pkg_check_installed() { [[ "$1" == backintime-common ]]; } + DISTRO_FAMILY=debian; uninstall_back_in_time; printf 'rc=%s' "$?" + ) + assert_eq "remove(backintime-qt) remove(backintime-common) rc=0" "$out" "Back In Time uninstall removes the app and its command-line package and still succeeds" +} + +# A minimal image has no find; the unpacked release binary is still found. +test_github_binary_install_without_find() { + local out d + d=$(mktemp -d) + out=$( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + error() { :; }; info() { :; } + mktemp() { echo "$d/w"; } + mkdir -p "$d/w/pkg"; printf '#!/bin/sh\n' > "$d/w/pkg/tool"; (cd "$d/w" && tar -czf "$d/t.tar.gz" pkg) + rm -rf "$d/w"; mkdir "$d/w" + github_asset_download() { cp "$d/t.tar.gz" "$3/t.tar.gz"; echo "$3/t.tar.gz"; } + upstream_arch() { echo x86_64; } + find() { return 127; } + command() { [[ "$2" == find ]] && return 1; builtin command "$@"; } + sudo() { printf '%s' "$*"; } + github_binary_install o/r 'x' tool + ) + rm -rf "$d" + assert_eq "install -Dm755 $d/w/pkg/tool /usr/local/bin/tool" "$out" "A release binary one folder deep is found without find" +} + # --- Verified GitHub downloads --- _GH_FIXTURE='{"tag_name": "v1.2.3","assets": [ {"name": "tool_1.2.3_linux_x86_64.tar.gz","uploader": {"login": "bot"},"size": 9,"digest": "sha256:'"$(printf 'a%.0s' {1..64})"'","browser_download_url": "https://x/tool_1.2.3_linux_x86_64.tar.gz"}, @@ -6345,6 +6448,11 @@ test_game_alpine_rows test_moonlight_package_name test_sunshine_setup_step test_sunshine_uninstall_removes_rules +test_backup_apps_registered +test_backup_apps_held_back +test_kopia_release_name +test_back_in_time_uninstall_removes_dependency +test_github_binary_install_without_find test_github_asset_info test_github_asset_download_checks_digest test_upstream_arch_and_regex From 63ac1db772e0afc485ca6352636e92761fcde7df Mon Sep 17 00:00:00 2001 From: acebmxer Date: Sat, 14 Nov 2026 13:40:47 -0500 Subject: [PATCH 14/14] chore(release): cut v1.13.0 and refresh README badges - Add 1.13.0 release heading (2026-11-14) to CHANGELOG - Update unique cloners badge to 54 - Update unit test count badge to 606 - Update distros tested badge to 7 --- CHANGELOG.md | 2 ++ README.md | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a47caa..61ba0b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ when a release is cut. ## [Unreleased] +## [1.13.0] - 2026-11-14 + ### Added - **9 more Backup tools** (fixes #92). Command line: restic, rclone, Kopia and diff --git a/README.md b/README.md index 191abed..5921438 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ [![Issues](https://img.shields.io/github/issues/acebmxer/linux_util)](https://github.com/acebmxer/linux_util/issues) [![Stars](https://img.shields.io/github/stars/acebmxer/linux_util)](https://github.com/acebmxer/linux_util/stargazers) [![Forks](https://img.shields.io/github/forks/acebmxer/linux_util)](https://github.com/acebmxer/linux_util/forks) -[![Unique cloners](https://img.shields.io/badge/unique%20cloners-30-brightgreen)](https://github.com/acebmxer/linux_util/graphs/traffic) +[![Unique cloners](https://img.shields.io/badge/unique%20cloners-54-brightgreen)](https://github.com/acebmxer/linux_util/graphs/traffic) [![Shell: Bash](https://img.shields.io/badge/shell-bash-4EAA25?logo=gnubash&logoColor=white)](linux_util.sh) [![Platform: Linux](https://img.shields.io/badge/platform-linux-333333?logo=linux&logoColor=white)](#supported-distributions) -[![Tests](https://img.shields.io/badge/tests-608%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) -[![Distros tested](https://img.shields.io/badge/distros%20tested-6-informational)](#supported-distributions) +[![Tests](https://img.shields.io/badge/tests-606%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Distros tested](https://img.shields.io/badge/distros%20tested-7-informational)](#supported-distributions) [![ShellCheck](https://img.shields.io/badge/shellcheck-clean-brightgreen)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) An interactive multi-select TUI for installing, uninstalling, and updating system