]> git.puffer.fish Git - matthieu/frr.git/commitdiff
packaging: Reuse frr.logrotate for Debian and Redhat builds
authorDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 20 Apr 2022 06:48:28 +0000 (09:48 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 8 Nov 2022 09:17:56 +0000 (11:17 +0200)
It will be easier to maintain a single file instead of two separate.

Also, fixes the issue when the file (/var/log/frr/frr.log) is not created
after logrotate.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Makefile.am
debian/frr.install
debian/frr.logrotate [deleted file]
redhat/frr.spec.in
tools/etc/logrotate.d/frr [new file with mode: 0644]

index 8c7bde9d4ce74cc2f9a285e7a1a9a353585a0e8d..44d2ab8e72b80d5533430df61f62ebb726519528 100644 (file)
@@ -231,7 +231,7 @@ EXTRA_DIST += \
        \
        python/xrefstructs.json \
        \
-       redhat/frr.logrotate \
+       tools/etc/logrotate.d/frr \
        redhat/frr.pam \
        redhat/frr.spec \
        \
index 48263222f82b958e19f1d7a6e181edca45fbfafb..044b48498458079cb46b7422844f7ea4229b30e6 100644 (file)
@@ -1,6 +1,7 @@
 debian/frr.conf usr/lib/tmpfiles.d
 etc/
 tools/etc/frr/frr.conf etc/frr/
+tools/etc/logrotate.d/frr etc/logrotate.d/
 tools/frr-reload usr/lib/frr/
 usr/bin/mtracebis
 usr/bin/vtysh
diff --git a/debian/frr.logrotate b/debian/frr.logrotate
deleted file mode 100644 (file)
index 735af65..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/var/log/frr/*.log {
-        size 500k
-        sharedscripts
-        missingok
-        compress
-        rotate 14
-        create 0640 frr frr
-
-        postrotate
-            pid=$(lsof -t -a -c /syslog/ /var/log/frr/* 2>/dev/null)
-            if [ -n "$pid" ]
-            then # using syslog
-                 kill -HUP $pid
-            fi
-            # in case using file logging; if switching back and forth
-            # between file and syslog, rsyslogd might still have file
-            # open, as well as the daemons, so always signal the daemons.
-            # It's safe, a NOP if (only) syslog is being used.
-            for i in babeld bgpd eigrpd isisd ldpd nhrpd ospf6d ospfd sharpd \
-                pimd pim6d ripd ripngd zebra pathd pbrd staticd bfdd fabricd vrrpd; do
-                if [ -e /var/run/frr/$i.pid ] ; then
-                    pids="$pids $(cat /var/run/frr/$i.pid)"
-                fi
-            done
-            [ -n "$pids" ] && kill -USR1 $pids || true
-        endscript
-}
index 8f469d2a07ac3929fa84e5bc8d721036debc22ad..afe75e1f261370bfc511ad5173ff607592ab95a9 100644 (file)
@@ -469,7 +469,7 @@ ln -s %{_sbindir}/frrinit.sh %{buildroot}%{_initddir}/frr
 install %{zeb_src}/tools/etc/frr/daemons %{buildroot}%{_sysconfdir}/frr
 install %{zeb_src}/tools/etc/frr/frr.conf %{buildroot}%{_sysconfdir}/frr/frr.conf.template
 install -m644 %{zeb_rh_src}/frr.pam %{buildroot}%{_sysconfdir}/pam.d/frr
-install -m644 %{zeb_rh_src}/frr.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/frr
+install -m644 %{zeb_src}/tools/etc/logrotate.d/frr %{buildroot}%{_sysconfdir}/logrotate.d/frr
 install -d -m750 %{buildroot}%{rundir}
 
 %if 0%{?rhel} > 7 || 0%{?fedora} > 29
diff --git a/tools/etc/logrotate.d/frr b/tools/etc/logrotate.d/frr
new file mode 100644 (file)
index 0000000..735af65
--- /dev/null
@@ -0,0 +1,27 @@
+/var/log/frr/*.log {
+        size 500k
+        sharedscripts
+        missingok
+        compress
+        rotate 14
+        create 0640 frr frr
+
+        postrotate
+            pid=$(lsof -t -a -c /syslog/ /var/log/frr/* 2>/dev/null)
+            if [ -n "$pid" ]
+            then # using syslog
+                 kill -HUP $pid
+            fi
+            # in case using file logging; if switching back and forth
+            # between file and syslog, rsyslogd might still have file
+            # open, as well as the daemons, so always signal the daemons.
+            # It's safe, a NOP if (only) syslog is being used.
+            for i in babeld bgpd eigrpd isisd ldpd nhrpd ospf6d ospfd sharpd \
+                pimd pim6d ripd ripngd zebra pathd pbrd staticd bfdd fabricd vrrpd; do
+                if [ -e /var/run/frr/$i.pid ] ; then
+                    pids="$pids $(cat /var/run/frr/$i.pid)"
+                fi
+            done
+            [ -n "$pids" ] && kill -USR1 $pids || true
+        endscript
+}