Dr. Werner Fink 2011-08-18 13:24:26 +00:00 committed by Git OBS Bridge
parent 6c0eae96c7
commit 83a273683c
3 changed files with 73 additions and 38 deletions

39
klogd.service Normal file
View File

@ -0,0 +1,39 @@
# /lib/systemd/system/klogd.service
#
# This file is part of package klogd.
#
# Copyright (c) 2011 SuSE LINUX Products GmbH, Germany.
# Author: Werner Fink
# Please send feedback to http://www.suse.de/feedback
#
# Description:
#
# Used to start klogd, the System Kernel Logging Service
# if and only if the System Logger does not provide this
# its self. If the System Logger can do Kernel Logging
# Service this file should be masked by a symbolic link
# from /etc/systemd/system/klogd.service to /dev/null.
#
# If klogd.service is started then BindTo=syslog.service
# within unit section to make it disappear if syslogd dies.
#
[Unit]
Description=System Kernel Logging Service
Requisite=syslog.service
BindTo=syslog.service
After=syslog.service
RefuseManualStart=true
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
PIDFile=/var/run/klogd.pid
Environment=KERNEL_LOGLEVEL=1
Environment=KLOGD_PARAMS=
EnvironmentFile=-/etc/sysconfig/syslog
ExecStart=/sbin/klogd -c $KERNEL_LOGLEVEL $KLOGD_PARAMS -x
[Install]
WantedBy=multi-user.target

View File

@ -17,11 +17,16 @@
#
umask 0022
BINDIR=/sbin
UNIT_PATH=/etc/systemd/system
RUN_PATH=/run/systemd/system
test -s /etc/sysconfig/syslog && . /etc/sysconfig/syslog
for pkg-config in /usr/bin/pkg-config /bin/pkg-config; do
test -x $pkg-config && break
pkg-config=
done
BINDIR=/sbin
RUN_PATH=/run/systemd/system
: ${SYSUNITDIR:=/lib/systemd/system}
: ${SYSCONFDIR:=/etc/systemd/system}
#
# Update $SYSLOG_DAEMON if not up-to-date
@ -255,47 +260,28 @@ echo "[Install]"
echo "WantedBy=multi-user.target"
exec 1>&3 3>&-
#
# If klogd.service is required, remove symbolic link for masking out
# otherwise just add the symbolic link
#
klogserv=$SYSCONFDIR/klogd.service
if test "$start_klogd" != no -a -x ${klog_bin} ; then
trap 'rm -f "$service" "$klogserv"' EXIT
klogserv=$(/bin/mktemp $RUN_PATH/klogd.XXXXXXXX) || exit 1
(/bin/cat > $klogserv)<<-EOF
# Warning: Do not edit as this service file has been and will be
# autogenerated by $0
[Unit]
# If klogd.service is started then BindTo=syslog.service
# within unit section to make it disappear if syslogd dies.
Description=System Kernel Logging Service
Requisite=syslog.service
BindTo=syslog.service
After=syslog.service
RefuseManualStart=true
[Service]
Type=forking
StandardOutput=syslog
StandardError=syslog
PIDFile=/var/run/${klog_bin##*/}.pid
Environment=KERNEL_LOGLEVEL=1
Environment=KLOGD_PARAMS=
EnvironmentFile=-/etc/sysconfig/syslog
ExecStart=${klog_bin} -c \$KERNEL_LOGLEVEL \$KLOGD_PARAMS -x
[Install]
WantedBy=multi-user.target
EOF
test -h $klogserv && rm -f $klogserv
else
/bin/ln -sf /dev/null $klogserv
fi
#
# Now enable the service(s) for multi-user target
#
test -d $UNIT_PATH/multi-user.target.wants/ || mkdir -p $UNIT_PATH/multi-user.target.wants
test -d $SYSCONFDIR/multi-user.target.wants/ || mkdir -p $SYSCONFDIR/multi-user.target.wants
/bin/mv $service $RUN_PATH/syslog.service
/bin/ln -sf $RUN_PATH/syslog.service $UNIT_PATH/multi-user.target.wants/
/bin/ln -sf $RUN_PATH/syslog.service $SYSCONFDIR/multi-user.target.wants/
if test "$start_klogd" != no ; then
/bin/mv $klogserv $RUN_PATH/klogd.service
/bin/ln -sf $RUN_PATH/klogd.service $UNIT_PATH/multi-user.target.wants/
klogserv=$SYSUNITDIR/klogd.service
if test "$start_klogd" != no -a -x ${klog_bin} ; then
/bin/ln -sf $klogserv $SYSCONFDIR/multi-user.target.wants/
fi
#

View File

@ -23,6 +23,7 @@ Name: syslogd
%define omc_svcdir %{omc_prefix}/svcinfo.d
License: GPLv2+
Group: System/Daemons
BuildRequires: pkg-config systemd-devel
PreReq: coreutils %fillup_prereq klogd sed
Provides: syslog
AutoReqProv: on
@ -37,6 +38,7 @@ Source4: rc.earlysyslog
Source5: syslog.xml
Source6: syslog.8
Source7: syslog-service-generator
Source8: klogd.service
Patch0: sysklogd-1.4.1.dif
Patch1: sysklogd-1.4.1-dgram.patch
Patch2: sysklogd-1.4.1-sparc.patch
@ -64,6 +66,8 @@ 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
%{expand: %%global sysdsysunitdir %(pkg-config systemd --variable=systemdsystemunitdir)}
%{expand: %%global sysdsysconfdir %(pkg-config systemd --variable=systemdsystemconfdir)}
%description
The syslogd daemon is the general system logging daemon, which is
@ -148,8 +152,10 @@ mv sample-s390.conf sample.conf
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
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system-generator
mkdir -p $RPM_BUILD_ROOT%{sysdsysunitdir}-generator
mkdir -p $RPM_BUILD_ROOT%{sysdsysunitdir}
mkdir -p -m 0755 $RPM_BUILD_ROOT/var/run/rsyslog
mkdir -p -m 0755 $RPM_BUILD_ROOT/var/run/syslog-ng
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
@ -159,7 +165,8 @@ mv sample-s390.conf sample.conf
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
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT/lib/systemd/system-generator/
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT%{sysdsysunitdir}-generator/
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{sysdsysunitdir}/
%ifarch s390 s390x
sed 's/^KERNEL_LOGLEVEL=1/KERNEL_LOGLEVEL=7/' %{SOURCE2} \
> $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.syslog
@ -206,6 +213,7 @@ 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
mkdir -p -m 0755 /var/run/syslog-ng
%preun
%stop_on_removal syslog
@ -242,11 +250,13 @@ fi
%config(noreplace) /etc/logrotate.d/syslog
%config /etc/init.d/syslog
%config /etc/init.d/earlysyslog
%config %{sysdsysunitdir}/klogd.service
%doc %{_mandir}/man8/klogd.8.gz
%doc %{_mandir}/man8/sysklogd.8.gz
%doc %{_mandir}/man8/syslog.8.gz
/sbin/klogd
/sbin/rcsyslog
%attr(0744,root,root) %{sysdsysunitdir}-generator/syslog-service-generator
%attr(0755,root,root) %dir %ghost /var/run/rsyslog/
%attr(0755,root,root) %dir %ghost /var/run/syslog-ng/
%{omc_svcdir}/syslog.xml