refactor(packaging): migrate from fpm to rpmbuild for RPM packaging
- Replace fpm with native rpmbuild in Dockerfile.package
- Setup proper rpmbuild directory structure (BUILD, RPMS, SOURCES, SPECS)
- Make spec file version dynamic via %{?build_version} macro
- Improve %post script with better systemd detection and error handling
- RPM now correctly uses VERSION build argument
Builds RPM packages for el8, el9, and el10 distributions.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
Name: ja4sentinel
|
||||
Version: 1.0.2
|
||||
Version: %{?build_version}%{!?build_version:1.0.0}
|
||||
Release: 1%{?dist}
|
||||
Summary: JA4 TLS fingerprinting daemon for network monitoring
|
||||
License: MIT
|
||||
@ -62,25 +62,25 @@ exit 0
|
||||
|
||||
%post
|
||||
# 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
|
||||
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
|
||||
chmod 750 /var/log/ja4sentinel
|
||||
chmod 750 /etc/ja4sentinel
|
||||
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
|
||||
cp /usr/share/ja4sentinel/config.yml /etc/ja4sentinel/config.yml
|
||||
chown ja4sentinel:ja4sentinel /etc/ja4sentinel/config.yml
|
||||
chown ja4sentinel:ja4sentinel /etc/ja4sentinel/config.yml 2>/dev/null || true
|
||||
chmod 640 /etc/ja4sentinel/config.yml
|
||||
fi
|
||||
|
||||
# Enable and start service (systemd macro for compatibility)
|
||||
if [ $1 -eq 1 ] && [ -x /bin/systemctl ]; then
|
||||
# Reload systemd and enable service (only if systemd is running)
|
||||
if [ -x /bin/systemctl ] && [ -d /run/systemd/system ]; then
|
||||
/bin/systemctl daemon-reload
|
||||
/bin/systemctl enable ja4sentinel.service 2>/dev/null || :
|
||||
/bin/systemctl start ja4sentinel.service 2>/dev/null || :
|
||||
|
||||
Reference in New Issue
Block a user