Files
ArchiveBox/pkg/debian/scripts/preremove.sh
Claude fbde2dee03 Fix remaining PR review comments across packaging files
- preremove.sh: Stop the systemd service during upgrades (not just
  remove/purge) so the running process doesn't use stale venv binaries
  while postinstall replaces them. Only disable + remove venv on full
  removal.

- debian.yml: Fail loudly when release lookup fails during a release
  event (exit 1), but still skip gracefully for workflow_dispatch
  manual testing (exit 0). Prevents silently broken .deb publication.

- archivebox.rb + build_brew.sh + homebrew.yml: Add post_install that
  initializes ArchiveBox in var/archivebox with DATA_DIR set, using
  correct Homebrew system() syntax (no env hash as first arg).

https://claude.ai/code/session_01Vx1EsNrNySgsc8Y67dGzCn
2026-03-15 04:42:01 +00:00

28 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# preremove script for archivebox .deb package
set -e
# dpkg passes "$1" as "remove", "purge", or "upgrade".
# Always stop the service before removing or upgrading, because postinstall
# replaces the venv in-place — the running process would use stale binaries.
if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
systemctl stop archivebox 2>/dev/null || true
fi
# Only disable + clean up on full removal, not during upgrade.
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
systemctl disable archivebox 2>/dev/null || true
fi
echo "[+] Removing ArchiveBox virtualenv..."
rm -rf /opt/archivebox/venv
echo "[i] Your ArchiveBox data in /var/lib/archivebox has NOT been removed."
echo " The 'archivebox' system user has NOT been removed."
echo " Remove them manually if you no longer need them:"
echo " sudo rm -rf /var/lib/archivebox"
echo " sudo userdel archivebox"
fi