From 09b16ce537318f9122aa355dac59b35b36682b5e Mon Sep 17 00:00:00 2001 From: acebmxer Date: Mon, 2 Nov 2026 18:54:04 -0500 Subject: [PATCH 1/7] feat: add Hermes Agent utility under Development > IDEs & Editors Register Nous Research's open-source terminal AI agent as an installable utility. It installs per user with upstream's own script into ~/.hermes/hermes-agent, with the hermes command linked in ~/.local/bin, so a manual install is detected and updated in place. - Skip the agent's setup wizard when there is no terminal or auto_confirm is set - Update runs `hermes update`; Uninstall runs `hermes uninstall`, which keeps settings and data in ~/.hermes - Mark it as an upstream-binary install so System Updates refreshes it - Add shell completions, docs, README entry and CHANGELOG notes - Add tests for registration and detection/version parsing Fixes #83 --- CHANGELOG.md | 11 ++++ README.md | 4 +- completions/_linux_util | 1 + completions/linux_util.bash | 1 + docs/utilities.md | 5 +- lib/installers.sh | 7 ++- lib/installers/hermes_agent.sh | 91 ++++++++++++++++++++++++++++++++++ tests/test_linux_util.sh | 43 ++++++++++++++++ 8 files changed, 158 insertions(+), 5 deletions(-) create mode 100644 lib/installers/hermes_agent.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 8043ccf..da2f929 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,17 @@ when a release is cut. ## [Unreleased] +### Added + +- **Hermes Agent** (Development > IDEs & Editors), Nous Research's open-source + AI agent for the terminal. Installed per user with upstream's own install + script, into `~/.hermes/hermes-agent` with the `hermes` command in + `~/.local/bin`, so an install made by hand is detected and updated in place. + The agent's setup wizard is skipped when there is no terminal or + `auto_confirm` is set. Update runs `hermes update`, and Uninstall runs + `hermes uninstall`, which keeps your settings and data in `~/.hermes`. + System Updates refreshes it. Fixes #83. + ## [1.11.2] - 2026-10-25 ### Changed diff --git a/README.md b/README.md index 2ab11c2..b313e72 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Unique cloners](https://img.shields.io/badge/unique%20cloners-104-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-480%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Tests](https://img.shields.io/badge/tests-481%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) @@ -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, Node/NVM, Go, Rust, pyenv, Terraform, OpenTofu, Ansible, kubectl, k9s, DBeaver, Virt-Manager, Firecracker | +| **Development** | Docker, Podman, Distrobox, Toolbx, VS Code, VSCodium, Cursor, Claude Code, Claude Desktop, Hermes Agent, Node/NVM, Go, Rust, pyenv, Terraform, OpenTofu, Ansible, kubectl, k9s, DBeaver, Virt-Manager, Firecracker | | **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 | diff --git a/completions/_linux_util b/completions/_linux_util index 5a62562..4cd9825 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -53,6 +53,7 @@ _linux_util_utilities=( 'Google Chrome' 'GridCraft' 'GTK Window Fix' + 'Hermes Agent' 'Heroic Games Launcher' 'Intel Drivers' 'JetBrains Toolbox' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index 838d1d0..dbc3499 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -52,6 +52,7 @@ GNOME Desktop Google Chrome GridCraft GTK Window Fix +Hermes Agent Heroic Games Launcher Intel Drivers JetBrains Toolbox diff --git a/docs/utilities.md b/docs/utilities.md index b8bf204..1f1d75f 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -16,8 +16,8 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | [Package Managers](#package-managers) | [Productivity](#productivity) | [Remote Admin Tools](#remote-admin-tools) | | [System Tools](#system-tools) | | | -> **Incomplete:** 242 utilities and system tasks are registered in -> `lib/installers.sh`; 197 are listed below. The **File Managers**, **Firewalls**, +> **Incomplete:** 243 utilities and system tasks are registered in +> `lib/installers.sh`; 198 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, @@ -137,6 +137,7 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | **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 | diff --git a/lib/installers.sh b/lib/installers.sh index 3248f81..8f9435d 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -213,6 +213,7 @@ register_utility "Go SDK" install_golang check_golang register_utility "Google Chrome" install_google_chrome check_google_chrome uninstall_google_chrome update_google_chrome get_version_google_chrome register_utility "GParted" install_gparted check_gparted uninstall_gparted update_gparted get_version_gparted register_utility "HandBrake" install_handbrake check_handbrake uninstall_handbrake update_handbrake get_version_handbrake +register_utility "Hermes Agent" install_hermes_agent check_hermes_agent uninstall_hermes_agent update_hermes_agent get_version_hermes_agent register_utility "Heroic Games Launcher" install_heroic check_heroic uninstall_heroic update_heroic get_version_heroic register_utility "Inkscape" install_inkscape check_inkscape uninstall_inkscape update_inkscape get_version_inkscape register_utility "Input Leap" install_input_leap check_input_leap uninstall_input_leap update_input_leap get_version_input_leap @@ -608,6 +609,7 @@ UTILITY_CATEGORY["Filelight"]="System Tools" UTILITY_CATEGORY["Firefox"]="Internet" UTILITY_CATEGORY["GIMP"]="Productivity" UTILITY_CATEGORY["GitHub CLI"]="Development" +UTILITY_CATEGORY["Hermes Agent"]="Development" UTILITY_CATEGORY["Google Chrome"]="Internet" UTILITY_CATEGORY["Heroic Games Launcher"]="Gaming" UTILITY_CATEGORY["JetBrains Toolbox"]="Development" @@ -802,6 +804,7 @@ UTILITY_SUBCATEGORY["Standard Notes"]="Notes" UTILITY_SUBCATEGORY["Joplin Client"]="Notes" UTILITY_SUBCATEGORY["Claude Code"]="IDEs & Editors" UTILITY_SUBCATEGORY["Claude Desktop"]="IDEs & Editors" +UTILITY_SUBCATEGORY["Hermes Agent"]="IDEs & Editors" UTILITY_SUBCATEGORY["Cursor IDE"]="IDEs & Editors" UTILITY_SUBCATEGORY["JetBrains Toolbox"]="IDEs & Editors" UTILITY_SUBCATEGORY["Visual Studio Code"]="IDEs & Editors" @@ -982,6 +985,7 @@ UTILITY_DESCRIPTION["Delete Snapshot"]="Permanently removes one or more snapshot UTILITY_DESCRIPTION["Ansible"]="IT automation tool for provisioning, configuration management, and application deployment using agentless SSH-based playbooks." UTILITY_DESCRIPTION["Claude Code"]="Anthropic's AI coding assistant that runs in the terminal for code generation, editing, and analysis." UTILITY_DESCRIPTION["Claude Desktop"]="Anthropic's Claude desktop app with Chat, Cowork, and Claude Code (Linux beta). Installed from Anthropic's apt repository — natively on Debian/Ubuntu, inside an Ubuntu 26.04 distrobox on other distros (Distrobox is installed first if missing)." +UTILITY_DESCRIPTION["Hermes Agent"]="Nous Research's open-source AI agent for the terminal, with tools, memory, skills and messaging gateways. Installed per user with upstream's own script; updates and removal use its own hermes update / hermes uninstall, which keeps your settings in ~/.hermes." UTILITY_DESCRIPTION["Cursor IDE"]="AI-powered code editor built on VS Code with deeply integrated AI features for code completion and chat." UTILITY_DESCRIPTION["DBeaver"]="Universal database management tool supporting PostgreSQL, MySQL, SQLite, Oracle, and many more." UTILITY_DESCRIPTION["Docker"]="Container platform for building, shipping, and running applications in isolated environments." @@ -1243,7 +1247,8 @@ mark_upstream_binary \ "VectorCraft=$HOME/Applications/vectorcraft.AppImage" \ "WordCraft=$HOME/Applications/wordcraft.AppImage" \ "Claude Desktop=$_CLAUDE_DESKTOP_BOX_VERSION_FILE" \ - "Xodus Nexus=$_XN_APPIMAGE" + "Xodus Nexus=$_XN_APPIMAGE" \ + "Hermes Agent=$HOME/.hermes/hermes-agent" # 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 diff --git a/lib/installers/hermes_agent.sh b/lib/installers/hermes_agent.sh new file mode 100644 index 0000000..f2b56f1 --- /dev/null +++ b/lib/installers/hermes_agent.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# Hermes Agent (Nous Research terminal AI agent) installer functions +# +# Installed per user with upstream's own install script, which clones the agent +# to ~/.hermes/hermes-agent and publishes the `hermes` command in +# ~/.local/bin. Using upstream's paths means an existing hand install is +# detected and updated in place. Updates and removal go through the agent's own +# `hermes update` / `hermes uninstall`, so nothing here needs sudo. + +# --- Hermes Agent --- + +_HERMES_INSTALL_URL="https://hermes-agent.nousresearch.com/install.sh" +_HERMES_BIN="$HOME/.local/bin/hermes" + +# Print the hermes command to run: the one on PATH, else upstream's own link +# (~/.local/bin is not on PATH in the session that ran the installer). +_hermes_cmd() { + if _have_cmd hermes; then + _native_command hermes + elif [[ -x "$_HERMES_BIN" ]]; then + echo "$_HERMES_BIN" + else + return 1 + fi +} + +check_hermes_agent() { + _hermes_cmd >/dev/null +} + +install_hermes_agent() { + info "Installing Hermes Agent..." + ensure_tools + + local installer + installer=$(mktemp "${TMPDIR:-/tmp}/hermes-install-XXXXXX.sh") + CLEANUP_FILES+=("$installer") + # No total time limit: download_file's curl branch stops at 30 seconds. + if ! curl -fsSL --retry 2 -o "$installer" "$_HERMES_INSTALL_URL"; then + error "Failed to download the Hermes Agent install script." + return 1 + fi + + # The installer offers its setup wizard on a terminal. Skip it when nobody + # can answer, or when auto_confirm asks for an unattended run. + local -a args=() + if [[ "${CFG_AUTO_CONFIRM:-false}" == "true" ]] || ! { : < /dev/tty; } 2>/dev/null; then + args+=(--non-interactive) + fi + + # stdin comes from the terminal (or /dev/null) so the installer never + # consumes the menu's input. + local stdin_src=/dev/null + { : < /dev/tty; } 2>/dev/null && stdin_src=/dev/tty + if ! bash "$installer" "${args[@]}" < "$stdin_src"; then + error "Hermes Agent installation script failed." + return 1 + fi + + if ! check_hermes_agent; then + error "Hermes Agent installed but the 'hermes' command was not found." + return 1 + fi + info "Hermes Agent installed. Run 'hermes' to start (restart your shell if the command is not found)." +} + +uninstall_hermes_agent() { + info "Uninstalling Hermes Agent..." + local hermes + hermes=$(_hermes_cmd) || { error "Hermes Agent is not installed."; return 1; } + # Removes the code and command; ~/.hermes (config, keys, sessions) is kept. + "$hermes" uninstall --yes < /dev/null || return 1 + info "Your Hermes settings and data in ~/.hermes were kept." +} + +update_hermes_agent() { + info "Updating Hermes Agent..." + local hermes + if ! hermes=$(_hermes_cmd); then + install_hermes_agent + return + fi + "$hermes" update --yes < /dev/null +} + +get_version_hermes_agent() { + local hermes + hermes=$(_hermes_cmd) || { echo ""; return 0; } + # "Hermes Agent v0.22.6 (2026.9.24) · stable · local f0d94882e89a" + "$hermes" --version 2>/dev/null | grep -oP -m1 'Hermes Agent v\K[0-9]+\.[0-9]+(\.[0-9]+)?' || echo "" +} diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 179da4f..056aa6b 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -4711,6 +4711,49 @@ test_xodus_nexus_registered test_xodus_nexus_latest_skips_backend_runtime_and_prerelease test_xodus_nexus_version_cache_follows_the_appimage +# ---------------------------------------------------------------------------- +echo "" +echo "=== Hermes Agent ===" + +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_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 + grep -q "^${fn}_hermes_agent()" "${SCRIPT_DIR}/lib/installers/hermes_agent.sh" || gaps=1 + done + assert_eq "0" "$gaps" "Hermes Agent is registered with category, subcategory, description, upstream-binary mark and all five functions" +} + +# ~/.local/bin is not on PATH in the session that ran upstream's installer, so +# the check must find upstream's own link there, and the version comes from +# the agent's --version line. +test_hermes_agent_found_by_upstream_link_and_version_parsed() { + local out + out=$( + d=$(mktemp -d) + export HOME="$d" PATH="/usr/bin:/bin" + mkdir -p "$d/.local/bin" + source "${SCRIPT_DIR}/lib/pkg_manager.sh" 2>/dev/null + source "${SCRIPT_DIR}/lib/installers/hermes_agent.sh" + a=absent; check_hermes_agent || a=missing + v0=$(get_version_hermes_agent) + printf '#!/bin/sh\necho "Hermes Agent v0.22.6 (2026.9.24) · stable · local f0d94882e89a"\n' > "$d/.local/bin/hermes" + chmod +x "$d/.local/bin/hermes" + b=absent; check_hermes_agent && b=found + v1=$(get_version_hermes_agent) + rm -rf "$d" + echo "$a [$v0] $b $v1" + ) + assert_eq "missing [] found 0.22.6" "$out" "Hermes Agent is detected through ~/.local/bin/hermes off PATH and its version is read from --version" +} + +test_hermes_agent_registered +test_hermes_agent_found_by_upstream_link_and_version_parsed + # ---------------------------------------------------------------------------- echo "" echo "=== ArtCraft / Craft apps ===" From c9e144eea18123da48f0e2f83ee3037a864457e4 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Mon, 2 Nov 2026 18:58:06 -0500 Subject: [PATCH 2/7] feat: add Codex (OpenAI coding agent) to Development utilities Register Codex under Development > IDEs & Editors. It installs from npm as @openai/codex, installing Node.js first when it is missing, and is verified by running `codex --version` instead of trusting npm's exit code. Update re-installs the latest package. Uninstall removes the package but keeps Node.js and the sign-in and settings in ~/.codex. Add shell completions, docs, README and changelog entries, plus unit tests for registration and version parsing. Fixes #84 --- CHANGELOG.md | 7 ++++++ README.md | 4 ++-- completions/_linux_util | 1 + completions/linux_util.bash | 1 + docs/utilities.md | 5 ++-- lib/installers.sh | 4 ++++ lib/installers/codex.sh | 48 +++++++++++++++++++++++++++++++++++++ tests/test_linux_util.sh | 35 +++++++++++++++++++++++++++ 8 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 lib/installers/codex.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index da2f929..01fb164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,13 @@ when a release is cut. ### Added +- **Codex** (Development > IDEs & Editors), OpenAI's coding agent for the + terminal. Installed from npm as `@openai/codex`, installing Node.js first + when it is missing, and checked by running `codex --version` rather than + trusting npm's exit code. Update re-installs the latest package. Uninstall + removes the package and leaves Node.js and your sign-in and settings in + `~/.codex`. Fixes #84. + - **Hermes Agent** (Development > IDEs & Editors), Nous Research's open-source AI agent for the terminal. Installed per user with upstream's own install script, into `~/.hermes/hermes-agent` with the `hermes` command in diff --git a/README.md b/README.md index b313e72..484fa55 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Unique cloners](https://img.shields.io/badge/unique%20cloners-104-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-481%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Tests](https://img.shields.io/badge/tests-485%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) @@ -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, Hermes Agent, Node/NVM, Go, Rust, pyenv, Terraform, OpenTofu, Ansible, kubectl, k9s, DBeaver, Virt-Manager, Firecracker | +| **Development** | Docker, Podman, Distrobox, Toolbx, VS Code, VSCodium, Cursor, Claude Code, Claude Desktop, Codex, Hermes Agent, Node/NVM, Go, Rust, pyenv, Terraform, OpenTofu, Ansible, kubectl, k9s, DBeaver, Virt-Manager, Firecracker | | **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 | diff --git a/completions/_linux_util b/completions/_linux_util index 4cd9825..7528988 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -23,6 +23,7 @@ _linux_util_utilities=( 'Claude Desktop' 'Claws Mail' 'Cockpit' + 'Codex' 'Command-Not-Found Prompt' 'COSMIC Desktop' 'Create Snapshot' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index dbc3499..9e36b22 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -21,6 +21,7 @@ Claude Code Claude Desktop Claws Mail Cockpit +Codex Command-Not-Found Prompt COSMIC Desktop Create Snapshot diff --git a/docs/utilities.md b/docs/utilities.md index 1f1d75f..26a0d31 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -16,8 +16,8 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | [Package Managers](#package-managers) | [Productivity](#productivity) | [Remote Admin Tools](#remote-admin-tools) | | [System Tools](#system-tools) | | | -> **Incomplete:** 243 utilities and system tasks are registered in -> `lib/installers.sh`; 198 are listed below. The **File Managers**, **Firewalls**, +> **Incomplete:** 244 utilities and system tasks are registered in +> `lib/installers.sh`; 199 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, @@ -128,6 +128,7 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | **Ansible** | IT automation and configuration management tool | | **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) | diff --git a/lib/installers.sh b/lib/installers.sh index 8f9435d..2402d5c 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -169,6 +169,7 @@ register_utility "Claws Mail" install_claws_mail check_claws_mail register_utility "Claude Code" install_claude_code check_claude_code uninstall_claude_code update_claude_code # Claude Desktop: native on Debian/Ubuntu, in an Ubuntu distrobox everywhere else register_utility "Claude Desktop" install_claude_desktop check_claude_desktop uninstall_claude_desktop update_claude_desktop get_version_claude_desktop +register_utility "Codex" install_codex check_codex uninstall_codex update_codex get_version_codex register_utility "Cockpit" install_cockpit check_cockpit uninstall_cockpit update_cockpit get_version_cockpit register_utility "Cursor IDE" install_cursor check_cursor uninstall_cursor update_cursor get_version_cursor register_utility "DBeaver" install_dbeaver check_dbeaver uninstall_dbeaver update_dbeaver get_version_dbeaver @@ -591,6 +592,7 @@ UTILITY_CATEGORY["Btop"]="System Tools" UTILITY_CATEGORY["Chromium"]="Internet" UTILITY_CATEGORY["Claude Code"]="Development" UTILITY_CATEGORY["Claude Desktop"]="Development" +UTILITY_CATEGORY["Codex"]="Development" UTILITY_CATEGORY["Claws Mail"]="Internet" UTILITY_CATEGORY["Cockpit"]="Remote Admin Tools" UTILITY_CATEGORY["Cursor IDE"]="Development" @@ -804,6 +806,7 @@ UTILITY_SUBCATEGORY["Standard Notes"]="Notes" UTILITY_SUBCATEGORY["Joplin Client"]="Notes" 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["Cursor IDE"]="IDEs & Editors" UTILITY_SUBCATEGORY["JetBrains Toolbox"]="IDEs & Editors" @@ -985,6 +988,7 @@ UTILITY_DESCRIPTION["Delete Snapshot"]="Permanently removes one or more snapshot UTILITY_DESCRIPTION["Ansible"]="IT automation tool for provisioning, configuration management, and application deployment using agentless SSH-based playbooks." UTILITY_DESCRIPTION["Claude Code"]="Anthropic's AI coding assistant that runs in the terminal for code generation, editing, and analysis." UTILITY_DESCRIPTION["Claude Desktop"]="Anthropic's Claude desktop app with Chat, Cowork, and Claude Code (Linux beta). Installed from Anthropic's apt repository — natively on Debian/Ubuntu, inside an Ubuntu 26.04 distrobox on other distros (Distrobox is installed first if missing)." +UTILITY_DESCRIPTION["Codex"]="OpenAI's coding agent that runs in the terminal for code generation, editing, and review. Installed from npm (Node.js is installed first if missing); your sign-in and settings in ~/.codex are kept on uninstall." UTILITY_DESCRIPTION["Hermes Agent"]="Nous Research's open-source AI agent for the terminal, with tools, memory, skills and messaging gateways. Installed per user with upstream's own script; updates and removal use its own hermes update / hermes uninstall, which keeps your settings in ~/.hermes." UTILITY_DESCRIPTION["Cursor IDE"]="AI-powered code editor built on VS Code with deeply integrated AI features for code completion and chat." UTILITY_DESCRIPTION["DBeaver"]="Universal database management tool supporting PostgreSQL, MySQL, SQLite, Oracle, and many more." diff --git a/lib/installers/codex.sh b/lib/installers/codex.sh new file mode 100644 index 0000000..d278e06 --- /dev/null +++ b/lib/installers/codex.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# Codex (OpenAI's terminal coding agent) installer functions +# +# Installed from npm like Claude Code, so Node.js is installed first when +# missing (_ensure_nodejs lives in claude_code.sh; every installer file is +# sourced before any function runs). + +# --- Codex --- + +check_codex() { + _have_cmd codex +} + +# npm's exit code is not trusted: run the binary to prove it works. +_codex_verify() { + if ! _run_native codex --version &>/dev/null; then + error "Codex installed but the 'codex' command is not working." + return 1 + fi +} + +install_codex() { + info "Installing Codex..." + ensure_tools + _ensure_nodejs || return 1 + sudo npm install -g @openai/codex || return 1 + _codex_verify +} + +uninstall_codex() { + info "Uninstalling Codex..." + # Remove the npm package only; Node.js and ~/.codex (sign-in, settings) + # are left in place. + sudo npm uninstall -g @openai/codex +} + +update_codex() { + info "Updating Codex..." + _ensure_nodejs || return 1 + # Re-installing the package always fetches the latest published version. + sudo npm install -g @openai/codex || return 1 + _codex_verify +} + +get_version_codex() { + # "codex-cli 0.166.0" + _run_native codex --version 2>/dev/null | grep -oP -m1 '[0-9]+\.[0-9]+\.[0-9]+[^ ]*' || echo "" +} diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 056aa6b..91c68dc 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -4754,6 +4754,41 @@ test_hermes_agent_found_by_upstream_link_and_version_parsed() { test_hermes_agent_registered test_hermes_agent_found_by_upstream_link_and_version_parsed +# ---------------------------------------------------------------------------- +echo "" +echo "=== Codex ===" + +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_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 + done + assert_eq "0" "$gaps" "Codex is registered with category, subcategory, description and all five functions" +} + +test_codex_version_parsed_from_version_line() { + local out + out=$( + d=$(mktemp -d) + export PATH="$d:/usr/bin:/bin" + source "${SCRIPT_DIR}/lib/pkg_manager.sh" 2>/dev/null + source "${SCRIPT_DIR}/lib/installers/codex.sh" + a=$(get_version_codex) + printf '#!/bin/sh\necho "codex-cli 0.166.0"\n' > "$d/codex"; chmod +x "$d/codex" + b=$(get_version_codex) + rm -rf "$d" + echo "[$a] $b" + ) + assert_eq "[] 0.166.0" "$out" "Codex version is read from the codex --version line and is empty when not installed" +} + +test_codex_registered +test_codex_version_parsed_from_version_line + # ---------------------------------------------------------------------------- echo "" echo "=== ArtCraft / Craft apps ===" From 917ea42e23b655ae9e7ba6c4243c58df5e841935 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Mon, 2 Nov 2026 19:27:37 -0500 Subject: [PATCH 3/7] feat: add LM Studio installer and share Electron runtime deps Add LM Studio under Development > IDEs & Editors. It installs upstream's AppImage (x86_64 and aarch64) per user in ~/.local/opt/lm-studio after checking the published SHA-512, and adds an lm-studio command plus a menu entry and icon. Update skips the download when already current, and System Updates counts it as pending. Uninstall keeps models and settings in ~/.lmstudio. Move the Electron runtime library installer out of the Xodus Nexus installer into _shared.sh as ensure_electron_runtime_deps so both AppImage apps use one copy. Register the utility with its category, description and upstream version marks, add shell completions, update the docs, changelog and test count, and add tests for registration and version parsing. Fixes #85 --- CHANGELOG.md | 9 ++ README.md | 4 +- completions/_linux_util | 1 + completions/linux_util.bash | 1 + docs/utilities.md | 5 +- lib/installers.sh | 10 +- lib/installers/_shared.sh | 51 ++++++++ lib/installers/lm_studio.sh | 238 ++++++++++++++++++++++++++++++++++ lib/installers/xodus_nexus.sh | 51 +------- tests/test_linux_util.sh | 59 +++++++++ 10 files changed, 373 insertions(+), 56 deletions(-) create mode 100644 lib/installers/lm_studio.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 01fb164..07212f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,15 @@ when a release is cut. ### Added +- **LM Studio** (Development > IDEs & Editors), the desktop app for running + large language models locally. Upstream's AppImage (x86_64 and aarch64, about + 1 GB) is installed per user in `~/.local/opt/lm-studio` after checking the + SHA-512 file upstream publishes beside it, with an `lm-studio` command and an + application-menu entry and icon taken from the AppImage. Update skips the + download when already at the latest version, and System Updates refreshes it + and counts it as pending. Uninstalling removes the app and leaves your models + and settings in `~/.lmstudio`. Fixes #85. + - **Codex** (Development > IDEs & Editors), OpenAI's coding agent for the terminal. Installed from npm as `@openai/codex`, installing Node.js first when it is missing, and checked by running `codex --version` rather than diff --git a/README.md b/README.md index 484fa55..3824918 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Unique cloners](https://img.shields.io/badge/unique%20cloners-104-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-485%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Tests](https://img.shields.io/badge/tests-488%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) @@ -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, Node/NVM, Go, Rust, pyenv, Terraform, OpenTofu, Ansible, kubectl, k9s, DBeaver, Virt-Manager, Firecracker | +| **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 | | **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 | diff --git a/completions/_linux_util b/completions/_linux_util index 7528988..490157b 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -67,6 +67,7 @@ _linux_util_utilities=( 'LightCraft' 'linux-tkg' 'Local Time Zone / Locale' + 'LM Studio' 'LocalSend' 'Lutris' 'LXQt Desktop' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index 9e36b22..d08c489 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -66,6 +66,7 @@ LibreOffice LightCraft linux-tkg Local Time Zone / Locale +LM Studio LocalSend Lutris LXQt Desktop diff --git a/docs/utilities.md b/docs/utilities.md index 26a0d31..2085f9d 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -16,8 +16,8 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | [Package Managers](#package-managers) | [Productivity](#productivity) | [Remote Admin Tools](#remote-admin-tools) | | [System Tools](#system-tools) | | | -> **Incomplete:** 244 utilities and system tasks are registered in -> `lib/installers.sh`; 199 are listed below. The **File Managers**, **Firewalls**, +> **Incomplete:** 245 utilities and system tasks are registered in +> `lib/installers.sh`; 200 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, @@ -142,6 +142,7 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | **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 | | **Node.js** | JavaScript runtime — LTS release via NodeSource | | **NVM** | Node Version Manager — install and switch Node.js versions | diff --git a/lib/installers.sh b/lib/installers.sh index 2402d5c..dda7ade 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -235,6 +235,7 @@ register_utility "LACT" install_lact check_lact register_utility "Libation" install_libation check_libation uninstall_libation update_libation get_version_libation register_utility "LibreOffice" install_libreoffice check_libreoffice uninstall_libreoffice update_libreoffice get_version_libreoffice register_utility "LibreWolf" install_librewolf check_librewolf uninstall_librewolf update_librewolf get_version_librewolf +register_utility "LM Studio" install_lm_studio check_lm_studio uninstall_lm_studio update_lm_studio get_version_lm_studio register_utility "LocalSend" install_localsend check_localsend uninstall_localsend update_localsend get_version_localsend register_utility "Logseq" install_logseq check_logseq uninstall_logseq update_logseq get_version_logseq register_utility "Lutris" install_lutris check_lutris uninstall_lutris update_lutris get_version_lutris @@ -612,6 +613,7 @@ UTILITY_CATEGORY["Firefox"]="Internet" UTILITY_CATEGORY["GIMP"]="Productivity" UTILITY_CATEGORY["GitHub CLI"]="Development" UTILITY_CATEGORY["Hermes Agent"]="Development" +UTILITY_CATEGORY["LM Studio"]="Development" UTILITY_CATEGORY["Google Chrome"]="Internet" UTILITY_CATEGORY["Heroic Games Launcher"]="Gaming" UTILITY_CATEGORY["JetBrains Toolbox"]="Development" @@ -808,6 +810,7 @@ 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["Cursor IDE"]="IDEs & Editors" UTILITY_SUBCATEGORY["JetBrains Toolbox"]="IDEs & Editors" UTILITY_SUBCATEGORY["Visual Studio Code"]="IDEs & Editors" @@ -990,6 +993,7 @@ UTILITY_DESCRIPTION["Claude Code"]="Anthropic's AI coding assistant that runs in UTILITY_DESCRIPTION["Claude Desktop"]="Anthropic's Claude desktop app with Chat, Cowork, and Claude Code (Linux beta). Installed from Anthropic's apt repository — natively on Debian/Ubuntu, inside an Ubuntu 26.04 distrobox on other distros (Distrobox is installed first if missing)." UTILITY_DESCRIPTION["Codex"]="OpenAI's coding agent that runs in the terminal for code generation, editing, and review. Installed from npm (Node.js is installed first if missing); your sign-in and settings in ~/.codex are kept on uninstall." UTILITY_DESCRIPTION["Hermes Agent"]="Nous Research's open-source AI agent for the terminal, with tools, memory, skills and messaging gateways. Installed per user with upstream's own script; updates and removal use its own hermes update / hermes uninstall, which keeps your settings in ~/.hermes." +UTILITY_DESCRIPTION["LM Studio"]="Desktop app for downloading and running large language models locally, with a chat window and an OpenAI-compatible local server. Installed per user from upstream's AppImage (about 1 GB, SHA-512 checked); your models and settings in ~/.lmstudio are kept on uninstall." UTILITY_DESCRIPTION["Cursor IDE"]="AI-powered code editor built on VS Code with deeply integrated AI features for code completion and chat." UTILITY_DESCRIPTION["DBeaver"]="Universal database management tool supporting PostgreSQL, MySQL, SQLite, Oracle, and many more." UTILITY_DESCRIPTION["Docker"]="Container platform for building, shipping, and running applications in isolated environments." @@ -1252,7 +1256,8 @@ mark_upstream_binary \ "WordCraft=$HOME/Applications/wordcraft.AppImage" \ "Claude Desktop=$_CLAUDE_DESKTOP_BOX_VERSION_FILE" \ "Xodus Nexus=$_XN_APPIMAGE" \ - "Hermes Agent=$HOME/.hermes/hermes-agent" + "Hermes Agent=$HOME/.hermes/hermes-agent" \ + "LM Studio=$_LMS_APPIMAGE" # 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 @@ -1264,7 +1269,8 @@ mark_upstream_latest \ "Visual Studio Code=_vscode_latest_version" \ "Libation=_libation_latest_version" \ "Claude Desktop=_claude_desktop_latest_version" \ - "Xodus Nexus=_xn_latest_version" + "Xodus Nexus=_xn_latest_version" \ + "LM Studio=_lms_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 bec49a8..3517537 100644 --- a/lib/installers/_shared.sh +++ b/lib/installers/_shared.sh @@ -311,3 +311,54 @@ ensure_appimage_fuse() { ;; esac } + +# Debian 13 and Ubuntu 24.04+ renamed several libraries for the 64-bit time_t +# transition (libasound2 -> libasound2t64). apt picks the new name by itself +# for some of them but not for libasound2, which has two providers on Ubuntu. +_electron_debian_name() { + if apt-cache show "${1}t64" &>/dev/null; then echo "${1}t64"; else echo "$1"; fi +} + +# Runtime libraries for the Electron inside an AppImage (Xodus Nexus, LM Studio; +# do not add a copy). $1 is the app name used in messages. An AppImage is not +# a package, so nothing else pulls them in. Most are present on any desktop +# install; this matters on minimal ones. Taken from the libraries the bundled +# binary links (ldd), named per family the same way as NVIDIA PAIR's list. +ensure_electron_runtime_deps() { + local app="$1" + local -a deps=() + case "$DISTRO_FAMILY" in + debian) + deps=("$(_electron_debian_name libgtk-3-0)" libnss3 libxtst6 libxss1 + "$(_electron_debian_name libasound2)" libgbm1 libsecret-1-0 xdg-utils) + ;; + fedora|rhel) + deps=(gtk3 nss libXScrnSaver libXtst xdg-utils libsecret mesa-libgbm alsa-lib) + ;; + suse) + deps=(gtk3 mozilla-nss libXss1 libXtst6 xdg-utils libsecret-1-0 libgbm1 libasound2) + ;; + arch) + deps=(gtk3 nss libxss libxtst xdg-utils libsecret mesa alsa-lib) + ;; + esac + (( ${#deps[@]} == 0 )) && return 0 + + local dep + local -a missing=() + for dep in "${deps[@]}"; do + pkg_check_installed "$dep" || missing+=("$dep") + done + (( ${#missing[@]} == 0 )) && return 0 + + # One transaction; if it fails a single wrong name is the likely cause, so + # retry individually rather than lose the rest. + if ! pkg_install "${missing[@]}"; then + for dep in "${missing[@]}"; do + pkg_check_installed "$dep" && continue + pkg_install "$dep" || \ + verbose "${app}: runtime dependency '${dep}' unavailable; continuing." + done + fi + return 0 +} diff --git a/lib/installers/lm_studio.sh b/lib/installers/lm_studio.sh new file mode 100644 index 0000000..c464baf --- /dev/null +++ b/lib/installers/lm_studio.sh @@ -0,0 +1,238 @@ +#!/bin/bash +# LM Studio installer functions +# https://lmstudio.ai/download?os=linux +# +# Upstream publishes an AppImage (x64 and arm64) and a .deb. The .deb covers +# only Debian-based systems, so every family gets the same per-user AppImage +# install: +# +# ~/.local/opt/lm-studio/LM-Studio.AppImage the app +# ~/.local/bin/lm-studio symlink to it +# ~/.local/share/applications/ai.elementlabs.lmstudio.desktop menu entry +# +# The app can update itself, so the installed version is read from the +# AppImage (the X-AppImage-Version key of its embedded menu entry), cached +# against the file's size and mtime, rather than from a stamp written at +# install time that would go stale. +# +# Models, settings and the `lms` command live in ~/.lmstudio and are created +# by the app on first launch. Uninstalling removes the app only; ~/.lmstudio +# (often tens of gigabytes of models) is left. + +# --- LM Studio --- + +_LMS_DIR="$HOME/.local/opt/lm-studio" +_LMS_APPIMAGE="$_LMS_DIR/LM-Studio.AppImage" +_LMS_BIN="$HOME/.local/bin/lm-studio" +_LMS_DESKTOP="$HOME/.local/share/applications/ai.elementlabs.lmstudio.desktop" +_LMS_ICON="$HOME/.local/share/icons/hicolor/512x512/apps/lm-studio.png" +_LMS_VERSION_CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/linux_util/lm-studio.version" + +check_lm_studio() { + [[ -x "$_LMS_APPIMAGE" ]] +} + +# Upstream's architecture name for this machine; fails on anything else. +_lms_arch() { + case "$(uname -m)" in + x86_64) echo "x64" ;; + aarch64|arm64) echo "arm64" ;; + *) return 1 ;; + esac +} + +# Latest version as upstream names it in the download path ("0.4.28-2"). The +# "latest" download link redirects to the versioned AppImage, so the redirect +# target is read without downloading anything. +_lms_latest_version() { + local arch + arch=$(_lms_arch) || return 1 + curl -fsS --max-time 15 -o /dev/null -w '%{redirect_url}' \ + "https://lmstudio.ai/download/latest/linux/${arch}" 2>/dev/null | _lms_version_from_url +} + +# Reads a download URL on stdin and prints the version in its path. +_lms_version_from_url() { + grep -oP '/linux/[a-z0-9]+/\K[0-9]+\.[0-9]+\.[0-9]+-[0-9]+(?=/)' | head -1 +} + +# Version of the AppImage at $1 in the same "0.4.28-2" form (the embedded menu +# entry says "0.4.28+2"). Extracting one small file needs no FUSE. +_lms_appimage_version() { + local appimage="$1" tmpdir v + tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/lm-studio-ver-XXXXXX") || return 1 + v=$(cd "$tmpdir" && "$appimage" --appimage-extract '*.desktop' >/dev/null 2>&1 \ + && grep -m1 -h '^X-AppImage-Version=' squashfs-root/*.desktop 2>/dev/null | cut -d= -f2-) + rm -rf "$tmpdir" + printf '%s\n' "$v" | tr -d '[:space:]' | tr '+' '-' +} + +get_version_lm_studio() { + [[ -x "$_LMS_APPIMAGE" ]] || { echo ""; return 0; } + local key cached_key cached_v v + key=$(stat -c '%s:%Y' "$_LMS_APPIMAGE" 2>/dev/null) + if [[ -n "$key" && -r "$_LMS_VERSION_CACHE" ]]; then + read -r cached_key cached_v < "$_LMS_VERSION_CACHE" + if [[ "$cached_key" == "$key" && -n "$cached_v" ]]; then + printf '%s\n' "$cached_v" + return 0 + fi + fi + v=$(_lms_appimage_version "$_LMS_APPIMAGE") + if [[ -n "$v" && -n "$key" ]]; then + mkdir -p "$(dirname "$_LMS_VERSION_CACHE")" 2>/dev/null && \ + printf '%s %s\n' "$key" "$v" > "$_LMS_VERSION_CACHE" 2>/dev/null + fi + printf '%s\n' "$v" +} + +# Download version $1 for architecture $2 and check it against the SHA-512 +# file upstream publishes beside it. The verified file is left in $_LMS_FILE, +# next to the install path so the final move is a rename on one filesystem. +_lms_download() { + local version="$1" arch="$2" name base sum expected tmp + _LMS_FILE="" + name="LM-Studio-${version}-${arch}.AppImage" + base="https://installers.lmstudio.ai/linux/${arch}/${version}" + + sum=$(curl -fsSL --max-time 30 "${base}/${name}.sha512" 2>/dev/null) || { + error "Could not download the LM Studio ${version} checksum file." + return 1 + } + expected=$(printf '%s\n' "$sum" | grep -oE '^[0-9a-fA-F]{128}' | head -1 | tr '[:upper:]' '[:lower:]') + if [[ -z "$expected" ]]; then + error "The LM Studio ${version} checksum file does not hold a SHA-512." + return 1 + fi + + mkdir -p "$_LMS_DIR" || return 1 + tmp="${_LMS_APPIMAGE}.linux_util-part" + CLEANUP_FILES+=("$tmp") + info "Downloading LM Studio ${version} (about 1 GB)..." + # wget when present (ensure_tools installs it), else curl with no overall + # time limit -- download_file's curl branch caps the whole transfer at 30s. + local fetched=0 + if command -v wget &>/dev/null; then + wget -q --timeout=30 -O "$tmp" "${base}/${name}" && fetched=1 + else + curl -fsSL --connect-timeout 30 --retry 3 -o "$tmp" "${base}/${name}" && fetched=1 + fi + if (( ! fetched )); then + rm -f "$tmp" + rmdir "$_LMS_DIR" 2>/dev/null + error "Failed to download LM Studio ${version}." + return 1 + fi + + if [[ "$(sha512sum "$tmp" | awk '{print $1}')" != "$expected" ]]; then + rm -f "$tmp" + rmdir "$_LMS_DIR" 2>/dev/null + error "LM Studio ${version} failed SHA-512 verification; nothing was installed." + return 1 + fi + verbose "LM Studio ${version}: SHA-512 verified." + _LMS_FILE="$tmp" +} + +# Menu entry and icon, taken from the AppImage itself: Exec is pointed at the +# installed copy. The AppImage's AppRun decides about --no-sandbox by itself. +_lms_add_menu_entry() { + local tmpdir desktop_src="ai.elementlabs.lmstudio.desktop" icon_src="usr/share/icons/hicolor/512x512/apps/lm-studio.png" + tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/lm-studio-XXXXXX") || return 1 + CLEANUP_FILES+=("$tmpdir") + if ! ( cd "$tmpdir" && "$_LMS_APPIMAGE" --appimage-extract "$desktop_src" >/dev/null 2>&1 \ + && "$_LMS_APPIMAGE" --appimage-extract "$icon_src" >/dev/null 2>&1 ) \ + || [[ ! -f "$tmpdir/squashfs-root/$desktop_src" ]]; then + warn "Could not read the menu entry from the LM Studio AppImage; no menu item was added." + return 0 + fi + mkdir -p "$(dirname "$_LMS_DESKTOP")" || return 1 + sed -e "s|^Exec=[^ ]*|Exec=\"${_LMS_APPIMAGE}\"|" -e "/^TryExec=/d" \ + "$tmpdir/squashfs-root/$desktop_src" > "$_LMS_DESKTOP" + if [[ -f "$tmpdir/squashfs-root/$icon_src" ]]; then + install -Dm644 "$tmpdir/squashfs-root/$icon_src" "$_LMS_ICON" + fi + rm -rf "$tmpdir" +} + +# Name any shared libraries the bundled Electron cannot find. Non-fatal. +_lms_check_libs() { + command -v ldd &>/dev/null || return 0 + local tmpdir missing + tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/lm-studio-ldd-XXXXXX") || return 0 + CLEANUP_FILES+=("$tmpdir") + ( cd "$tmpdir" && "$_LMS_APPIMAGE" --appimage-extract 'lm-studio' >/dev/null 2>&1 \ + && "$_LMS_APPIMAGE" --appimage-extract '*.so' >/dev/null 2>&1 ) || return 0 + [[ -f "$tmpdir/squashfs-root/lm-studio" ]] || return 0 + missing=$(LD_LIBRARY_PATH="$tmpdir/squashfs-root" ldd "$tmpdir/squashfs-root/lm-studio" 2>/dev/null \ + | awk '/not found/{print $1}' | sort -u | tr '\n' ' ') + rm -rf "$tmpdir" + if [[ -n "${missing// /}" ]]; then + warn "LM Studio is missing shared libraries: ${missing}" + warn "Install the packages providing them, or LM Studio will not start." + fi +} + +install_lm_studio() { + info "Installing LM Studio..." + local arch version + if ! arch=$(_lms_arch); then + error "LM Studio is published for x86_64 and aarch64 only (this machine is $(uname -m))." + return 1 + fi + ensure_tools + + version=$(_lms_latest_version) + if [[ -z "$version" ]]; then + error "Could not find the latest LM Studio version on lmstudio.ai." + return 1 + fi + + ensure_appimage_fuse + ensure_electron_runtime_deps "LM Studio" + _lms_download "$version" "$arch" || return 1 + + chmod 0755 "$_LMS_FILE" || return 1 + mv -f "$_LMS_FILE" "$_LMS_APPIMAGE" || { error "Failed to install LM Studio to ${_LMS_APPIMAGE}."; return 1; } + + mkdir -p "$(dirname "$_LMS_BIN")" || return 1 + ln -sfn "$_LMS_APPIMAGE" "$_LMS_BIN" + _lms_add_menu_entry + refresh_desktop_caches + _lms_check_libs + + info "LM Studio ${version} installed (command: lm-studio)." + info "Start LM Studio once from the application menu; it sets up the 'lms' command and ~/.lmstudio on first launch." +} + +uninstall_lm_studio() { + info "Uninstalling LM Studio..." + if [[ ! -e "$_LMS_APPIMAGE" && ! -d "$_LMS_DIR" ]]; then + echo "LM Studio installation not found." + return 0 + fi + rm -rf "$_LMS_DIR" || return 1 + [[ -L "$_LMS_BIN" && "$(readlink "$_LMS_BIN")" == "$_LMS_APPIMAGE" ]] && rm -f "$_LMS_BIN" + # Only the entry that points at this install; a copy kept elsewhere keeps its own. + if grep -qF "$_LMS_APPIMAGE" "$_LMS_DESKTOP" 2>/dev/null || \ + grep -qF "$_LMS_BIN" "$_LMS_DESKTOP" 2>/dev/null; then + rm -f "$_LMS_DESKTOP" + fi + rm -f "$_LMS_ICON" "$_LMS_VERSION_CACHE" + refresh_desktop_caches + info "Your models and settings in ~/.lmstudio were kept." +} + +update_lm_studio() { + info "Updating LM Studio..." + local installed latest + installed=$(get_version_lm_studio) + latest=$(_lms_latest_version) + # An unknown version on either side falls through and reinstalls rather than + # risk skipping a real update. + if [[ -n "$installed" && "$installed" == "$latest" ]]; then + info "LM Studio is already at the latest version (${installed})." + return 0 + fi + install_lm_studio +} diff --git a/lib/installers/xodus_nexus.sh b/lib/installers/xodus_nexus.sh index 77e59cd..ca9003c 100644 --- a/lib/installers/xodus_nexus.sh +++ b/lib/installers/xodus_nexus.sh @@ -89,55 +89,6 @@ get_version_xodus_nexus() { printf '%s\n' "$v" } -# Debian 13 and Ubuntu 24.04+ renamed several libraries for the 64-bit time_t -# transition (libasound2 -> libasound2t64). apt picks the new name by itself -# for some of them but not for libasound2, which has two providers on Ubuntu. -_xn_debian_name() { - if apt-cache show "${1}t64" &>/dev/null; then echo "${1}t64"; else echo "$1"; fi -} - -# Runtime libraries for the Electron inside the AppImage: an AppImage is not a -# package, so nothing else pulls them in. Most are present on any desktop -# install; this matters on minimal ones. Taken from the libraries the bundled -# binary links (ldd), named per family the same way as NVIDIA PAIR's list. -_xn_install_runtime_deps() { - local -a deps=() - case "$DISTRO_FAMILY" in - debian) - deps=("$(_xn_debian_name libgtk-3-0)" libnss3 libxtst6 libxss1 - "$(_xn_debian_name libasound2)" libgbm1 libsecret-1-0 xdg-utils) - ;; - fedora|rhel) - deps=(gtk3 nss libXScrnSaver libXtst xdg-utils libsecret mesa-libgbm alsa-lib) - ;; - suse) - deps=(gtk3 mozilla-nss libXss1 libXtst6 xdg-utils libsecret-1-0 libgbm1 libasound2) - ;; - arch) - deps=(gtk3 nss libxss libxtst xdg-utils libsecret mesa alsa-lib) - ;; - esac - (( ${#deps[@]} == 0 )) && return 0 - - local dep - local -a missing=() - for dep in "${deps[@]}"; do - pkg_check_installed "$dep" || missing+=("$dep") - done - (( ${#missing[@]} == 0 )) && return 0 - - # One transaction; if it fails a single wrong name is the likely cause, so - # retry individually rather than lose the rest. - if ! pkg_install "${missing[@]}"; then - for dep in "${missing[@]}"; do - pkg_check_installed "$dep" && continue - pkg_install "$dep" || \ - verbose "Xodus Nexus: runtime dependency '${dep}' unavailable; continuing." - done - fi - return 0 -} - # Download release $1 and check it against the SHA-512 file upstream publishes # beside every launcher AppImage (the same check the in-app updater makes). The # verified file is left in $_XN_FILE, next to the install path so the final move @@ -246,7 +197,7 @@ install_xodus_nexus() { fi ensure_appimage_fuse - _xn_install_runtime_deps + ensure_electron_runtime_deps "Xodus Nexus" _xn_download "$version" || return 1 chmod 0755 "$_XN_FILE" || return 1 diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 91c68dc..415b509 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -4789,6 +4789,65 @@ test_codex_version_parsed_from_version_line() { test_codex_registered test_codex_version_parsed_from_version_line +# ---------------------------------------------------------------------------- +echo "" +echo "=== LM Studio ===" + +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_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 + for fn in install check uninstall update get_version; do + grep -q "^${fn}_lm_studio()" "${SCRIPT_DIR}/lib/installers/lm_studio.sh" || gaps=1 + done + assert_eq "0" "$gaps" "LM Studio is registered with category, subcategory, description, upstream-binary marks and all five functions" +} + +# The "latest" download link redirects to the versioned AppImage; the version +# is whatever sits in that path, with the build number after the dash. +test_lm_studio_version_taken_from_redirect_url() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/lm_studio.sh" + printf '%s\n' 'https://installers.lmstudio.ai/linux/x64/0.4.28-2/LM-Studio-0.4.28-2-x64.AppImage' | _lms_version_from_url + printf '%s\n' 'https://installers.lmstudio.ai/linux/arm64/0.10.3-14/LM-Studio-0.10.3-14-arm64.AppImage' | _lms_version_from_url + printf '%s\n' 'https://lmstudio.ai/download' | _lms_version_from_url + ) + assert_eq "0.4.28-2 0.10.3-14 " "$(echo $out) " "LM Studio latest version is read from the redirect path for x64 and arm64 and is empty for other URLs" +} + +# The AppImage says 0.4.28+2 in its embedded menu entry, the download path +# says 0.4.28-2; both are shown as 0.4.28-2 so the update check can compare +# them. The cached value follows the file when the app updates itself. +test_lm_studio_version_from_appimage_is_cached_and_follows_the_file() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/lm_studio.sh" + d=$(mktemp -d) + _LMS_APPIMAGE="$d/LM-Studio.AppImage" + _LMS_VERSION_CACHE="$d/cache/lm-studio.version" + printf '#!/bin/sh\nmkdir squashfs-root && printf "X-AppImage-Version=0.4.28+2\\n" > squashfs-root/a.desktop\n' > "$_LMS_APPIMAGE" + chmod +x "$_LMS_APPIMAGE" + a=$(get_version_lm_studio) + _lms_appimage_version() { echo "should-not-run"; } + b=$(get_version_lm_studio) + printf '#!/bin/sh\n# newer\n' > "$_LMS_APPIMAGE"; touch -d '+1 minute' "$_LMS_APPIMAGE" + _lms_appimage_version() { echo "0.4.29-1"; } + c=$(get_version_lm_studio) + rm -rf "$d" + echo "$a $b $c" + ) + assert_eq "0.4.28-2 0.4.28-2 0.4.29-1" "$out" "LM Studio version is read from the AppImage as 0.4.28-2, cached per file and re-read after the file changes" +} + +test_lm_studio_registered +test_lm_studio_version_taken_from_redirect_url +test_lm_studio_version_from_appimage_is_cached_and_follows_the_file + # ---------------------------------------------------------------------------- echo "" echo "=== ArtCraft / Craft apps ===" From b6a431443c3b749dc9c9987c633618020a609750 Mon Sep 17 00:00:00 2001 From: acebmxer Date: Wed, 11 Nov 2026 09:48:31 -0500 Subject: [PATCH 4/7] feat: add GPU Task Manager to System Tools Add a gputaskman installer that installs upstream's portable build per user in ~/.local/opt/gputaskman, verified against the published SHA-256 file, with a gputaskman command in ~/.local/bin. It reports per-process VRAM and GPU load on NVIDIA, AMD (amdgpu) and Intel (i915) GPUs. The installer refuses systems with glibc older than 2.35 (Rocky/RHEL 9). Update skips the download when already at the latest version, and System Updates refreshes it and counts it as pending. Register the utility with its category, description and upstream-binary marks, add shell completions, docs and changelog entries, and add unit tests for registration, version parsing, the glibc check and the install stamp. --- CHANGELOG.md | 10 ++ README.md | 6 +- completions/_linux_util | 1 + completions/linux_util.bash | 1 + docs/utilities.md | 5 +- lib/installers.sh | 9 +- lib/installers/gputaskman.sh | 191 +++++++++++++++++++++++++++++++++++ tests/test_linux_util.sh | 66 ++++++++++++ 8 files changed, 282 insertions(+), 7 deletions(-) create mode 100644 lib/installers/gputaskman.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 07212f9..09f7d64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,16 @@ when a release is cut. ### Added +- **GPU Task Manager** (System Tools), a terminal task manager for the GPU: + per-process VRAM and GPU load, and which runtimes and model files + (llama.cpp, Ollama, PyTorch) are using it, on NVIDIA, AMD (amdgpu) and Intel + (i915) GPUs. Upstream's portable build (x86_64 and aarch64) is installed per + user in `~/.local/opt/gputaskman` after checking the SHA-256 file upstream + publishes beside it, with a `gputaskman` command in `~/.local/bin`. It needs + glibc 2.35 or newer, so it is refused with a clear message on Rocky/RHEL 9. + Update skips the download when already at the latest version, and System + Updates refreshes it and counts it as pending. + - **LM Studio** (Development > IDEs & Editors), the desktop app for running large language models locally. Upstream's AppImage (x86_64 and aarch64, about 1 GB) is installed per user in `~/.local/opt/lm-studio` after checking the diff --git a/README.md b/README.md index 3824918..efd5c7e 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,10 @@ [![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-104-brightgreen)](https://github.com/acebmxer/linux_util/graphs/traffic) +[![Unique cloners](https://img.shields.io/badge/unique%20cloners-29-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-488%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Tests](https://img.shields.io/badge/tests-492%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) @@ -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, Fastfetch, ClamAV, Stacer, Filelight, Input Leap, OCCT, Pay Respects, Zsh + Oh My Zsh, and a Kernel Managers folder | +| **System Tools** | Btop, GPU Task Manager, Fastfetch, ClamAV, Stacer, Filelight, Input Leap, OCCT, Pay Respects, Zsh + Oh My Zsh, and a Kernel Managers folder | 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 490157b..d49c67a 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -52,6 +52,7 @@ _linux_util_utilities=( 'GitHub CLI' 'GNOME Desktop' 'Google Chrome' + 'GPU Task Manager' 'GridCraft' 'GTK Window Fix' 'Hermes Agent' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index d08c489..fe303e7 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -51,6 +51,7 @@ GIMP GitHub CLI GNOME Desktop Google Chrome +GPU Task Manager GridCraft GTK Window Fix Hermes Agent diff --git a/docs/utilities.md b/docs/utilities.md index 2085f9d..18053ea 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -16,8 +16,8 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | [Package Managers](#package-managers) | [Productivity](#productivity) | [Remote Admin Tools](#remote-admin-tools) | | [System Tools](#system-tools) | | | -> **Incomplete:** 245 utilities and system tasks are registered in -> `lib/installers.sh`; 200 are listed below. The **File Managers**, **Firewalls**, +> **Incomplete:** 246 utilities and system tasks are registered in +> `lib/installers.sh`; 201 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, @@ -285,6 +285,7 @@ Additional, cross-distro managers that run alongside the native package manager | **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) | | **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 | diff --git a/lib/installers.sh b/lib/installers.sh index dda7ade..ab0e921 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -213,6 +213,7 @@ register_utility "GitHub CLI" install_github_cli check_github_cli register_utility "Go SDK" install_golang check_golang uninstall_golang update_golang get_version_golang register_utility "Google Chrome" install_google_chrome check_google_chrome uninstall_google_chrome update_google_chrome get_version_google_chrome register_utility "GParted" install_gparted check_gparted uninstall_gparted update_gparted get_version_gparted +register_utility "GPU Task Manager" install_gputaskman check_gputaskman uninstall_gputaskman update_gputaskman get_version_gputaskman register_utility "HandBrake" install_handbrake check_handbrake uninstall_handbrake update_handbrake get_version_handbrake register_utility "Hermes Agent" install_hermes_agent check_hermes_agent uninstall_hermes_agent update_hermes_agent get_version_hermes_agent register_utility "Heroic Games Launcher" install_heroic check_heroic uninstall_heroic update_heroic get_version_heroic @@ -590,6 +591,7 @@ UTILITY_CATEGORY["Brave Browser"]="Internet" UTILITY_CATEGORY["Brave Debloat"]="Internet" UTILITY_CATEGORY["Brave Origin"]="Internet" UTILITY_CATEGORY["Btop"]="System Tools" +UTILITY_CATEGORY["GPU Task Manager"]="System Tools" UTILITY_CATEGORY["Chromium"]="Internet" UTILITY_CATEGORY["Claude Code"]="Development" UTILITY_CATEGORY["Claude Desktop"]="Development" @@ -1139,6 +1141,7 @@ UTILITY_DESCRIPTION["Input Leap"]="Open-source KVM software that shares one keyb UTILITY_DESCRIPTION["Ventoy"]="Bootable USB solution for loading multiple ISO images from a single drive — just copy ISOs and boot." UTILITY_DESCRIPTION["GParted"]="Graphical partition editor for creating, resizing, moving, copying, and deleting disk partitions. Supports ext2/3/4, btrfs, xfs, ntfs, fat32, and more — ideal for managing drives and preparing disks." UTILITY_DESCRIPTION["KDiskMark"]="HDD and SSD benchmark tool with a graphical interface over fio (Flexible I/O Tester) — measures sequential and random read/write speeds with configurable block size, queue depth and thread count, and can generate a text report. Installed from the native package; falls back to Flathub where the distro does not package it (Debian 12, Ubuntu 22.04, openSUSE Leap 15)." +UTILITY_DESCRIPTION["GPU Task Manager"]="Terminal task manager for the GPU: per-process VRAM and GPU load, and which runtimes and model files (llama.cpp, Ollama, PyTorch) are using it. NVIDIA through the driver, AMD (amdgpu) and Intel (i915) through the kernel. Installed per user from upstream's portable build (SHA-256 checked); needs glibc 2.35 or newer." UTILITY_DESCRIPTION["Fastfetch"]="Lightning-fast system information tool written in C, displaying OS, hardware, and software details." UTILITY_DESCRIPTION["Stacer"]="Linux system optimizer and monitoring tool with a graphical interface for managing services and resources." UTILITY_DESCRIPTION["Timeshift"]="System restore utility that creates incremental filesystem snapshots using rsync or BTRFS. Install this first to enable Create, Restore, and Delete Snapshot." @@ -1257,7 +1260,8 @@ mark_upstream_binary \ "Claude Desktop=$_CLAUDE_DESKTOP_BOX_VERSION_FILE" \ "Xodus Nexus=$_XN_APPIMAGE" \ "Hermes Agent=$HOME/.hermes/hermes-agent" \ - "LM Studio=$_LMS_APPIMAGE" + "LM Studio=$_LMS_APPIMAGE" \ + "GPU Task Manager=$_GTM_DIR" # 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 @@ -1270,7 +1274,8 @@ mark_upstream_latest \ "Libation=_libation_latest_version" \ "Claude Desktop=_claude_desktop_latest_version" \ "Xodus Nexus=_xn_latest_version" \ - "LM Studio=_lms_latest_version" + "LM Studio=_lms_latest_version" \ + "GPU Task Manager=_gtm_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/gputaskman.sh b/lib/installers/gputaskman.sh new file mode 100644 index 0000000..0560be9 --- /dev/null +++ b/lib/installers/gputaskman.sh @@ -0,0 +1,191 @@ +#!/bin/bash +# GPU Task Manager (gputaskman) installer functions +# https://github.com/shanselman/gputaskman +# +# A terminal UI that shows per-process GPU memory and engine load, and which +# runtimes and model files (llama.cpp, Ollama, PyTorch...) are using the GPU. +# NVIDIA through NVML (comes with the driver), AMD on amdgpu and Intel on i915 +# through the kernel's own sysfs and DRM fdinfo; no extra package is needed. +# +# Upstream's portable Linux build (x64 and arm64, a PyInstaller bundle with +# its own Python) is installed per user, the same on every distro: +# +# ~/.local/opt/gputaskman/gputaskman the program (_internal beside it) +# ~/.local/opt/gputaskman/.linux_util-version version that was unpacked +# ~/.local/bin/gputaskman symlink to it +# +# The bundle has no --version flag and does not update itself, so the version +# written at install time stays true. It needs glibc 2.35 or newer. + +# --- GPU Task Manager --- + +_GTM_REPO="shanselman/gputaskman" +_GTM_DIR="$HOME/.local/opt/gputaskman" +_GTM_EXE="$_GTM_DIR/gputaskman" +_GTM_VERSION_FILE="$_GTM_DIR/.linux_util-version" +_GTM_BIN="$HOME/.local/bin/gputaskman" +_GTM_MIN_GLIBC="2.35" + +check_gputaskman() { + [[ -x "$_GTM_EXE" ]] +} + +get_version_gputaskman() { + [[ -r "$_GTM_VERSION_FILE" ]] || { echo ""; return 0; } + head -1 "$_GTM_VERSION_FILE" | tr -d '[:space:]' +} + +# Upstream's architecture name for this machine; fails on anything else. +_gtm_arch() { + case "$(uname -m)" in + x86_64) echo "x64" ;; + aarch64|arm64) echo "arm64" ;; + *) return 1 ;; + esac +} + +# Reads a release URL on stdin and prints the bare version of its tag +# (".../releases/tag/v0.4.0" -> "0.4.0"). +_gtm_version_from_url() { + grep -oP '/releases/tag/v\K[0-9]+\.[0-9]+\.[0-9]+(?=$|[/?#])' | head -1 +} + +# Latest release version. GitHub's /releases/latest redirects to the newest +# tag's page, so the redirect target is read without calling the API (which +# is rate limited) and without downloading anything. +_gtm_latest_version() { + curl -fsS --max-time 15 -o /dev/null -w '%{redirect_url}' \ + "https://github.com/${_GTM_REPO}/releases/latest" 2>/dev/null | _gtm_version_from_url +} + +# The C library version, e.g. "2.39"; empty when it is not glibc (musl). +_gtm_glibc_version() { + getconf GNU_LIBC_VERSION 2>/dev/null | awk '$1 == "glibc" {print $2}' +} + +# True when glibc version $1 is at least $_GTM_MIN_GLIBC. +_gtm_glibc_ok() { + local have="$1" + [[ -n "$have" ]] || return 1 + [[ "$(printf '%s\n%s\n' "$_GTM_MIN_GLIBC" "$have" | sort -V | head -1)" == "$_GTM_MIN_GLIBC" ]] +} + +# Download version $1 for architecture $2, check it against the .sha256 file +# upstream publishes beside it, and unpack it into a new directory next to the +# install path (same filesystem, so the swap is a rename). Leaves the unpacked +# tree in $_GTM_NEW. +_gtm_download() { + local version="$1" arch="$2" name base sum expected tmpdir top + _GTM_NEW="" + name="gputaskman-${version}-linux-${arch}" + base="https://github.com/${_GTM_REPO}/releases/download/v${version}" + + sum=$(curl -fsSL --max-time 30 "${base}/${name}.tar.gz.sha256" 2>/dev/null) || { + error "Could not download the GPU Task Manager ${version} checksum file." + return 1 + } + expected=$(printf '%s\n' "$sum" | grep -oE '^[0-9a-fA-F]{64}' | head -1) + if [[ -z "$expected" ]]; then + error "The GPU Task Manager ${version} checksum file does not hold a SHA-256." + return 1 + fi + + mkdir -p "$(dirname "$_GTM_DIR")" || return 1 + tmpdir=$(mktemp -d "$(dirname "$_GTM_DIR")/.gputaskman-XXXXXX") || return 1 + CLEANUP_FILES+=("$tmpdir") + + info "Downloading GPU Task Manager ${version} (about 20 MB)..." + download_file "${base}/${name}.tar.gz" "$tmpdir/${name}.tar.gz" || { + rm -rf "$tmpdir" + error "Failed to download GPU Task Manager ${version}." + return 1 + } + verify_download "$tmpdir/${name}.tar.gz" tar.gz "GPU Task Manager" || { rm -rf "$tmpdir"; return 1; } + verify_sha256 "$tmpdir/${name}.tar.gz" "$expected" "GPU Task Manager ${version}" || { + rm -rf "$tmpdir" + error "GPU Task Manager ${version} failed SHA-256 verification; nothing was installed." + return 1 + } + + if ! tar -xzf "$tmpdir/${name}.tar.gz" -C "$tmpdir"; then + rm -rf "$tmpdir" + error "Failed to unpack the GPU Task Manager archive." + return 1 + fi + top="$tmpdir/$name" + # A layout change upstream stops here rather than installing half a bundle. + if [[ ! -f "$top/gputaskman" || ! -d "$top/_internal" ]]; then + rm -rf "$tmpdir" + error "The GPU Task Manager archive has an unexpected layout (no gputaskman and _internal); nothing was installed." + return 1 + fi + chmod 0755 "$top/gputaskman" + printf '%s\n' "$version" > "$top/.linux_util-version" + rm -f "$tmpdir/${name}.tar.gz" + _GTM_NEW="$top" +} + +install_gputaskman() { + info "Installing GPU Task Manager..." + local arch version glibc + if ! arch=$(_gtm_arch); then + error "GPU Task Manager is published for x86_64 and aarch64 only (this machine is $(uname -m))." + return 1 + fi + glibc=$(_gtm_glibc_version) + if ! _gtm_glibc_ok "$glibc"; then + error "GPU Task Manager needs glibc ${_GTM_MIN_GLIBC} or newer; this system has ${glibc:-no glibc}." + return 1 + fi + ensure_tools + + version=$(_gtm_latest_version) + if [[ -z "$version" ]]; then + error "Could not find the latest GPU Task Manager release on GitHub." + return 1 + fi + + _gtm_download "$version" "$arch" || return 1 + + rm -rf "$_GTM_DIR" || { error "Could not remove the old copy in ${_GTM_DIR}."; return 1; } + mv "$_GTM_NEW" "$_GTM_DIR" || { error "Failed to install GPU Task Manager to ${_GTM_DIR}."; return 1; } + rm -rf "$(dirname "$_GTM_NEW")" + + mkdir -p "$(dirname "$_GTM_BIN")" || return 1 + ln -sfn "$_GTM_EXE" "$_GTM_BIN" + + info "GPU Task Manager ${version} installed (command: gputaskman)." + info "Run gputaskman in a terminal (q quits); sudo gputaskman also lists other users' processes." + case ":$PATH:" in + *":$HOME/.local/bin:"*) ;; + *) + # shellcheck disable=SC2088 # the literal ~ is the text shown, not a path + warn "~/.local/bin is not on your PATH; run ${_GTM_BIN} or add ~/.local/bin to PATH." + ;; + esac +} + +uninstall_gputaskman() { + info "Uninstalling GPU Task Manager..." + if [[ ! -e "$_GTM_DIR" ]]; then + echo "GPU Task Manager installation not found." + return 0 + fi + rm -rf "$_GTM_DIR" || return 1 + [[ -L "$_GTM_BIN" && "$(readlink "$_GTM_BIN")" == "$_GTM_EXE" ]] && rm -f "$_GTM_BIN" + info "GPU Task Manager has been uninstalled." +} + +update_gputaskman() { + info "Updating GPU Task Manager..." + local installed latest + installed=$(get_version_gputaskman) + latest=$(_gtm_latest_version) + # An unknown version on either side falls through and reinstalls rather than + # risk skipping a real update. + if [[ -n "$installed" && "$installed" == "$latest" ]]; then + info "GPU Task Manager is already at the latest version (${installed})." + return 0 + fi + install_gputaskman +} diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 415b509..13fe074 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -4848,6 +4848,72 @@ test_lm_studio_registered test_lm_studio_version_taken_from_redirect_url test_lm_studio_version_from_appimage_is_cached_and_follows_the_file +# ---------------------------------------------------------------------------- +echo "" +echo "=== GPU Task Manager ===" + +test_gputaskman_registered() { + local fn gaps=0 + grep -qE '^register_utility "GPU Task Manager"[[:space:]]+install_gputaskman ' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + grep -q '^UTILITY_CATEGORY\["GPU Task Manager"\]="System Tools"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + grep -q '^UTILITY_DESCRIPTION\["GPU Task Manager"\]=' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + grep -q '"GPU Task Manager=\$_GTM_DIR"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + grep -q '"GPU Task Manager=_gtm_latest_version"' "${SCRIPT_DIR}/lib/installers.sh" || gaps=1 + for fn in install check uninstall update get_version; do + grep -q "^${fn}_gputaskman()" "${SCRIPT_DIR}/lib/installers/gputaskman.sh" || gaps=1 + done + assert_eq "0" "$gaps" "GPU Task Manager is registered with category, description, upstream-binary marks and all five functions" +} + +# GitHub's /releases/latest redirects to the newest tag's page; the version is +# the tag without its leading v. Anything else gives no version. +test_gputaskman_version_taken_from_redirect_url() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/gputaskman.sh" + printf '%s\n' 'https://github.com/shanselman/gputaskman/releases/tag/v0.4.0' | _gtm_version_from_url + printf '%s\n' 'https://github.com/shanselman/gputaskman/releases/tag/v1.12.30' | _gtm_version_from_url + printf '%s\n' 'https://github.com/shanselman/gputaskman/releases/tag/nightly' | _gtm_version_from_url + printf '%s\n' 'https://github.com/shanselman/gputaskman/releases' | _gtm_version_from_url + ) + assert_eq "0.4.0 1.12.30 " "$(echo $out) " "GPU Task Manager latest version is the release tag without its v, and empty for other URLs" +} + +# Upstream's build needs glibc 2.35 (Ubuntu 22.04, Debian 12); Rocky 9's 2.34 +# and a system without glibc are refused, 2.35 and later accepted. +test_gputaskman_glibc_minimum() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/gputaskman.sh" + for v in 2.34 2.35 2.39 2.4 3.0 ""; do + if _gtm_glibc_ok "$v"; then printf 'y'; else printf 'n'; fi + done + ) + assert_eq "nyynyn" "$out" "GPU Task Manager accepts glibc 2.35 and newer and refuses 2.34, 2.4 and no glibc" +} + +# The bundle has no --version flag; the version is the one written beside it +# at install time, and nothing is reported when it is not installed. +test_gputaskman_version_from_install_stamp() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/gputaskman.sh" + d=$(mktemp -d) + _GTM_VERSION_FILE="$d/.linux_util-version" + a=$(get_version_gputaskman) + printf '0.4.0\n' > "$_GTM_VERSION_FILE" + b=$(get_version_gputaskman) + rm -rf "$d" + echo "[$a] [$b]" + ) + assert_eq "[] [0.4.0]" "$out" "GPU Task Manager version is read from the install stamp and empty when not installed" +} + +test_gputaskman_registered +test_gputaskman_version_taken_from_redirect_url +test_gputaskman_glibc_minimum +test_gputaskman_version_from_install_stamp + # ---------------------------------------------------------------------------- echo "" echo "=== ArtCraft / Craft apps ===" From b056691d059b7d1661bd4399a9efa613155b15cb Mon Sep 17 00:00:00 2001 From: acebmxer Date: Wed, 11 Nov 2026 11:57:43 -0500 Subject: [PATCH 5/7] feat: add Multimedia Codecs, bat, ripgrep and shared RPM Fusion helper Add three new utilities: Multimedia Codecs (Productivity), plus bat and ripgrep (System Tools), with registry entries, completions, docs and tests. Introduce ensure_rpmfusion and enable_crb in _shared.sh so every installer enables RPM Fusion in one place, by major version, with EPEL and CRB enabled first on RHEL clones. Previously NVIDIA Drivers asked for the full OS version (e.g. 9.8), which RPM Fusion does not publish, so the download failed on Rocky Linux. VLC, Steam, OBS Studio, Lutris, MangoHud, HandBrake and the AMD and Intel drivers now use the helper and stop with a clear error if it can't be enabled. Fixes #86 --- CHANGELOG.md | 28 ++++++ README.md | 6 +- completions/_linux_util | 3 + completions/linux_util.bash | 3 + docs/utilities.md | 7 +- lib/installers.sh | 9 ++ lib/installers/_shared.sh | 50 ++++++++++ lib/installers/amd_drivers.sh | 7 +- lib/installers/bat.sh | 57 ++++++++++++ lib/installers/handbrake.sh | 5 +- lib/installers/intel_drivers.sh | 15 +-- lib/installers/kde.sh | 2 +- lib/installers/lutris.sh | 6 +- lib/installers/mangohud.sh | 5 +- lib/installers/multimedia_codecs.sh | 136 ++++++++++++++++++++++++++++ lib/installers/nvidia_drivers.sh | 11 +-- lib/installers/obs_studio.sh | 6 +- lib/installers/ripgrep.sh | 31 +++++++ lib/installers/steam.sh | 12 +-- lib/installers/vlc.sh | 11 +-- tests/test_linux_util.sh | 126 ++++++++++++++++++++++++++ 21 files changed, 468 insertions(+), 68 deletions(-) create mode 100644 lib/installers/bat.sh create mode 100644 lib/installers/multimedia_codecs.sh create mode 100644 lib/installers/ripgrep.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 09f7d64..d8f7e19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,24 @@ when a release is cut. ### Added +- **Multimedia Codecs** (Productivity), full audio and video playback and + encoding (H.264, HEVC, AAC and more) for FFmpeg and GStreamer apps such as + browsers, video players and editors. On Fedora it enables RPM Fusion, + replaces Fedora's limited `ffmpeg-free` with the full `ffmpeg` and installs + the `multimedia` group, as RPM Fusion's own guide does. RHEL clones get + RPM Fusion for EL (with EPEL and CRB), Debian/Ubuntu and Arch get `ffmpeg` + and the GStreamer plugin sets, and openSUSE gets Packman's codecs through + openSUSE's own `opi codecs`. Uninstall is not offered, since media apps link + against the codecs. + +- **bat** (System Tools), `cat` with syntax highlighting, line numbers and Git + change markers. Debian and Ubuntu name the command `batcat`, so a `bat` link + to it is added in `~/.local/bin` unless something there is already called + `bat`; uninstall removes only that link. + +- **ripgrep** (System Tools), the `rg` search tool: finds text in a folder tree + much faster than `grep -r` and skips files listed in `.gitignore`. + - **GPU Task Manager** (System Tools), a terminal task manager for the GPU: per-process VRAM and GPU load, and which runtimes and model files (llama.cpp, Ollama, PyTorch) are using it, on NVIDIA, AMD (amdgpu) and Intel @@ -49,6 +67,16 @@ when a release is cut. `hermes uninstall`, which keeps your settings and data in `~/.hermes`. System Updates refreshes it. Fixes #83. +### Fixed + +- **NVIDIA Drivers** on Rocky Linux and other RHEL clones can enable RPM Fusion + again. It asked for RPM Fusion's release package by the full OS version + (`9.8`), which RPM Fusion does not publish, so the download failed. RPM + Fusion is now enabled in one shared place, by major version, with EPEL and + CRB first; VLC, Steam, OBS Studio, Lutris, MangoHud, HandBrake and the AMD + and Intel drivers use it too, and now stop with a clear error when it can't + be enabled. Fixes #86. + ## [1.11.2] - 2026-10-25 ### Changed diff --git a/README.md b/README.md index efd5c7e..f9189f5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![Unique cloners](https://img.shields.io/badge/unique%20cloners-29-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-492%20unit-informational)](https://github.com/acebmxer/linux_util/actions/workflows/ci.yml) +[![Tests](https://img.shields.io/badge/tests-502%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) @@ -131,13 +131,13 @@ 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, Obsidian, Joplin, Logseq, Bitwarden, Nextcloud, NVIDIA PAIR, WinApps | +| **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 | | **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) | | **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, ClamAV, Stacer, Filelight, Input Leap, OCCT, Pay Respects, Zsh + Oh My Zsh, and a Kernel Managers folder | +| **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 | 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 d49c67a..3788584 100644 --- a/completions/_linux_util +++ b/completions/_linux_util @@ -7,6 +7,7 @@ _linux_util_utilities=( 'AMD Drivers' 'ArtCraft Launcher' + 'bat' 'Betterbird' 'Bitwarden Client' 'Bitwarden Extension' @@ -75,6 +76,7 @@ _linux_util_utilities=( 'Mainline' 'MangoHud' 'MATE Desktop' + 'Multimedia Codecs' 'NeoMutt' 'Nextcloud Desktop' 'Num Lock at Boot' @@ -102,6 +104,7 @@ _linux_util_utilities=( 'QBittorrent' 'Remmina' 'Restore Snapshot' + 'ripgrep' 'Signal Desktop' 'SponsorBlock Extension' 'Stacer' diff --git a/completions/linux_util.bash b/completions/linux_util.bash index fe303e7..87ecf65 100644 --- a/completions/linux_util.bash +++ b/completions/linux_util.bash @@ -5,6 +5,7 @@ _linux_util_utilities() { cat <<'EOF' AMD Drivers ArtCraft Launcher +bat Betterbird Bitwarden Client Bitwarden Extension @@ -74,6 +75,7 @@ LXQt Desktop Mainline MangoHud MATE Desktop +Multimedia Codecs NeoMutt Nextcloud Desktop NVIDIA Drivers @@ -100,6 +102,7 @@ ProtonVPN QBittorrent Remmina Restore Snapshot +ripgrep Signal Desktop SponsorBlock Extension Stacer diff --git a/docs/utilities.md b/docs/utilities.md index 18053ea..b2a39b4 100644 --- a/docs/utilities.md +++ b/docs/utilities.md @@ -16,8 +16,8 @@ Themes)* or *(Remote Access)* are the subcategory folder the item sits in. | [Package Managers](#package-managers) | [Productivity](#productivity) | [Remote Admin Tools](#remote-admin-tools) | | [System Tools](#system-tools) | | | -> **Incomplete:** 246 utilities and system tasks are registered in -> `lib/installers.sh`; 201 are listed below. The **File Managers**, **Firewalls**, +> **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, @@ -251,6 +251,7 @@ Additional, cross-distro managers that run alongside the native package manager | **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 | | **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 | @@ -281,6 +282,7 @@ Additional, cross-distro managers that run alongside the native package manager | 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 | @@ -289,6 +291,7 @@ Additional, cross-distro managers that run alongside the native package manager | **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 | | **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 | | **Zsh + Oh My Zsh** | Z shell with Oh My Zsh framework, themes, and plugins | diff --git a/lib/installers.sh b/lib/installers.sh index ab0e921..4a5aad5 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -162,6 +162,7 @@ register_utility "Brave Browser" install_brave check_brave register_utility "Brave Debloat" install_brave_debloat check_brave_debloat uninstall_brave_debloat update_brave_debloat get_version_brave_debloat register_utility "Brave Origin" install_brave_origin check_brave_origin uninstall_brave_origin update_brave_origin get_version_brave_origin register_utility "Btop" install_btop check_btop uninstall_btop update_btop get_version_btop +register_utility "bat" install_bat check_bat uninstall_bat update_bat get_version_bat register_utility "Intel CPU Microcode & Thermal" install_intel_chipset_drivers check_intel_chipset_drivers uninstall_intel_chipset_drivers update_intel_chipset_drivers get_version_intel_chipset_drivers register_utility "Chromium" install_chromium check_chromium uninstall_chromium update_chromium get_version_chromium register_utility "ClamAV" install_clamav check_clamav uninstall_clamav update_clamav get_version_clamav @@ -242,6 +243,7 @@ register_utility "Logseq" install_logseq check_logseq register_utility "Lutris" install_lutris check_lutris uninstall_lutris update_lutris get_version_lutris register_utility "MangoHud" install_mangohud check_mangohud uninstall_mangohud update_mangohud get_version_mangohud register_utility "Mark Text" install_marktext check_marktext uninstall_marktext update_marktext get_version_marktext +register_utility "Multimedia Codecs" install_multimedia_codecs check_multimedia_codecs uninstall_multimedia_codecs update_multimedia_codecs get_version_multimedia_codecs register_utility "NeoMutt" install_neomutt check_neomutt uninstall_neomutt update_neomutt get_version_neomutt register_utility "Neovim" install_neovim check_neovim uninstall_neovim update_neovim get_version_neovim register_utility "Nextcloud Desktop" install_nextcloud_desktop check_nextcloud_desktop uninstall_nextcloud_desktop update_nextcloud_desktop get_version_nextcloud_desktop @@ -269,6 +271,7 @@ register_utility "ProtonVPN" install_protonvpn check_protonvpn register_utility "pyenv" install_pyenv check_pyenv uninstall_pyenv update_pyenv get_version_pyenv register_utility "QBittorrent" install_qbittorrent check_qbittorrent uninstall_qbittorrent update_qbittorrent get_version_qbittorrent register_utility "Remmina" install_remmina check_remmina uninstall_remmina update_remmina get_version_remmina +register_utility "ripgrep" install_ripgrep check_ripgrep uninstall_ripgrep update_ripgrep get_version_ripgrep register_utility "RustDesk" install_rustdesk check_rustdesk uninstall_rustdesk update_rustdesk get_version_rustdesk register_utility "Rustup" install_rustup check_rustup uninstall_rustup update_rustup get_version_rustup register_utility "Signal Desktop" install_signal check_signal uninstall_signal update_signal get_version_signal @@ -591,6 +594,8 @@ UTILITY_CATEGORY["Brave Browser"]="Internet" UTILITY_CATEGORY["Brave Debloat"]="Internet" UTILITY_CATEGORY["Brave Origin"]="Internet" UTILITY_CATEGORY["Btop"]="System Tools" +UTILITY_CATEGORY["bat"]="System Tools" +UTILITY_CATEGORY["ripgrep"]="System Tools" UTILITY_CATEGORY["GPU Task Manager"]="System Tools" UTILITY_CATEGORY["Chromium"]="Internet" UTILITY_CATEGORY["Claude Code"]="Development" @@ -744,6 +749,7 @@ UTILITY_CATEGORY["KDiskMark"]="Disk Utilities" UTILITY_CATEGORY["Virt-Manager"]="Development" UTILITY_CATEGORY["Firecracker"]="Development" UTILITY_CATEGORY["VLC"]="Productivity" +UTILITY_CATEGORY["Multimedia Codecs"]="Productivity" UTILITY_CATEGORY["Zen Browser"]="Internet" UTILITY_CATEGORY["Zoom"]="Internet" UTILITY_CATEGORY["Zotero"]="Productivity" @@ -1115,6 +1121,7 @@ UTILITY_DESCRIPTION["Libation"]="Open-source Audible audiobook manager for downl 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." UTILITY_DESCRIPTION["VLC"]="Versatile open-source media player supporting virtually every audio and video format without additional codecs." +UTILITY_DESCRIPTION["Multimedia Codecs"]="Full audio and video codecs (H.264, HEVC, AAC and more) for FFmpeg and GStreamer apps such as browsers, video players and editors. 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. openSUSE: Packman through opi codecs. Not removable from here, since media apps link against the codecs." UTILITY_DESCRIPTION["Zotero"]="Free reference manager for collecting, organizing, annotating, and citing research sources." UTILITY_DESCRIPTION["Joplin Client"]="Open-source note-taking and to-do application with Markdown support and sync." UTILITY_DESCRIPTION["Joplin Web Clipper"]="Deploys Joplin Web Clipper browser extension via policy files for all detected browsers (Brave, Chrome, Chromium, Firefox, LibreWolf, Thorium, Vivaldi). Captures web pages and screenshots directly into Joplin — requires the Joplin desktop app running with Web Clipper service enabled." @@ -1135,6 +1142,8 @@ UTILITY_DESCRIPTION["CachyOS Kernel Manager"]="GUI to install, build, swap, and UTILITY_DESCRIPTION["Fedora Mainline Kernel"]="Enables the community @kernel-vanilla/mainline Copr and installs the latest upstream (vanilla) mainline kernel on Fedora — the standard way to test an upstream kernel there, since Fedora has no dedicated GUI manager. Fedora only. Mainline kernels are unsigned, so Secure Boot must be disabled to boot them; the stock Fedora kernel is kept as a fallback." UTILITY_DESCRIPTION["linux-tkg"]="Frogging-Family custom-kernel builder. Unlike the other kernel managers it BUILDS a kernel from source — you pick the CPU scheduler (BORE, EEVDF, PDS, …), compiler, and config. Cross-distro: makepkg on Arch, or ./install.sh on Debian/Ubuntu, Fedora, and openSUSE (it produces and installs a .deb/.rpm). The build is interactive and can take 20-60+ minutes; kernels carry 'tkg' in the name and are removed manually (./install.sh uninstall-help). Build deps are installed automatically where possible." 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["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." diff --git a/lib/installers/_shared.sh b/lib/installers/_shared.sh index 3517537..93473a5 100644 --- a/lib/installers/_shared.sh +++ b/lib/installers/_shared.sh @@ -312,6 +312,56 @@ ensure_appimage_fuse() { esac } +# Enable the CRB repository on a RHEL clone (named powertools on EL 8). The crb +# helper ships with epel-release; config-manager is the fallback without it. +# Shared by KDE Plasma and ensure_rpmfusion; do not add a copy. +enable_crb() { + run_as_root crb enable &>/dev/null || \ + run_as_root "$PKG_MGR" config-manager --set-enabled crb &>/dev/null || true +} + +# Whether RPM Fusion's release package for the given section ($1: free or +# nonfree, default free) is installed. +rpmfusion_enabled() { + rpm -q "rpmfusion-${1:-free}-release" &>/dev/null +} + +# Enable RPM Fusion on Fedora or a RHEL clone, if it is not already enabled. +# $1 is free (the default) or nonfree; nonfree also enables free. On RHEL +# clones RPM Fusion depends on EPEL and the CRB repository, so both are enabled +# first. The release package is named by the major version (rpm -E), never the +# point release in os-release (9.8), which RPM Fusion does not publish (#86). +# Every installer that needs RPM Fusion calls this; do not add a copy. +ensure_rpmfusion() { + local want="${1:-free}" os ver section + local -a urls=() + case "$DISTRO_FAMILY" in + fedora) os=fedora; ver=$(rpm -E %fedora) ;; + rhel) os=el; ver=$(rpm -E %rhel) ;; + *) error "RPM Fusion is only available on Fedora and RHEL-family systems."; return 1 ;; + esac + + local -a sections=(free) + [[ "$want" == "nonfree" ]] && sections+=(nonfree) + for section in "${sections[@]}"; do + rpmfusion_enabled "$section" || \ + urls+=("https://mirrors.rpmfusion.org/${section}/${os}/rpmfusion-${section}-release-${ver}.noarch.rpm") + done + (( ${#urls[@]} )) || return 0 + + if [[ "$DISTRO_FAMILY" == "rhel" ]]; then + rpm -q epel-release &>/dev/null || pkg_install epel-release || { + error "Failed to enable EPEL, which RPM Fusion needs on ${DISTRO_NAME}." + return 1 + } + enable_crb + fi + + info "Enabling RPM Fusion (${sections[*]})..." + pkg_install "${urls[@]}" || { error "Failed to enable RPM Fusion."; return 1; } + run_as_root "$PKG_MGR" makecache &>/dev/null || true +} + # Debian 13 and Ubuntu 24.04+ renamed several libraries for the 64-bit time_t # transition (libasound2 -> libasound2t64). apt picks the new name by itself # for some of them but not for libasound2, which has two providers on Ubuntu. diff --git a/lib/installers/amd_drivers.sh b/lib/installers/amd_drivers.sh index 9112a71..6174b34 100644 --- a/lib/installers/amd_drivers.sh +++ b/lib/installers/amd_drivers.sh @@ -42,15 +42,12 @@ install_amd_drivers() { # RPM Fusion free carries mesa-va-drivers-freeworld: Fedora's own Mesa # leaves out H.264/H.265/VC-1 video acceleration. It installs beside # Fedora's Mesa (/usr/lib64/dri-freeworld), which libva searches first. - if ! rpm -q rpmfusion-free-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" - fi + ensure_rpmfusion free || return 1 pkg_install mesa-dri-drivers mesa-vulkan-drivers vulkan-tools vulkan-loader xorg-x11-drv-amdgpu \ mesa-va-drivers-freeworld libva-utils # RPM Fusion provides 32-bit Mesa (lib32-mesa) for Steam - if rpm -q rpmfusion-free-release &>/dev/null; then + if rpmfusion_enabled free; then pkg_install mesa-vulkan-drivers.i686 vulkan-loader.i686 2>/dev/null || true fi ;; diff --git a/lib/installers/bat.sh b/lib/installers/bat.sh new file mode 100644 index 0000000..8a06545 --- /dev/null +++ b/lib/installers/bat.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# bat installer functions +# +# A cat clone with syntax highlighting, line numbers and Git change markers. +# Every supported distro packages it (RHEL clones through EPEL). Debian and +# Ubuntu install the command as batcat, because another package already owned +# the name bat; a bat link to it is made in ~/.local/bin so the usual name works. + +# --- bat --- + +_BAT_LINK="$HOME/.local/bin/bat" +_BAT_BATCAT=/usr/bin/batcat + +check_bat() { _check_standard bat bat ""; } + +# Debian/Ubuntu only: point ~/.local/bin/bat at batcat, unless something else +# is already called bat there. +_bat_link_batcat() { + [[ "$DISTRO_FAMILY" == "debian" ]] || return 0 + [[ -x "$_BAT_BATCAT" ]] || return 0 + [[ -e "$_BAT_LINK" || -L "$_BAT_LINK" ]] && return 0 + mkdir -p "$(dirname "$_BAT_LINK")" && ln -s "$_BAT_BATCAT" "$_BAT_LINK" && \ + info "Linked ${_BAT_LINK} to batcat so the command bat works." +} + +install_bat() { + info "Installing bat..." + case "$DISTRO_FAMILY" in + rhel) + pkg_install epel-release 2>/dev/null || true + pkg_install bat || return 1 + ;; + debian|fedora|arch|suse) + pkg_install bat || return 1 + ;; + esac + _bat_link_batcat + info "bat installed." +} + +uninstall_bat() { + info "Uninstalling bat..." + pkg_remove bat + # Only the link this installer made; a bat of the user's own is left alone. + [[ -L "$_BAT_LINK" && "$(readlink "$_BAT_LINK")" == "$_BAT_BATCAT" ]] && rm -f "$_BAT_LINK" + return 0 +} + +update_bat() { + info "Updating bat..." + pkg_upgrade bat + _bat_link_batcat +} + +get_version_bat() { + _ver_from_cmd bat || _ver_from_cmd batcat || echo "" +} diff --git a/lib/installers/handbrake.sh b/lib/installers/handbrake.sh index c45b1cf..80f7769 100644 --- a/lib/installers/handbrake.sh +++ b/lib/installers/handbrake.sh @@ -22,10 +22,7 @@ install_handbrake() { ;; fedora) # HandBrake requires RPM Fusion Free - if ! rpm -q rpmfusion-free-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" - fi + ensure_rpmfusion free || return 1 pkg_install HandBrake-gui HandBrake-cli ;; rhel) diff --git a/lib/installers/intel_drivers.sh b/lib/installers/intel_drivers.sh index 9de4cfe..74ff064 100644 --- a/lib/installers/intel_drivers.sh +++ b/lib/installers/intel_drivers.sh @@ -46,21 +46,12 @@ install_intel_drivers() { # RPM Fusion nonfree carries the full-codec intel-media-driver; # Fedora's own libva-intel-media-driver is the codec-reduced build. # It installs to /usr/lib64/dri-nonfree, which libva searches first. - if ! rpm -q rpmfusion-nonfree-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" \ - "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm" - fi + ensure_rpmfusion nonfree || return 1 pkg_install mesa-dri-drivers mesa-vulkan-drivers vulkan-tools vulkan-loader intel-media-driver libva-utils ;; rhel) - # RPM Fusion for EL (which needs EPEL) carries intel-media-driver - pkg_install epel-release 2>/dev/null || true - if ! rpm -q rpmfusion-nonfree-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm" \ - "https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm" - fi + # RPM Fusion for EL carries intel-media-driver + ensure_rpmfusion nonfree || return 1 pkg_install mesa-dri-drivers mesa-vulkan-drivers vulkan-tools vulkan-loader intel-media-driver 2>/dev/null || true pkg_install libva-utils 2>/dev/null || true ;; diff --git a/lib/installers/kde.sh b/lib/installers/kde.sh index 6ab0d35..abdf4e8 100644 --- a/lib/installers/kde.sh +++ b/lib/installers/kde.sh @@ -135,7 +135,7 @@ setup_install_kde() { dnf|yum) # EPEL / CRB are needed on RHEL clones for the Plasma packages. run_as_root "$PKG_MGR" install -y epel-release 2>/dev/null || true - run_as_root crb enable 2>/dev/null || run_as_root "$PKG_MGR" config-manager --set-enabled crb 2>/dev/null || true + enable_crb case "$tier" in minimal) info "Installing KDE Plasma (Minimal/Core)..." diff --git a/lib/installers/lutris.sh b/lib/installers/lutris.sh index 59622a7..c6330ca 100644 --- a/lib/installers/lutris.sh +++ b/lib/installers/lutris.sh @@ -18,11 +18,7 @@ install_lutris() { ;; fedora) # Lutris is available via RPM Fusion free - if ! rpm -q rpmfusion-free-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" - sudo "$PKG_MGR" makecache - fi + ensure_rpmfusion free || return 1 pkg_install lutris ;; rhel) diff --git a/lib/installers/mangohud.sh b/lib/installers/mangohud.sh index 8eb8aad..251c622 100644 --- a/lib/installers/mangohud.sh +++ b/lib/installers/mangohud.sh @@ -38,10 +38,7 @@ install_mangohud() { ;; fedora) # MangoHud is in RPM Fusion free - if ! rpm -q rpmfusion-free-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" - fi + ensure_rpmfusion free || return 1 pkg_install mangohud ;; rhel) diff --git a/lib/installers/multimedia_codecs.sh b/lib/installers/multimedia_codecs.sh new file mode 100644 index 0000000..60e4887 --- /dev/null +++ b/lib/installers/multimedia_codecs.sh @@ -0,0 +1,136 @@ +#!/bin/bash +# Multimedia Codecs installer functions +# +# Full audio/video playback and encoding (H.264, HEVC, AAC and the rest) for +# FFmpeg and GStreamer apps (Firefox, Totem, Dolphin previews, Kdenlive). +# Fedora RPM Fusion; Fedora's ffmpeg-free swapped for RPM Fusion's ffmpeg, +# then the multimedia group, which adds RPM Fusion's GStreamer +# plugins (the steps RPM Fusion's own guide gives) +# RHEL RPM Fusion for EL; ffmpeg and the GStreamer plugins by name +# (EL has no multimedia group with RPM Fusion's packages in it) +# Debian ffmpeg and the GStreamer plugin sets; Ubuntu needs universe +# Arch ffmpeg and the GStreamer plugin sets +# openSUSE opi codecs, openSUSE's own tool: adds Packman and switches the +# codec packages to its full builds + +# GStreamer libav plugin package on RHEL clones: EL 8 calls it gstreamer1-libav, +# EL 9 and later gstreamer1-plugin-libav. +_codecs_rhel_libav() { + if [[ "${DISTRO_VERSION_ID%%.*}" == "8" ]]; then echo gstreamer1-libav; else echo gstreamer1-plugin-libav; fi +} + +# Packages whose presence means the codecs are installed, one per line. +_codecs_packages() { + case "$DISTRO_FAMILY" in + fedora) printf '%s\n' ffmpeg gstreamer1-plugin-libav gstreamer1-plugins-ugly gstreamer1-plugins-bad-freeworld ;; + rhel) printf '%s\n' ffmpeg "$(_codecs_rhel_libav)" gstreamer1-plugins-ugly gstreamer1-plugins-bad-freeworld gstreamer1-plugins-good ;; + debian) printf '%s\n' ffmpeg gstreamer1.0-libav gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-plugins-good ;; + arch) printf '%s\n' ffmpeg gst-libav gst-plugins-ugly gst-plugins-bad gst-plugins-good ;; + suse) printf '%s\n' gstreamer-plugins-libav gstreamer-plugins-ugly gstreamer-plugins-bad ;; + esac +} + +_codecs_packman_enabled() { + zypper --non-interactive lr -u 2>/dev/null | grep -qi 'packman' +} + +check_multimedia_codecs() { + local pkg + case "$DISTRO_FAMILY" in + fedora|rhel) rpmfusion_enabled free || return 1 ;; + suse) _codecs_packman_enabled || return 1 ;; + debian|arch) ;; + *) return 1 ;; + esac + while IFS= read -r pkg; do + pkg_check_installed "$pkg" || return 1 + done < <(_codecs_packages) + _have_cmd ffmpeg +} + +install_multimedia_codecs() { + info "Installing multimedia codecs..." + local -a pkgs=() + mapfile -t pkgs < <(_codecs_packages) + + case "$DISTRO_FAMILY" in + fedora) + ensure_rpmfusion nonfree || return 1 + # Fedora's ffmpeg-free leaves out the patent-encumbered codecs. + if pkg_check_installed ffmpeg-free; then + run_with_spinner "Replacing ffmpeg-free with RPM Fusion's ffmpeg" \ + sudo "$PKG_MGR" swap -y ffmpeg-free ffmpeg --allowerasing || { + error "Failed to replace ffmpeg-free with ffmpeg." + return 1 + } + else + pkg_install ffmpeg || return 1 + fi + # PackageKit's GStreamer plugin pops up "install codec?" prompts + # that are no longer needed once the codecs are present. + run_with_spinner "Installing the multimedia group" \ + sudo "$PKG_MGR" group install -y multimedia \ + --setopt=install_weak_deps=False --exclude=PackageKit-gstreamer-plugin || { + error "Failed to install the multimedia group." + return 1 + } + ;; + rhel) + ensure_rpmfusion free || return 1 + pkg_install "${pkgs[@]}" || return 1 + ;; + debian) + pkg_install "${pkgs[@]}" || { + [[ "$DISTRO_ID" =~ ^(ubuntu|kubuntu|neon)$ ]] && \ + warn "These packages are in Ubuntu's universe component; enable it in Software & Updates and try again." + return 1 + } + ;; + arch) + pkg_install "${pkgs[@]}" || return 1 + ;; + suse) + pkg_check_installed opi || pkg_install opi || return 1 + # -n answers opi's prompts itself: adds Packman on its first + # mirror, imports its key and adds the openh264 repository. + run_with_spinner "Installing codecs from Packman (opi codecs)" sudo opi -n codecs || { + error "opi codecs failed." + return 1 + } + ;; + *) + error "Multimedia codecs are not supported on ${DISTRO_NAME}." + return 1 + ;; + esac + info "Multimedia codecs installed." +} + +uninstall_multimedia_codecs() { + warn "The codecs are shared libraries that media apps (VLC, OBS, HandBrake, browsers) link against." + warn "Removing them can remove or break those apps, so this operation is not supported." + return 1 +} + +update_multimedia_codecs() { + info "Updating multimedia codecs..." + local -a pkgs=() + mapfile -t pkgs < <(_codecs_packages) + # On openSUSE the packages stay with Packman's vendor once opi has switched + # them, so a plain upgrade keeps taking Packman's builds. + (( ${#pkgs[@]} )) && pkg_upgrade "${pkgs[@]}" +} + +# The FFmpeg version from the first line of `ffmpeg -version` on stdin: +# "ffmpeg version 9.0.2 Copyright..." (Fedora), "7.1.5-0+deb13u1" (Debian), +# "n7.1" (some builds). Prints nothing for anything else. +_codecs_version_from_output() { + head -1 | grep -oP '^ffmpeg version n?\K[0-9]+(\.[0-9]+)+' || true +} + +# Reported as the FFmpeg version. +get_version_multimedia_codecs() { + local bin + bin=$(_native_command ffmpeg) || { echo ""; return 0; } + "$bin" -version 2>/dev/null | _codecs_version_from_output +} diff --git a/lib/installers/nvidia_drivers.sh b/lib/installers/nvidia_drivers.sh index 1fac30d..a72cd58 100644 --- a/lib/installers/nvidia_drivers.sh +++ b/lib/installers/nvidia_drivers.sh @@ -498,7 +498,7 @@ install_nvidia_drivers() { echo "Detecting available NVIDIA drivers..." # Check if RPM Fusion (nonfree) is enabled - if ! dnf repolist 2>/dev/null | grep -qi 'rpmfusion.*nonfree'; then + if ! rpmfusion_enabled nonfree; then echo "" echo "[!] RPM Fusion (nonfree) repository is required for NVIDIA drivers on Fedora/RHEL." echo "" @@ -510,14 +510,7 @@ install_nvidia_drivers() { esac done if [[ "$enable_rpmfusion" =~ ^[Yy]$ ]]; then - echo "Enabling RPM Fusion repositories..." - if [[ "$DISTRO_ID" == "fedora" ]]; then - pkg_install "https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-${DISTRO_VERSION_ID}.noarch.rpm" "https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-${DISTRO_VERSION_ID}.noarch.rpm" - else - # RHEL/CentOS - pkg_install "https://download1.rpmfusion.org/free/el/rpmfusion-free-release-${DISTRO_VERSION_ID}.noarch.rpm" "https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-${DISTRO_VERSION_ID}.noarch.rpm" - fi - pkg_refresh >/dev/null 2>&1 + ensure_rpmfusion nonfree || return 1 else warn "RPM Fusion is required for NVIDIA drivers. Installation cancelled." return 1 diff --git a/lib/installers/obs_studio.sh b/lib/installers/obs_studio.sh index 6aedd34..0dcef50 100644 --- a/lib/installers/obs_studio.sh +++ b/lib/installers/obs_studio.sh @@ -19,11 +19,7 @@ install_obs_studio() { ;; fedora) # OBS is in RPM Fusion free - if ! rpm -q rpmfusion-free-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" - sudo "$PKG_MGR" makecache - fi + ensure_rpmfusion free || return 1 pkg_install obs-studio ;; rhel) diff --git a/lib/installers/ripgrep.sh b/lib/installers/ripgrep.sh new file mode 100644 index 0000000..7b261d8 --- /dev/null +++ b/lib/installers/ripgrep.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# ripgrep installer functions +# +# rg: searches a directory tree for a pattern, much faster than grep -r, and +# skips files listed in .gitignore. Every supported distro packages it (RHEL +# clones through EPEL). + +# --- ripgrep --- + +check_ripgrep() { _check_standard rg ripgrep ""; } + +install_ripgrep() { + info "Installing ripgrep..." + [[ "$DISTRO_FAMILY" == "rhel" ]] && { pkg_install epel-release 2>/dev/null || true; } + pkg_install ripgrep || return 1 + info "ripgrep installed." +} + +uninstall_ripgrep() { + info "Uninstalling ripgrep..." + pkg_remove ripgrep +} + +update_ripgrep() { + info "Updating ripgrep..." + pkg_upgrade ripgrep +} + +get_version_ripgrep() { + _ver_from_cmd rg || echo "" +} diff --git a/lib/installers/steam.sh b/lib/installers/steam.sh index 54af54f..f7df540 100644 --- a/lib/installers/steam.sh +++ b/lib/installers/steam.sh @@ -231,16 +231,8 @@ install_steam() { fi ;; fedora) - if ! rpm -q rpmfusion-nonfree-release &>/dev/null; then - echo "Enabling RPM Fusion repositories (required for Steam)..." - if ! sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" \ - "https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"; then - echo "Error: Failed to enable RPM Fusion repositories." - return 1 - fi - sudo "$PKG_MGR" makecache - fi + # Steam is in RPM Fusion nonfree + ensure_rpmfusion nonfree || return 1 echo "Installing Steam from RPM Fusion..." if ! pkg_install steam; then echo "Error: Failed to install Steam." diff --git a/lib/installers/vlc.sh b/lib/installers/vlc.sh index 8bd54a0..8605c43 100644 --- a/lib/installers/vlc.sh +++ b/lib/installers/vlc.sh @@ -14,18 +14,13 @@ install_vlc() { ;; fedora) # VLC requires RPM Fusion Free - if ! rpm -q rpmfusion-free-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm" - fi + ensure_rpmfusion free || return 1 pkg_install vlc ;; rhel) pkg_install epel-release 2>/dev/null || true - if ! rpm -q rpmfusion-free-release &>/dev/null; then - sudo "$PKG_MGR" install -y \ - "https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm" 2>/dev/null || true - fi + # Not fatal: without RPM Fusion VLC falls back to Flatpak below + ensure_rpmfusion free || true pkg_install vlc 2>/dev/null || { warn "VLC not found in repos. Falling back to Flatpak..." if has_flatpak; then diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index 13fe074..bd939b8 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -4914,6 +4914,132 @@ test_gputaskman_version_taken_from_redirect_url test_gputaskman_glibc_minimum test_gputaskman_version_from_install_stamp +# ---------------------------------------------------------------------------- +echo "" +echo "=== RPM Fusion helper, Multimedia Codecs, bat, ripgrep ===" + +# Runs ensure_rpmfusion with rpm and the package manager stubbed. $1 family, +# $2 section asked for, $3 release packages already installed (space list), +# $4 epel-release installed (y/n). Prints each command that would change the +# system, one per line. +_rpmfusion_run() { + ( + source "${SCRIPT_DIR}/lib/installers/_shared.sh" + DISTRO_FAMILY="$1"; DISTRO_NAME="Test"; PKG_MGR=dnf + _have=" $3 "; [[ "$4" == y ]] && _have+="epel-release " + rpm() { + case "$1" in + -E) [[ "$2" == "%fedora" ]] && echo 45 || echo 9 ;; + -q) [[ "$_have" == *" $2 "* ]] ;; + esac + } + # Logged to a file: ensure_rpmfusion silences run_as_root's output. + _log=$(mktemp) + pkg_install() { echo "install $*" >> "$_log"; } + run_as_root() { [[ "$2" == "makecache" ]] || echo "root $*" >> "$_log"; return 0; } + info() { :; }; error() { echo "error" >> "$_log"; } + ensure_rpmfusion "$2" && echo "rc=0" >> "$_log" || echo "rc=1" >> "$_log" + cat "$_log"; rm -f "$_log" + ) +} + +test_ensure_rpmfusion_fedora_installs_missing_sections() { + assert_eq $'install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-45.noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-45.noarch.rpm\nrc=0' \ + "$(_rpmfusion_run fedora nonfree "" n)" \ + "ensure_rpmfusion nonfree on Fedora installs free and nonfree for the release from rpm -E" + assert_eq $'install https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-45.noarch.rpm\nrc=0' \ + "$(_rpmfusion_run fedora nonfree "rpmfusion-free-release" n)" \ + "ensure_rpmfusion nonfree with free already on installs only nonfree" + assert_eq "rc=0" "$(_rpmfusion_run fedora free "rpmfusion-free-release" n)" \ + "ensure_rpmfusion does nothing when RPM Fusion is already enabled" +} + +# #86: on Rocky 9.8 the release package is -9, never the os-release 9.8, and +# EPEL and CRB come first. +test_ensure_rpmfusion_rhel_uses_major_version_and_epel() { + assert_eq $'install epel-release\nroot crb enable\ninstall https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-9.noarch.rpm\nrc=0' \ + "$(DISTRO_VERSION_ID=9.8 _rpmfusion_run rhel nonfree "" n)" \ + "ensure_rpmfusion on a RHEL clone enables EPEL and CRB, then RPM Fusion for EL by major version" + assert_eq $'error\nrc=1' "$(_rpmfusion_run suse free "" n)" \ + "ensure_rpmfusion refuses distros without RPM Fusion" +} + +# One implementation: no installer builds an RPM Fusion release URL itself. +test_rpmfusion_url_only_in_shared_helper() { + local hits + hits=$(grep -l 'rpmfusion-[a-z${}]*-release-' "${SCRIPT_DIR}"/lib/installers/*.sh | grep -v '/_shared.sh$' | xargs -r -n1 basename | tr '\n' ' ') + assert_eq "" "$hits" "RPM Fusion is enabled only through ensure_rpmfusion (no copies in installers)" +} + +test_new_utilities_registered() { + local name slug cat fn gaps=0 + for entry in "Multimedia Codecs|multimedia_codecs|Productivity" "bat|bat|System Tools" "ripgrep|ripgrep|System Tools"; do + IFS='|' read -r name slug cat <<<"$entry" + grep -qE "^register_utility \"${name}\"[[:space:]]+install_${slug} " "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing register: $name"; } + grep -q "^UTILITY_CATEGORY\[\"${name}\"\]=\"${cat}\"" "${SCRIPT_DIR}/lib/installers.sh" || { gaps=1; echo " missing category: $name"; } + grep -q "^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" || { gaps=1; echo " missing ${fn}_${slug}"; } + done + grep -qx " '${name}'" "${SCRIPT_DIR}/completions/_linux_util" || { gaps=1; echo " missing zsh completion: $name"; } + grep -qx "${name}" "${SCRIPT_DIR}/completions/linux_util.bash" || { gaps=1; echo " missing bash completion: $name"; } + done + assert_eq "0" "$gaps" "Multimedia Codecs, bat and ripgrep are registered with category, description, completions and all five functions" +} + +test_codecs_ffmpeg_version_parse() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/multimedia_codecs.sh" + for l in "ffmpeg version 9.0.2 Copyright (c) 2000-2026 the FFmpeg developers" \ + "ffmpeg version 7.1.5-0+deb13u1 Copyright (c) 2000-2026" \ + "ffmpeg version n7.1 Copyright" \ + "ffmpeg version N-12345-gabcdef" ""; do + printf '[%s]' "$(printf '%s\nsecond line 1.2.3\n' "$l" | _codecs_version_from_output)" + done + ) + assert_eq "[9.0.2][7.1.5][7.1][][]" "$out" "Multimedia Codecs reports the FFmpeg version from ffmpeg -version, empty for git builds and no output" +} + +# EL 8 names the GStreamer libav plugin gstreamer1-libav, EL 9+ gstreamer1-plugin-libav. +test_codecs_rhel_libav_name() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/multimedia_codecs.sh" + for v in 8.10 9.8 10.1; do DISTRO_VERSION_ID=$v; printf '%s ' "$(_codecs_rhel_libav)"; done + ) + assert_eq "gstreamer1-libav gstreamer1-plugin-libav gstreamer1-plugin-libav " "$out" "Multimedia Codecs picks the GStreamer libav package name by EL release" +} + +# Debian/Ubuntu: a bat link to batcat is made only when nothing is called bat +# yet, and uninstall removes only that link. +test_bat_batcat_link() { + local out + out=$( + source "${SCRIPT_DIR}/lib/installers/bat.sh" + d=$(mktemp -d); info() { :; }; pkg_remove() { :; } + DISTRO_FAMILY=debian + _BAT_BATCAT="$d/batcat"; printf '#!/bin/sh\n' > "$_BAT_BATCAT"; chmod +x "$_BAT_BATCAT" + _BAT_LINK="$d/home/bin/bat" + _bat_link_batcat; printf '%s ' "$( [[ "$(readlink "$_BAT_LINK")" == "$_BAT_BATCAT" ]] && echo linked || echo none)" + uninstall_bat; printf '%s ' "$( [[ -e "$_BAT_LINK" || -L "$_BAT_LINK" ]] && echo kept || echo removed)" + printf 'mine\n' > "$_BAT_LINK" + _bat_link_batcat; uninstall_bat; printf '%s ' "$(cat "$_BAT_LINK")" + rm -f "$_BAT_LINK"; DISTRO_FAMILY=fedora + _bat_link_batcat; printf '%s' "$( [[ -e "$_BAT_LINK" ]] && echo linked || echo none)" + rm -rf "$d" + ) + assert_eq "linked removed mine none" "$out" "bat links batcat on Debian only when bat is free, and uninstall removes only its own link" +} + +test_ensure_rpmfusion_fedora_installs_missing_sections +test_ensure_rpmfusion_rhel_uses_major_version_and_epel +test_rpmfusion_url_only_in_shared_helper +test_new_utilities_registered +test_codecs_ffmpeg_version_parse +test_codecs_rhel_libav_name +test_bat_batcat_link + # ---------------------------------------------------------------------------- echo "" echo "=== ArtCraft / Craft apps ===" From 0c318451dd9f48b5b7beea2fe349824c432f6ffc Mon Sep 17 00:00:00 2001 From: acebmxer Date: Wed, 11 Nov 2026 14:57:06 -0500 Subject: [PATCH 6/7] test: use a shell script instead of copied sleep in xrdp session test Multi-call coreutils (uutils, Ubuntu 26.04) refuse to run under a name they don't know, so the renamed copy of sleep failed. Use a small shell script named xrdp-chansrv so only the /proc//comm name is faked. Refs #87 --- tests/test_linux_util.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_linux_util.sh b/tests/test_linux_util.sh index bd939b8..fd71a43 100755 --- a/tests/test_linux_util.sh +++ b/tests/test_linux_util.sh @@ -2625,12 +2625,15 @@ test_xrdp_kde_x11_fails_when_session_still_missing() { } # A process named like a session's channel server makes the check true; it is -# a copy of sleep, so the name in /proc//comm is the only thing faked. +# a shell script named xrdp-chansrv, so the name in /proc//comm is the +# only thing faked. Not a renamed copy of sleep: multi-call coreutils (uutils, +# Ubuntu 26.04) refuse to run under a name they don't know (#87). test_xrdp_sessions_open_sees_a_session_process() { local _d _pid _d=$(mktemp -d) - cp "$(command -v sleep)" "$_d/xrdp-chansrv" - "$_d/xrdp-chansrv" 30 & + printf '#!/bin/sh\nwhile :; do sleep 0.1; done\n' > "$_d/xrdp-chansrv" + chmod +x "$_d/xrdp-chansrv" + "$_d/xrdp-chansrv" & _pid=$! sleep 0.2 assert_true "_xrdp_sessions_open is true while an xrdp-chansrv process runs" _xrdp_sessions_open From 5bcba5eb1c71309af376acece3516eff1a61242c Mon Sep 17 00:00:00 2001 From: acebmxer Date: Thu, 12 Nov 2026 13:38:52 -0500 Subject: [PATCH 7/7] chore(release): cut v1.12.0 and update cloner badge Add the 1.12.0 release heading to the changelog, dated 2026-11-12, and bump the unique cloners badge in the README from 29 to 30. --- CHANGELOG.md | 2 ++ README.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8f7e19..255c4e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ when a release is cut. ## [Unreleased] +## [1.12.0] - 2026-11-12 + ### Added - **Multimedia Codecs** (Productivity), full audio and video playback and diff --git a/README.md b/README.md index f9189f5..43cd3f7 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![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-29-brightgreen)](https://github.com/acebmxer/linux_util/graphs/traffic) +[![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)