Files
HamPack/install.sh
T
David YoungandClaude Opus 5.5 0b471c9771 Harden install, update and uninstall; add shared lib and tests
Updates
- install-compiled.sh never prompts: unknown versions rebuild, a missing
  version= fails
- Detect VARA Terminal by "VARA Terminal.exe" in drive_c/VARA, not by
  the folder VARA HF also uses
- install-windows-apps.sh checks first: nothing is downloaded and
  winetricks doesn't run unless a product is missing, and installers
  only run with a desktop session
- Flatpaks install system-wide from flathub and honor skip-packages
- Rewrite desktop files on every run so icon paths stay right; add the
  missing QtTermTCP desktop file
- Build steps can't read the rest of the conf through stdin

Uninstall
- update.sh records the packages and Flatpaks HamPack itself installed;
  hampackremove removes only those that nothing else needs, and lists
  the rest
- Read package lists from packages.conf instead of copies, remove
  files from install manifests, conf install paths and older builds,
  and revert the Wine Decorated setting

Security
- Replace the NOPASSWD sudoers file with a sudo keepalive, and delete a
  leftover /etc/sudoers.d/hampack
- Verify binaries.conf downloads against sha256=; pin dx.py to a commit
- Graywolf's web UI listens on 127.0.0.1; update.sh manages its unit
- Install direwolf and kiwix through a staging directory with
  install_staged, so nothing in ~/.local ends up owned by root; hand
  back any root-owned files left by older builds
- Use private temp directories instead of fixed /tmp paths

Code quality
- Shared lib.sh: conf parser, variable expansion, version records,
  install tracking, staged installs, sudo keepalive
- bats tests covering first install and update paths, Makefile with
  lint/test/hooks, pre-commit hook
- patch-potacat.sh uses jq; drop stale kiwix version entries

README: fill in what gets installed, uninstall and graywolf notes,
development section, typo and Matrix link fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 09:55:13 -07:00

57 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
#
# Purpose : Install HamPack (run by CoreDesktop's `sibling add`)
# Print the logo
print_logo() {
cat << "EOF"
██╗ ██╗ █████╗ ███╗ ███╗██████╗ █████╗ ██████╗██╗ ██╗
██║ ██║██╔══██╗████╗ ████║██╔══██╗██╔══██╗██╔════╝██║ ██╔╝
███████║███████║██╔████╔██║██████╔╝███████║██║ █████╔╝
██╔══██║██╔══██║██║╚██╔╝██║██╔═══╝ ██╔══██║██║ ██╔═██╗
██║ ██║██║ ██║██║ ╚═╝ ██║██║ ██║ ██║╚██████╗██║ ██╗
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝
EOF
}
# --- Main ---
set -e
SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
COREDESKTOP="$HOME/.local/share/coredesktop"
LEGACY_DIR="$HOME/.local/share/HamPack"
clear || true
print_logo
if [ ! -d "$COREDESKTOP" ]; then
echo "HamPack requires CoreDesktop to be installed first."
echo "Please install CoreDesktop: https://coredesktop.federated.computer"
exit 1
fi
# HamPack used to clone itself to ~/.local/share/HamPack and copy its own hooks
# into CoreDesktop's updates.d. It now lives wherever `sibling` cloned it.
if [ -d "$LEGACY_DIR/.git" ] && [ "$LEGACY_DIR" != "$SELF" ]; then
echo "Removing the old HamPack install at $LEGACY_DIR..."
rm -rf "$LEGACY_DIR"
fi
rm -f "$COREDESKTOP"/updates.d/[0-9][0-9][0-9]-hampack-*
# update.sh asks for the sudo password once and keeps it fresh while it runs
if ! bash "$SELF/update.sh"; then
echo "HamPack is installed, but some parts failed (listed above)."
echo "They'll be tried again on the next update, or run: bash $SELF/update.sh"
exit 1
fi
echo "HamPack is installed. You may want to restart existing applications when convenient."