File syslogd.spec of Package syslogd.363

#
# spec file for package syslogd
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           syslogd
%define omc_prefix /usr/share/omc
%define omc_svcdir %{omc_prefix}/svcinfo.d
License:        GPLv2+
Group:          System/Daemons
PreReq:         coreutils %fillup_prereq klogd sed
Provides:       syslog
AutoReqProv:    on
Version:        1.4.1
Release:        727
Summary:        The Syslog daemon
Source:         sysklogd-1.4.1.tar.bz2
Source1:        logrotate.syslog
Source2:        sysconfig.syslog
Source3:        rc.syslog
Source4:        rc.earlysyslog
Source5:        syslog.xml
Source6:        syslog.8
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
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
License:        GPLv2+
PreReq:         %insserv_prereq  %fillup_prereq
Provides:       sysklogd
Provides:       syslogd:/sbin/klogd
Requires:       /etc/init.d/network logrotate
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>

%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
%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} LOG_BUFFER_SIZE=-DLOG_BUFFER_SIZE=131072

%install
    mkdir -p $RPM_BUILD_ROOT/{sbin,etc}
    mkdir -p $RPM_BUILD_ROOT/etc/init.d
    mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
    mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man{5,8}
    mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
    make install MANDIR=%{_mandir} DESTDIR=$RPM_BUILD_ROOT
    ln -sf ../etc/init.d/syslog $RPM_BUILD_ROOT/sbin/rcsyslog
    install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/syslog
    install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/var/adm/fillup-templates
    install -m 754 %{SOURCE3} $RPM_BUILD_ROOT/etc/init.d/syslog
    install -m 754 %{SOURCE4} $RPM_BUILD_ROOT/etc/init.d/earlysyslog
    install -d $RPM_BUILD_ROOT/%{omc_svcdir}/
    install -m 600 %{SOURCE5} $RPM_BUILD_ROOT/%{omc_svcdir}/
    install -m 644 %{SOURCE6} $RPM_BUILD_ROOT/%{_mandir}/man8/syslog.8
%ifarch s390 s390x
    sed 's/^KERNEL_LOGLEVEL=1/KERNEL_LOGLEVEL=7/' %{SOURCE2} \
	> $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.syslog
%endif

%post
# 
# add syslog variables provided by klogd if needed
#
%{fillup_and_insserv -ny syslog syslog}
%{fillup_and_insserv -nY syslog earlysyslog}
#
# check if daemon configured in SYSLOG_DAEMON is
# installed and switch to ourself if it's missed
#
source etc/sysconfig/syslog
replace_syslog=no
if test "$SYSLOG_DAEMON" != "syslogd" ; then
    if test -z "$SYSLOG_DAEMON" || \
       test ! -x sbin/${SYSLOG_DAEMON} ; then
        replace_syslog=yes
    fi
fi
if test "$replace_syslog" == "yes" ; then
    sed -i -e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON="syslogd"/g' \
              etc/sysconfig/syslog
fi
#
# create dirs, touch log default files
#
mkdir -p var/log
touch var/log/messages;  chmod 640 var/log/messages
touch var/log/boot.log;  chmod 640 var/log/boot.log
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
mkdir -p -m 0755 /var/run/rsyslog

%preun
%stop_on_removal syslog

%postun
%restart_on_update syslog
%{insserv_cleanup}
# reset SYSLOG_DAEMON variable
if test -f etc/sysconfig/syslog ; then
  source etc/sysconfig/syslog
  if test "$SYSLOG_DAEMON" == "syslogd" ; then
    sed -i -e 's/^SYSLOG_DAEMON=.*/SYSLOG_DAEMON=""/g' \
              etc/sysconfig/syslog
  fi
fi

%preun -n klogd
%stop_on_removal syslog

%postun -n klogd
%restart_on_update syslog
%{insserv_cleanup}

%files
%defattr(-,root,root)
%config %verify(not mode) /etc/syslog.conf
%doc %{_mandir}/man5/syslog.conf.5.gz
%doc %{_mandir}/man8/syslogd.8.gz
/sbin/syslogd

%files -n klogd
%defattr(-,root,root)
/var/adm/fillup-templates/sysconfig.syslog
%config(noreplace) /etc/logrotate.d/syslog
%config /etc/init.d/syslog
%config /etc/init.d/earlysyslog
%doc %{_mandir}/man8/klogd.8.gz
%doc %{_mandir}/man8/sysklogd.8.gz
%doc %{_mandir}/man8/syslog.8.gz
/sbin/rcsyslog
/sbin/klogd
%attr(0755,root,root) %dir %ghost /var/run/rsyslog/
%{omc_svcdir}/syslog.xml

%changelog