Files
ArchiveBox/pkg/debian/scripts/preremove.sh
Claude 68fea71933 Address remaining PR review comments
- Pin cache-apt-pkgs-action to commit SHA for supply-chain safety
- Fix Homebrew post_install to use with_env block instead of env hash
  in system() call (idiomatic Homebrew pattern)
- Add clarifying comments to service file, preremove.sh, and nfpm.yaml
  explaining user/group creation, directory ownership, and upgrade handling

https://claude.ai/code/session_01Vx1EsNrNySgsc8Y67dGzCn
2026-03-15 03:39:33 +00:00

24 lines
939 B
Bash
Executable File

#!/bin/bash
# preremove script for archivebox .deb package
set -e
# Only clean up on full removal, not during upgrade.
# dpkg passes "$1" as "remove", "purge", or "upgrade" — we skip cleanup on
# upgrade so the venv and service persist across package version bumps.
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
# Stop the service if running
if command -v systemctl >/dev/null 2>&1 && [ -d /run/systemd/system ]; then
systemctl stop archivebox 2>/dev/null || true
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