Accepting request 228893 from home:elvigia:branches:Base:System

- BuildRequire systemd 197 or later.

- Migrate from cron to systemd timer units, this is overall 
  the most important package to migrate since it is one 
  of the very few base components that hard-require cron.

OBS-URL: https://build.opensuse.org/request/show/228893
OBS-URL: https://build.opensuse.org/package/show/Base:System/logrotate?expand=0&rev=35
This commit is contained in:
Marcus Meissner 2014-04-03 15:12:24 +00:00 committed by Git OBS Bridge
parent b7eabb9739
commit f713634cc4
4 changed files with 53 additions and 3 deletions

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Thu Apr 3 14:10:21 UTC 2014 - crrodriguez@opensuse.org
- BuildRequire systemd 197 or later.
-------------------------------------------------------------------
Wed Apr 2 22:45:56 UTC 2014 - crrodriguez@opensuse.org
- Migrate from cron to systemd timer units, this is overall
the most important package to migrate since it is one
of the very few base components that hard-require cron.
-------------------------------------------------------------------
Tue Apr 1 15:11:22 UTC 2014 - vcizek@suse.com

10
logrotate.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Rotate log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
[Service]
Type=oneshot
ExecStart=/usr/sbin/logrotate /etc/logrotate.conf
Nice=19
IOSchedulingClass=best-effort
IOSchedulingPriority=7

View File

@ -26,6 +26,8 @@ License: GPL-2.0+
Group: System/Base
Source: https://fedorahosted.org/releases/l/o/%{name}/%{name}-%{version}.tar.gz
Source100: %{name}-rpmlintrc
Source101: %{name}.service
Source102: %{name}.timer
Patch0: logrotate-3.7.8-suse.patch
Patch1: logrotate-3.7.8-conf.patch
Patch2: logrotate-3.7.8-autoext.patch
@ -37,12 +39,13 @@ BuildRequires: acl
BuildRequires: libacl-devel
BuildRequires: libselinux-devel
BuildRequires: popt-devel
BuildRequires: pkgconfig(systemd) >= 197
PreReq: %fillup_prereq
PreReq: /bin/mv
PreReq: /bin/rm
Requires: cron
Requires: xz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%description
The logrotate utility is designed to simplify the administration of log
@ -75,8 +78,13 @@ make PREFIX=%{buildroot} install
mkdir -p %{buildroot}%{_sysconfdir}/{logrotate.d,cron.daily}
mkdir -p %{buildroot}%{_prefix}/sbin
install -m 644 examples/logrotate-default %{buildroot}%{_sysconfdir}/logrotate.conf
install -m 755 examples/logrotate.cron %{buildroot}%{_sysconfdir}/cron.daily/logrotate
install -m 644 examples/logrotate.wtmp %{buildroot}%{_sysconfdir}/logrotate.d/wtmp
install -D -m 0644 %{S:101} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 0644 %{S:102} %{buildroot}%{_unitdir}/%{name}.timer
%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}
@ -85,6 +93,14 @@ if [ -f /etc/logrotate.d/aaa_base ] ; then
mv -v /etc/logrotate.d/aaa_base /etc/logrotate.d.aaa_base.save
fi
%service_add_post %{name}.service %{name}.timer
%preun
%service_del_preun %{name}.service %{name}.timer
%postun
%service_del_postun %{name}.service %{name}.timer
%clean
rm -rf %{buildroot}
@ -94,8 +110,9 @@ rm -rf %{buildroot}
%{_sbindir}/logrotate
%{_mandir}/man8/logrotate.8*
%{_mandir}/man5/logrotate.conf.5*
%{_sysconfdir}/cron.daily/logrotate
%config %{_sysconfdir}/logrotate.conf
%config(noreplace)/etc/logrotate.d/wtmp
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}.timer
%changelog

11
logrotate.timer Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=Daily rotation of log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
[Timer]
OnCalendar=daily
AccuracySec=12h
Persistent=true
[Install]
WantedBy=timers.target