File syslogd.spec of Package syslogd

#
# spec file for package syslogd
#
# Copyright (c) 2014 SUSE LINUX Products 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 http://bugs.opensuse.org/
#


Name:           syslogd
%define omc_prefix /usr/share/omc
%define omc_svcdir %{omc_prefix}/svcinfo.d
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}
%define sysdsysunitdir %{_unitdir}
Requires(post):   %fillup_prereq
Requires(post):   permissions
Requires(pre):    coreutils
Requires(pre):    klogd
Requires(pre):    sed
# Note: this package is for >= 12.3 only
# and does not provide LSB init scripts!
Requires(pre):  syslog-service >= 2.0
Provides:       sysklogd
Provides:       syslog
Provides:       sysvinit(syslog)
Conflicts:      otherproviders(syslog)
Version:        1.4.1
Release:        0
Summary:        The Syslog daemon
License:        GPL-2.0+
Group:          System/Daemons
Source:         sysklogd-1.4.1.tar.bz2
Source1:        logrotate.syslog
Source2:        sysconfig.syslogd
Source3:        sysconfig.klogd
Source4:        syslog.xml
Source5:        syslog.8
Source6:        klog.service
Source7:        klogd.service
Source8:        syslogd.service
Source9:        syslogd-service-prepare
Source10:       rc.syslog
Source11:       syslogd-rpmlintrc
Patch0:         sysklogd-1.4.1.dif
Patch1:         sysklogd-1.4.1-dgram.patch
Patch2:         sysklogd-1.4.1-sparc.patch
Patch3:         sysklogd-1.4.1-forw.patch
Patch4:         sysklogd-1.4.1-fileleak.patch
Patch5:         sysklogd-ipv6.diff
Patch6:         sysklogd-1.4.1-klogd24.dif
Patch7:         sysklogd-1.4.1-large.patch
Patch8:         sysklogd-1.4.1-dns.patch
Patch9:         sysklogd-1.4.1-reopen.patch
Patch10:        sysklogd-1.4.1-no_SO_BSDCOMPAT.diff
Patch11:        sysklogd-1.4.1-owl-crunch_list.diff
Patch12:        sysklogd-1.4.1-ksyslogsize.diff
Patch13:        sysklogd-1.4.1-unix_sockets.patch
Patch14:        sysklogd-1.4.1-showpri.patch
Patch15:        sysklogd-1.4.1-preserve_percents.patch
Patch16:        sysklogd-1.4.1-utf8.patch
Patch17:        sysklogd-1.4.1-ksym.patch
Patch18:        sysklogd-1.4.1-dontsleep.patch
Patch19:        sysklogd-1.4.1-signal.dif
Patch20:        sysklogd-1.4.1-clearing.patch
Patch21:        sysklogd-1.4.1-nofortify.patch
Patch22:        sysklogd-1.4.1-sysmap-prior-to-2.5.patch
Patch23:        sysklogd-1.4.1-reload.dif
Patch24:        sysklogd-1.4.1-systemd.dif
Patch25:        sysklogd-1.4.1-systemd-multi.dif
Patch26:        sysklogd-1.4.1-systemd-sock-name.patch
# PATCH-FIX-SUSE Newer glibc versions do not set nor use _BSD_SOURCE anymore
Patch27:        sysklogd-1.4.1-glibc.patch
# PATCH-FIX-SUSE bsc#897262, CVE-2014-3634 rsyslog/syslogd: remote syslog PRI vulnerability
Patch28:        sysklogd-1.4.1-CVE-2014-3634.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The syslogd daemon is the general system logging daemon, which is
responsible for handling requests for syslog services.

This version of syslogd is similar to the standard Berkeley product,
but with a number of compatible extensions.



Authors:
--------
    Dr. Greg Wettstein <greg@wind.rmcc.com>
    Stephen Tweedie <sct@dcs.ed.ac.uk>
    Juha Virtanen <jiivee@hut.fi>
    Shane Alderton <shane@scs.apana.org.au>

