#!/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