# # spec file for package logrotate # # Copyright (c) 2022-2023 ZhuningOS # Name: logrotate Version: 3.18.1 Release: 150400.3.7.1 Summary: Cron service for rotating, compressing, mailing and removing system log files License: GPL-2.0-or-later Group: System/Base URL: https://github.com/logrotate/logrotate Source0: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz # SUSE specific logrotate configurations Source1: logrotate.wtmp Source2: logrotate.default Source10: https://github.com/%{name}/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz.asc Source100: %{name}-rpmlintrc Patch0: logrotate-3.13.0-systemd_add_home_env.patch # PATCH FIX (bsc#1199652, CVE-2022-1348) insecure permissions for state file creation Patch1: logrotate-CVE-2022-1348.patch # PATCH FIX UPSTREAM (bsc#1199652, CVE-2022-1348) insecure permissions for state file creation # follow up patch for CVE: https://github.com/logrotate/logrotate/pull/446 Patch2: logrotate-CVE-2022-1348-follow-up.patch # PATCH FIX UPSTREAM (bsc#1192449) Core-dump handing with SUID binaries # - https://github.com/logrotate/logrotate/pull/427 # - https://github.com/logrotate/logrotate/pull/431 Patch3: logrotate-enforce-stricter-parsing.patch Patch4: logrotate-enforce-stricter-parsing-extra-tests.patch Patch5: logrotate-dont_warn_on_size=_syntax.patch.patch BuildRequires: acl BuildRequires: libacl-devel BuildRequires: automake BuildRequires: pkgconfig BuildRequires: pkgconfig(libselinux) BuildRequires: pkgconfig(popt) BuildRequires: pkgconfig(systemd) >= 197 Requires: %{_bindir}/xz %{?systemd_ordering} %description The logrotate utility does automatic rotation, compression, mailing and removal of log files. Logrotate can be set to handle a log file daily, weekly, monthly, or when the log file reaches a certain size. Normally, logrotate runs as a daily cron job. It manages plain files only and is not involved in systemd's journal rotation. %prep %autosetup -p1 %build autoreconf -fi %configure \ --disable-silent-rules \ --with-state-file-path=%{_localstatedir}/lib/misc/logrotate.status \ --disable-werror %make_build %check # Make all test cases executable to avoid them failing (new # tests may be introduced by patches, like CVE-2022-1348) chmod +x test/*.sh %make_build check %install %make_install mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/wtmp install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.conf install -D -m 0644 examples/%{name}.service %{buildroot}%{_unitdir}/%{name}.service install -D -m 0644 examples/%{name}.timer %{buildroot}%{_unitdir}/%{name}.timer ln -s service %{buildroot}%{_sbindir}/rc%{name} %pre #only the timer can be enabled/disabled/masked ! %service_add_pre %{name}.service %{name}.timer %post %{remove_and_set MAX_DAYS_FOR_LOG_FILES} # Move /var/lib/logrotate.status if [ -f %{_localstatedir}/lib/logrotate.status -a ! -f %{_localstatedir}/lib/misc/logrotate.status ]; then mv %{_localstatedir}/lib/logrotate.status %{_localstatedir}/lib/misc/logrotate.status ||: fi %service_add_post %{name}.service %{name}.timer %preun %service_del_preun %{name}.service %{name}.timer %postun %service_del_postun %{name}.service %{name}.timer %files %license COPYING %doc ChangeLog.md README.md %{_sbindir}/logrotate %{_sbindir}/rc%{name} %{_mandir}/man8/logrotate.8%{?ext_man} %{_mandir}/man5/logrotate.conf.5%{?ext_man} %config %{_sysconfdir}/logrotate.conf %config(noreplace) %{_sysconfdir}/logrotate.d/wtmp %{_unitdir}/%{name}.service %{_unitdir}/%{name}.timer %changelog