%package -n klogd
Provides:       klogd:/sbin/klogd
Requires(post): %fillup_prereq
Summary:        The kernel log daemon
Group:          System/Daemons

%description -n klogd
The klogd daemon 'listens' to kernel log messages, prioritizes them,
and routes them to either output files or to syslog daemon.

This version of klogd will optionally translate kernel addresses to
their symbolic equivalents if provided with a system map.



Authors:
--------
    Dr. Greg Wettstein <greg@wind.rmcc.com>
    Stephen Tweedie <sct@dcs.ed.ac.uk>
    Juha Virtanen <jiivee@hut.fi>
    Shane Alderton <shane@scs.apana.org.au>

%package -n syslog-service
Requires(post): %fillup_prereq
Requires:       logrotate
Requires:       syslog
Requires:       sysvinit(network)
Summary:        Syslog service files & scripts
Group:          System/Daemons
BuildArch:      noarch
Version:        2.0
Release:        0

%description -n syslog-service
The package syslog-service provides the service boot
scripts for SysV and the service unit files for systemd.


Authors:
--------
    Marius Tomaschewski
    Werner Fink

%prep
%setup -n sysklogd-1.4.1
%patch1  -p0 -b .dgram
%patch2  -p0 -b .sparc
%patch3  -p0 -b .forw
%patch4  -p0 -b .fileleak
%patch5  -p0 -b .ipv6
%patch6  -p0 -b .klogd24
%patch7  -p0 -b .large
%patch8  -p0 -b .dns
%patch9  -p0 -b .reopen
%patch10 -p0 -b .sobsd
%patch11 -p0 -b .owlcr
%patch12 -p0 -b .klsize
%patch13 -p0 -b .usock
%patch14 -p0 -b .shprio
%patch15 -p0 -b .presperc
%patch16 -p0 -b .utf8
%patch17 -p0 -b .ksym
%patch18 -p0 -b .sleep
%patch19 -p0 -b .signal
%patch20 -p0 -b .clear
%patch21 -p0 -b .nofortify
%patch22 -p0 -b .sysmap
%patch23 -p0 -b .reload
%patch24 -p0 -b .sd
%patch25 -p0 -b .sd2
%patch26 -p0 -b .sd3
%patch27 -p0 -b .glibc
%patch28 -p0 -b .cve20143634
%patch0  -p0

%build
%ifarch s390 s390x
mv sample-s390.conf sample.conf
%endif
    # honor the increased LOG_BUF_LEN in kernel/printk.c
    make %{?_smp_mflags} BINDIR=%{_sbindir} LOG_BUFFER_SIZE=-DLOG_BUFFER_SIZE=131072

%install
    mkdir -p $RPM_BUILD_ROOT/etc
    mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
    mkdir -p $RPM_BUILD_ROOT/sbin
    mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
    mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man{5,8}
    mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
    mkdir -p $RPM_BUILD_ROOT%{sysdsysunitdir}
    mkdir -p -m 0755 $RPM_BUILD_ROOT/%{_rundir}/syslogd
    make install MANDIR=%{_mandir} BINDIR=%{_sbindir} DESTDIR=$RPM_BUILD_ROOT
    install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/syslog
    install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates
    install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/var/adm/fillup-templates
    install -d $RPM_BUILD_ROOT/%{omc_svcdir}/
    install -m 600 %{SOURCE4} $RPM_BUILD_ROOT/%{omc_svcdir}/
    install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/%{_mandir}/man8/syslog.8
    install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{sysdsysunitdir}/
    install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{sysdsysunitdir}/
    install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{sysdsysunitdir}/
    install -m 755 %{SOURCE9} $RPM_BUILD_ROOT/%{_sbindir}/
    install -m 755 %{SOURCE10} $RPM_BUILD_ROOT/sbin/rcsyslog
    for sbin in klogd syslogd ; do
	ln -sf %{_sbindir}/${sbin} $RPM_BUILD_ROOT/sbin/${sbin}
    done
