Browse Source

logrotate-3.20.1-2

Tomohiro "Tomo-p" KATO 2 years ago
parent
commit
8e675ad242
1 changed files with 46 additions and 11 deletions
  1. 46 11
      l/logrotate/logrotate-vl.spec

+ 46 - 11
l/logrotate/logrotate-vl.spec

@@ -1,8 +1,10 @@
+%bcond_with systemd
+
 Summary: Rotates, compresses, removes and mails system log files.
 Summary(ja): システムのログファイルを圧縮/削除するプログラム
 Name: logrotate
 Version: 3.20.1
-Release: 1%{?_dist_release}
+Release: 2%{?_dist_release}%{?with_systemd:.systemd}
 Group: system
 Vendor: Project Vine
 Distribution: Vine Linux
@@ -50,10 +52,8 @@ logrotate パッケージをインストールして下さい.
 
 
 %build
-export CFLAGS="$RPM_OPT_FLAGS -DSTATEFILE=\\\"/var/lib/logrotate/logrotate.status\\\""
-
 ./autogen.sh
-%configure
+%configure --with-state-file-path=/var/lib/logrotate/logrotate.status
 make %{?_smp_mflags}
 
 
@@ -65,13 +65,24 @@ make test
 rm -rf $RPM_BUILD_ROOT
 make install DESTDIR=$RPM_BUILD_ROOT
 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d
-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily
 mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/logrotate
 
 install -p -m 644 examples/logrotate.conf $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.conf
-install -p -m 755 examples/logrotate.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily/logrotate
+install -p -m 644 examples/{b,w}tmp $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/
 touch $RPM_BUILD_ROOT/%{_localstatedir}/lib/logrotate/logrotate.status
 
+%if %{with systemd}
+mkdir -p $RPM_BUILD_ROOT/%{_unitdir}
+install -p -m 644 examples/logrotate.{service,timer} $RPM_BUILD_ROOT%{_unitdir}/
+%else
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily
+install -p -m 755 examples/logrotate.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily/logrotate
+%endif
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
 
 %pre
 # If /var/lib/logrotate/logrotate.status does not exist, create it and copy
@@ -83,9 +94,23 @@ if [ ! -d %{_localstatedir}/lib/logrotate/ -a -f %{_localstatedir}/lib/logrotate
   cp -a %{_localstatedir}/lib/logrotate.status %{_localstatedir}/lib/logrotate
 fi
 
-
-%clean
-rm -rf $RPM_BUILD_ROOT
+%post
+chmod 0640 %{_localstatedir}/lib/logrotate/logrotate.status ||:
+%if %{with systemd}
+%systemd_post logrotate.{service,timer}
+%endif
+
+%if %{with systemd}
+%preun
+%systemd_preun logrotate.{service,timer}
+
+%triggerin -- logrotate < %{version}-%{release}
+if [ -e %{_sysconfdir}/crontab -o -e %{_sysconfdir}/anacrontab ]; then
+  if [ -e %{_sysconfdir}/cron.daily/logrotate ]; then
+    /bin/systemctl enable --now logrotate.timer &>/dev/null || :
+  fi
+fi
+%endif
 
 
 %files
@@ -96,12 +121,22 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0755, root, root) %{_sbindir}/logrotate
 %attr(0644, root, root) %{_mandir}/man8/logrotate.8*
 %attr(0644, root, root) %{_mandir}/man5/logrotate.conf.5*
-%attr(0755, root, root) %{_sysconfdir}/cron.daily/logrotate
 %attr(0644, root, root) %config(noreplace) %{_sysconfdir}/logrotate.conf
 %attr(0755, root, root) %dir %{_sysconfdir}/logrotate.d
-%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate/logrotate.status
+%attr(0644, root, root) %config(noreplace) %{_sysconfdir}/logrotate.d/{b,w}tmp
+%attr(0640, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate/logrotate.status
+%if %{with systemd}
+%{_unitdir}/logrotate.*
+%else
+%attr(0755, root, root) %{_sysconfdir}/cron.daily/logrotate
+%endif
+
 
 %changelog
+* Fri May 27 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.20.1-2
+- fixed permission.
+- added systemd support (disabled as default).
+
 * Thu May 26 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.20.1-1
 - new upstream release.