# Conditional build:
%bcond_without acl # build without ACLs support
%bcond_without selinux # build without SELinux support
-#
+%bcond_without tests # do not perform "make test"
+
Summary: Rotates, compresses, removes and mails system log files
Summary(de.UTF-8): Rotiert, komprimiert und verschickt Systemlogs
Summary(es.UTF-8): Hace el rutado, comprime y envía mail de logs del sistema
Summary(tr.UTF-8): Sistem günlüklerini yönlendirir, sıkıştırır ve mektup olarak yollar
Summary(uk.UTF-8): Ротує, компресує, видаляє та відправляє поштою лог-файли
Name: logrotate
-Version: 3.8.1
-Release: 4
+Version: 3.9.2
+Release: 1
License: GPL v2
Group: Applications/System
-Source0: https://fedorahosted.org/releases/l/o/logrotate/%{name}-%{version}.tar.gz
-# Source0-md5: bd2e20d8dc644291b08f9215397d28a5
+Source0: https://github.com/logrotate/logrotate/archive/%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 584bca013dcceeb23b06b27d6d0342fb
Source1: %{name}.conf
Source2: %{name}.sysconfig
-Patch0: %{name}-cron.patch
+Source3: %{name}.cron
+Source4: %{name}.crontab
Patch1: %{name}-man.patch
Patch2: tabooext.patch
-URL: https://fedorahosted.org/logrotate/
+Patch3: %{name}-largefile.patch
+URL: https://github.com/logrotate/logrotate
%{?with_acl:BuildRequires: acl-devel}
-%{?with_selinux:BuildRequires: libselinux-devel}
+BuildRequires: autoconf >= 2.50
+BuildRequires: automake >= 1:1.13
+%if %{with selinux}
+BuildRequires: libselinux-devel
+%{?with_tests:BuildRequires: libselinux-utils}
+%endif
BuildRequires: popt-devel >= 1.3
+Requires(post): coreutils
Requires: coreutils
Requires: crondaemon
Requires: filesystem >= 4.0-4
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define statdir /var/lib/misc
+%define _libexecdir %{_prefix}/lib
%description
The logrotate utility is designed to simplify the administration of
%prep
%setup -q
-%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
+
+echo '
+#undef STATEFILE
+#define STATEFILE "%{statdir}/logrotate.status"
+' >> config.h
%build
-%{__make} \
- CC="%{__cc}" \
- RPM_OPT_FLAGS="%{rpmcflags}" \
- WITH_ACL=%{?with_acl:yes}%{!?with_acl:no} \
- WITH_SELINUX=%{?with_selinux:yes}%{!?with_selinux:no} \
- STATEFILE="%{statdir}/logrotate.status"
+%{__aclocal}
+%{__autoconf}
+%{__automake}
+
+%configure \
+ --disable-silent-rules \
+ --with%{!?with_acl:out}-acl \
+ --with%{!?with_selinux:out}-selinux \
+
+%{__make}
+
+%if %{with tests}
+%{__make} test
+%endif
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{cron.daily,logrotate.d,sysconfig} \
- $RPM_BUILD_ROOT{%{_mandir},%{statdir}}
+install -d $RPM_BUILD_ROOT/etc/{cron.d,logrotate.d,sysconfig} \
+ $RPM_BUILD_ROOT{%{_libexecdir},%{_mandir},%{statdir}}
%{__make} install \
- BINDIR=$RPM_BUILD_ROOT%{_sbindir} \
- MANDIR=$RPM_BUILD_ROOT%{_mandir}
+ DESTDIR=$RPM_BUILD_ROOT
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.conf
-cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/logrotate
-install -p examples/logrotate.cron $RPM_BUILD_ROOT/etc/cron.daily/logrotate
-> $RPM_BUILD_ROOT%{statdir}/logrotate.status
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+install -p %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/%{name}
+cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/cron.d/%{name}
+> $RPM_BUILD_ROOT%{statdir}/%{name}.status
%clean
rm -rf $RPM_BUILD_ROOT
+%triggerun -- %{name} < 3.8.6-1
+# if previous install had /etc/cron.daily/* files unlink (missingok), disable the cronjob
+if [ ! -e /etc/cron.daily/%{name} ]; then
+ echo DISABLE_LOGROTATE_CRON=yes >> /etc/sysconfig/%{name}
+fi
+
%triggerpostun -- %{name} < 3.7.8-4
-%{__sed} -i -e 's,olddir /var/log/archiv$,olddir /var/log/archive,' %{_sysconfdir}/logrotate.conf %{_sysconfdir}/logrotate.d/* || :
+%{__sed} -i -e 's,olddir /var/log/archiv$,olddir /var/log/archive,' %{_sysconfdir}/%{name}.conf %{_sysconfdir}/logrotate.d/* || :
%post
if [ -f /var/lib/logrotate.status ]; then
%defattr(644,root,root,755)
%doc CHANGES
%attr(755,root,root) %{_sbindir}/logrotate
-%attr(750,root,root) /etc/cron.daily/logrotate
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.conf
+%attr(755,root,root) %{_libexecdir}/logrotate
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/cron.d/%{name}
%attr(640,root,root) %ghost %{statdir}/logrotate.status
%{_mandir}/man5/logrotate.conf.5*
%{_mandir}/man8/logrotate.8*