- Update Dockerfile.package to build RPMs for multiple distributions using a unified fpm-based approach - Add RPM maintainer scripts (postinst, prerm, postrm) for proper installation and service management - Update ja4sentinel.spec for CentOS 7+ compatibility - Add packaging/systemd/config.yml as default configuration - Update test-rpm.sh to test installation on all 4 target distributions - Fix CentOS 7 repository configuration (EOL - vault.centos.org) Generated RPMs: - el7: CentOS 7 (libpcap >= 1.4.0) - el8: Rocky Linux 8 (libpcap >= 1.9.0) - el9: Rocky Linux 9 (libpcap >= 1.9.0) - el10: AlmaLinux 10 / Rocky Linux 10 (libpcap >= 1.9.0) Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
46 lines
1.6 KiB
Bash
46 lines
1.6 KiB
Bash
#!/bin/bash
|
|
#
|
|
# postinst - Script d'installation post-RPM pour ja4sentinel
|
|
# Compatible CentOS 7, Rocky Linux 8/9/10
|
|
#
|
|
|
|
set -e
|
|
|
|
echo "==> ja4sentinel: Running post-installation script..."
|
|
|
|
# Set proper ownership
|
|
chown -R ja4sentinel:ja4sentinel /var/lib/ja4sentinel 2>/dev/null || true
|
|
chown -R ja4sentinel:ja4sentinel /var/run/ja4sentinel 2>/dev/null || true
|
|
chown -R ja4sentinel:ja4sentinel /var/log/ja4sentinel 2>/dev/null || true
|
|
chown -R ja4sentinel:ja4sentinel /etc/ja4sentinel 2>/dev/null || true
|
|
|
|
# Set proper permissions
|
|
chmod 750 /var/lib/ja4sentinel 2>/dev/null || true
|
|
chmod 750 /var/log/ja4sentinel 2>/dev/null || true
|
|
chmod 750 /etc/ja4sentinel 2>/dev/null || true
|
|
|
|
# Install config if not exists
|
|
if [ ! -f /etc/ja4sentinel/config.yml ]; then
|
|
echo "==> ja4sentinel: Installing default configuration..."
|
|
cp /usr/share/ja4sentinel/config.yml /etc/ja4sentinel/config.yml
|
|
chown ja4sentinel:ja4sentinel /etc/ja4sentinel/config.yml 2>/dev/null || true
|
|
chmod 640 /etc/ja4sentinel/config.yml
|
|
fi
|
|
|
|
# Reload systemd and enable service (only if systemd is running)
|
|
if [ -x /bin/systemctl ] && [ -d /run/systemd/system ]; then
|
|
echo "==> ja4sentinel: Reloading systemd daemon..."
|
|
/bin/systemctl daemon-reload
|
|
|
|
echo "==> ja4sentinel: Enabling ja4sentinel.service..."
|
|
/bin/systemctl enable ja4sentinel.service 2>/dev/null || :
|
|
|
|
echo "==> ja4sentinel: Starting ja4sentinel.service..."
|
|
/bin/systemctl start ja4sentinel.service 2>/dev/null || :
|
|
else
|
|
echo "==> ja4sentinel: systemd not detected (container environment), skipping service management..."
|
|
fi
|
|
|
|
echo "==> ja4sentinel: Post-installation complete."
|
|
exit 0
|