%ifarch s390 s390x
    sed -i 's/^KERNEL_LOGLEVEL=1/KERNEL_LOGLEVEL=7/' \
	$RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.klogd
%endif

%if %{defined verify_permissions}
%verifyscript
%verify_permissions -e /etc/syslog.conf
%endif

%pre
%service_add_pre syslogd.service

%post
%set_permissions /etc/syslog.conf
# 
# add syslog variables provided by syslogd if needed
#
%{remove_and_set -n syslog SYSLOG_DAEMON}
%{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK}
%{fillup_only -ns syslog syslogd}
#
# create dirs, touch log default files
#
mkdir -p var/log
touch var/log/messages;  chmod 640 var/log/messages
touch var/log/mail;      chmod 640 var/log/mail
touch var/log/mail.info; chmod 640 var/log/mail.info
touch var/log/mail.warn; chmod 640 var/log/mail.warn
touch var/log/mail.err;  chmod 640 var/log/mail.err
test -f var/log/news && mv var/log/news var/log/news.bak
mkdir -p -m 0750 var/log/news
chown news:news  var/log/news
touch var/log/news/news.crit;   chmod 640 var/log/news/news.crit
chown news:news var/log/news/news.crit
touch var/log/news/news.err;    chmod 640 var/log/news/news.err
chown news:news var/log/news/news.err
touch var/log/news/news.notice; chmod 640 var/log/news/news.notice
chown news:news var/log/news/news.notice
#
# Enable the syslogd as service
#
# This macro enables based on a systemctl preset config file only
%service_add_post syslogd.service
# But we want to enable a syslog-daemon regardless of the preset;
# force the creation of a syslog.service alias link (bnc#790805).
# We do not check the obsolete SYSLOG_DAEMON variable as we want
# to switch when installing it and there is a provider conflict.
/usr/bin/systemctl -f enable syslogd.service >/dev/null 2>&1 || :

%preun
%service_del_preun syslog.socket
%service_del_preun syslogd.service

%postun
%service_del_postun syslogd.service

%post -n syslog-service
%{remove_and_set -n syslog SYSLOG_DAEMON}
%{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK}
# when exists, remove the broken link pointing to the
# common syslog.service file, we've provided before...
rm -f /etc/systemd/system/multi-user.target.wants/syslog.service

%pre -n klogd
%service_add_pre klogd.service

%post -n klogd
# 
# add syslog variables provided by klogd if needed
#
%{remove_and_set -n syslog SYSLOG_DAEMON}
%{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK}
%{fillup_only -ns syslog klogd}
#
# Enable the syslogd as service
#
%service_add_post klogd.service

%preun -n klogd
%service_del_preun klogd.service

%postun -n klogd
%service_del_postun klogd.service

%files
%defattr(-,root,root)
/var/adm/fillup-templates/sysconfig.syslogd
%config %verify(not mode) /etc/syslog.conf
%doc %{_mandir}/man5/syslog.conf.5.gz
%doc %{_mandir}/man8/syslogd.8.gz
%doc %{_mandir}/man8/sysklogd.8.gz
%config %{sysdsysunitdir}/syslogd.service
%{_sbindir}/syslogd-service-prepare
%attr(0755,root,root) %dir %ghost %{_rundir}/syslogd
/usr/sbin/syslogd
/sbin/syslogd

%files -n klogd
%defattr(-,root,root)
/var/adm/fillup-templates/sysconfig.klogd
%config %{sysdsysunitdir}/klogd.service
%doc %{_mandir}/man8/klogd.8.gz
/usr/sbin/klogd
/sbin/klogd

%files -n syslog-service
%defattr(-,root,root)
%config(noreplace) /etc/logrotate.d/syslog
%config %{sysdsysunitdir}/klog.service
%doc %{_mandir}/man8/syslog.8.gz
%{omc_svcdir}/syslog.xml
/sbin/rcsyslog

%changelog
openSUSE Build Service is sponsored by