File logrotate.spec of Package logrotate.7736

# spec file for package logrotate
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           logrotate
Version:        3.13.0
Release:        0
Summary:        Rotate, compress, remove, and mail system log files
License:        GPL-2.0-or-later
Group:          System/Base
# SUSE specific logrotate configurations
Source1:        logrotate.wtmp
Source2:        logrotate.default
Source100:      %{name}-rpmlintrc
Patch0:         logrotate-3.13.0-systemd_add_home_env.patch
BuildRequires:  acl
BuildRequires:  libacl-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libselinux)
BuildRequires:  pkgconfig(popt)
BuildRequires:  pkgconfig(systemd) >= 197
Requires:       xz

The logrotate utility is designed to simplify the administration of log
files on a system that generates a lot of log files. Logrotate allows
the automatic rotation, compression, removal, and mailing 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.

%setup -q
%patch0 -p1

%configure \
    --disable-silent-rules \
    --with-state-file-path=%{_localstatedir}/lib/misc/logrotate.status \
make %{?_smp_mflags}

make %{?_smp_mflags} check

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}

#only the timer can be enabled/disabled/masked !
%service_add_pre %{name}.service %{name}.timer

%{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 ||:

%service_add_post %{name}.service %{name}.timer

%service_del_preun %{name}.service %{name}.timer

%service_del_postun %{name}.service %{name}.timer

%license COPYING
%config %{_sysconfdir}/logrotate.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/wtmp

openSUSE Build Service is sponsored by