refactor: packaging RPM uniquement avec builder Rocky Linux 9
Some checks failed
Build RPM Package / Build RPM Packages (CentOS 7, Rocky 8/9/10) (push) Has been cancelled

- Suppression complète du support DEB (Debian/Ubuntu)
- Builder Rocky Linux 9 pour compatibilité binaire maximale
- Compilation dynamique avec libpcap comme dépendance runtime
- Activation du dépôt CRB pour libpcap-devel
- RPM générés pour el7, el8, el9, el10
- Mise à jour documentation et workflows GitHub Actions

Fix: erreur 'libpcap.so.0.8: cannot open shared object file' sur Rocky Linux 9

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Jacquin Antoine
2026-02-28 18:15:46 +01:00
parent 86649b1630
commit 0be3ea9220
14 changed files with 119 additions and 485 deletions

View File

@ -1,66 +0,0 @@
#!/bin/bash
set -e
# postinst script for ja4sentinel .deb package
case "$1" in
configure)
# Create ja4sentinel user and group if they don't exist
if ! getent group ja4sentinel > /dev/null 2>&1; then
groupadd --system ja4sentinel
fi
if ! getent passwd ja4sentinel > /dev/null 2>&1; then
useradd --system \
--gid ja4sentinel \
--home-dir /var/lib/ja4sentinel \
--no-create-home \
--shell /usr/sbin/nologin \
ja4sentinel
fi
# Create necessary directories
mkdir -p /var/lib/ja4sentinel
mkdir -p /var/run/ja4sentinel
mkdir -p /var/log/ja4sentinel
mkdir -p /etc/ja4sentinel
# Set proper ownership
chown -R ja4sentinel:ja4sentinel /var/lib/ja4sentinel
chown -R ja4sentinel:ja4sentinel /var/run/ja4sentinel
chown -R ja4sentinel:ja4sentinel /var/log/ja4sentinel
chown -R ja4sentinel:ja4sentinel /etc/ja4sentinel
# Set proper permissions
chmod 750 /var/lib/ja4sentinel
chmod 750 /var/log/ja4sentinel
chmod 750 /etc/ja4sentinel
# Install default config if it doesn't exist
if [ ! -f /etc/ja4sentinel/config.yml ]; then
cp /usr/share/ja4sentinel/config.yml /etc/ja4sentinel/config.yml
chown ja4sentinel:ja4sentinel /etc/ja4sentinel/config.yml
chmod 640 /etc/ja4sentinel/config.yml
fi
# Enable and start the service (if running in a real system, not container)
if [ -x /bin/systemctl ] && [ -d /run/systemd/system ]; then
systemctl daemon-reload
systemctl enable ja4sentinel.service
if ! systemctl is-active --quiet ja4sentinel.service; then
systemctl start ja4sentinel.service
fi
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
# On abort, do nothing special
;;
*)
echo "postinst called with unknown argument '$1'" >&2
exit 1
;;
esac
exit 0

View File

@ -1,52 +0,0 @@
#!/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

View File

@ -1,29 +0,0 @@
#!/bin/bash
set -e
# prerm script for ja4sentinel .deb package
case "$1" in
remove|deconfigure)
# Stop and disable the service
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
;;
upgrade)
# On upgrade, just stop the service (will be restarted by postinst)
if [ -x /bin/systemctl ] && [ -d /run/systemd/system ]; then
systemctl stop ja4sentinel.service 2>/dev/null || true
fi
;;
*)
echo "prerm called with unknown argument '$1'" >&2
exit 1
;;
esac
exit 0

View File

@ -9,9 +9,8 @@ BuildArch: x86_64
# Distribution-agnostic dependencies
# systemd is available on all target distros (CentOS 7, Rocky 8/9/10)
Requires: systemd
# libpcap version varies by distro:
# - CentOS 7: 1.4.0
# - Rocky 8/9/10: 1.9.0+
# libpcap is required for packet capture (dynamically linked)
# Version varies by distro: CentOS 7 (1.4.0), Rocky 8/9/10 (1.9.0+)
Requires: libpcap >= 1.4.0
%description

View File

@ -1,34 +0,0 @@
#!/bin/bash
# Test DEB package installation in Debian/Ubuntu container
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
BUILD_DIR="${PROJECT_ROOT}/build/deb"
echo "=========================================="
echo " Testing DEB Package Installation"
echo "=========================================="
# Find the DEB package
DEB_PACKAGE=$(ls -1 "${BUILD_DIR}"/*.deb 2>/dev/null | head -1)
if [ -z "$DEB_PACKAGE" ]; then
echo "Error: No .deb package found in ${BUILD_DIR}"
echo "Run 'make package-deb' first"
exit 1
fi
echo "Found package: ${DEB_PACKAGE}"
# Test installation directly in Debian container
echo ""
echo "Running installation tests in Debian container..."
docker run --rm \
-v "${BUILD_DIR}:/packages:ro" \
debian:latest \
sh -c "apt-get update && apt-get install -y /packages/*.deb && echo 'DEB installation successful'"
echo ""
echo "=========================================="
echo " DEB Package Test Complete"
echo "=========================================="

View File

@ -33,11 +33,12 @@ test_rpm_install() {
fi
# Determine package manager and install command
# CentOS 7 is EOL, need to configure vault.centos.org
# Note: libpcap is required at runtime (dynamically linked)
local setup_cmd=""
local install_cmd=""
case "$image" in
centos:7)
# CentOS 7 is EOL, need to configure vault.centos.org
setup_cmd="sed -i 's/mirror.centos.org/vault.centos.org/g' /etc/yum.repos.d/*.repo && sed -i 's/^#.*baseurl=http/baseurl=http/g' /etc/yum.repos.d/*.repo && sed -i 's/^mirrorlist=http/#mirrorlist=http/g' /etc/yum.repos.d/*.repo"
install_cmd="${setup_cmd} && yum install -y libpcap && yum install -y /packages/*.rpm"
;;