- debian/control: Package metadata with dependencies - debian/postinst: Service user, dirs, JWT key gen, config, cron setup - debian/prerm: Graceful service stop before upgrade - debian/postrm: Purge cleanup (user, data, config, cron) - debian/changelog: 1.0.0-1 initial release - debian/install: File manifest - scripts/build-package.sh: Full build pipeline (cargo release, frontend, dpkg-deb) - .gitignore: Exclude *.deb and package-build/
37 lines
903 B
Bash
37 lines
903 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
case "$1" in
|
|
purge)
|
|
# Remove service user (only if purge)
|
|
if id patch-manager &>/dev/null; then
|
|
userdel patch-manager 2>/dev/null || true
|
|
fi
|
|
|
|
# Remove runtime data
|
|
rm -rf /var/log/patch-manager
|
|
rm -rf /opt/patch-manager
|
|
rm -rf /var/backups/patch-manager
|
|
|
|
# Remove configuration and keys (purge only)
|
|
rm -rf /etc/patch-manager
|
|
|
|
# Remove backup cron
|
|
crontab -l 2>/dev/null | grep -vF "backup.sh" | crontab - 2>/dev/null || true
|
|
|
|
# Reload systemd
|
|
systemctl daemon-reload
|
|
;;
|
|
|
|
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
|
# On remove (not purge), keep config and keys
|
|
systemctl daemon-reload 2>/dev/null || true
|
|
;;
|
|
|
|
*)
|
|
echo "postrm called with unknown argument \`$1'" >&2
|
|
;;
|
|
esac
|
|
|
|
exit 0
|