feat: CI/CD pour packages .deb et .rpm + tests d'installation
Nouveaux workflows GitHub Actions: - .github/workflows/build-deb.yml : Build et release DEB sur Ubuntu - .github/workflows/build-rpm.yml : Build et release RPM sur Fedora - Déclenchement sur tags v*, push main/master, workflow_dispatch - Upload des artifacts et création automatique de release Système de build de packages: - packaging/build-deb.sh : Script de build .deb avec sanitization version - packaging/build-rpm.sh : Script de build .rpm (via Docker) - packaging/Dockerfile.deb : Container Ubuntu 22.04 pour build DEB - packaging/Dockerfile.rpm : Container Go 1.24 + rpm pour build RPM Fichiers de configuration systemd: - packaging/systemd/ja4sentinel.service : Unit avec security hardening * NoNewPrivileges, ProtectSystem, ProtectHome * CAP_NET_RAW, CAP_NET_ADMIN pour packet capture - packaging/systemd/config.yml : Configuration par défaut Scripts mainteneur DEB: - packaging/deb/postinst : Création user/group, dirs, config - packaging/deb/prerm : Stop service avant upgrade/remove - packaging/deb/postrm : Cleanup complet en purge Spec file RPM: - packaging/rpm/ja4sentinel.spec : Spec complet avec dependencies * Requires: systemd, libpcap * %pre/%post/%preun/%postun scripts Tests d'installation dans containers: - packaging/test/test-deb.sh : Build + test Docker Ubuntu - packaging/test/test-rpm.sh : Build + test Docker Fedora - packaging/test/test-install-deb.sh : 11 tests automatisés - packaging/test/test-install-rpm.sh : 11 tests automatisés - Dockerfile.deb/rpm : Containers de test dédiés Makefile: - package-deb : Build .deb - package-rpm : Build .rpm via Docker (no-cache) - package : Build les deux - test-package-deb : Build + test installation DEB - test-package-rpm : Build + test installation RPM - test-package : Test les deux packages Tests: - ✅ DEB: 11/11 tests passés (binaire, config, service, user, dirs) - ✅ RPM: Build réussi (3.3 MB) - Version sanitization pour git tags (ex: efd4481-dirty → 0.0.0+efd4481-dirty) Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
52
packaging/deb/postrm
Normal file
52
packaging/deb/postrm
Normal file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# postrm script for ja4sentinel .deb package
|
||||
|
||||
case "$1" in
|
||||
remove)
|
||||
# On remove, leave config and data files
|
||||
;;
|
||||
|
||||
purge)
|
||||
# On purge, remove everything
|
||||
|
||||
# Stop service if running
|
||||
if [ -x /bin/systemctl ] && [ -d /run/systemd/system ]; then
|
||||
systemctl stop ja4sentinel.service 2>/dev/null || true
|
||||
systemctl disable ja4sentinel.service 2>/dev/null || true
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
|
||||
# Remove configuration
|
||||
rm -rf /etc/ja4sentinel
|
||||
|
||||
# Remove data and logs
|
||||
rm -rf /var/lib/ja4sentinel
|
||||
rm -rf /var/log/ja4sentinel
|
||||
rm -rf /var/run/ja4sentinel
|
||||
|
||||
# Remove user and group
|
||||
if getent passwd ja4sentinel > /dev/null 2>&1; then
|
||||
userdel ja4sentinel 2>/dev/null || true
|
||||
fi
|
||||
|
||||
if getent group ja4sentinel > /dev/null 2>&1; then
|
||||
groupdel ja4sentinel 2>/dev/null || true
|
||||
fi
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
# On abort, restart the service
|
||||
if [ -x /bin/systemctl ] && [ -d /run/systemd/system ]; then
|
||||
systemctl start ja4sentinel.service 2>/dev/null || true
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument '$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user