Dr. Werner Fink 2011-08-22 13:14:47 +00:00 committed by Git OBS Bridge
parent 5b5968ce59
commit f821b84a13
7 changed files with 166 additions and 52 deletions

39
klog.service Normal file
View File

@ -0,0 +1,39 @@
# /lib/systemd/system/klog.service
#
# This file is part of package systemd.
#
# Copyright (c) 2011 SuSE LINUX Products GmbH, Germany.
# Author: Werner Fink
# Please send feedback to http://www.suse.de/feedback
#
# Description:
#
# Create the well known /var/log/boot.msg
# By using dmesg(1) the normal kernel and boot messages handled
# by systemd will not disappear. The character device /dev/tty10
# will be created by udevd and therefore should exists only if
# virtual consoles are available.
#
[Unit]
Description=Early Kernel Boot Messages
Requires=local-fs.target default.target
Wants=syslog.service
After=local-fs.target
Before=syslog.service default.target
RefuseManualStart=true
ConditionPathIsDirectory=/var/log
Names=bootmsg.service
[Service]
Type=oneshot
RemainAfterExit=yes
Environment=KLOGCONSOLE_PARAMS=
EnvironmentFile=-/etc/sysconfig/boot
ExecStart=/bin/sh -c "test -s /var/log/boot.msg && /bin/mv -f /var/log/boot.msg /var/log/boot.omsg || :"
ExecStart=/bin/sh -c "/bin/dmesg -r > /var/log/boot.msg"
ExecStart=/bin/sh -c "test -s /dev/shm/initrd.msg && /bin/cat /dev/shm/initrd.msg >> /var/log/boot.msg || :"
ExecStart=/bin/sh -c "test -c /dev/tty10 && /usr/sbin/klogconsole $KLOGCONSOLE_PARAMS -r10 || :"
[Install]
WantedBy=basic.target

22
sysconfig.klogd Normal file
View File

@ -0,0 +1,22 @@
## Path: System/Logging
## Description: System logging
## Type: list(0,1,2,3,4,5,6,7)
## Default: 1
## Config: ""
## ServiceRestart: syslog
#
# Default loglevel for klogd
#
KERNEL_LOGLEVEL=1
## Type: string
## Default: -x
## Config: ""
## ServiceRestart: syslog
#
# if not empty: parameters for klogd
# for example KLOGD_PARAMS="-x" to avoid (duplicate) symbol resolution
#
KLOGD_PARAMS="-x"

View File

@ -1,13 +1,5 @@
## Path: System/Logging
## Description: System logging
## Type: list(0,1,2,3,4,5,6,7)
## Default: 1
## Config: ""
## ServiceRestart: syslog
#
# Default loglevel for klogd
#
KERNEL_LOGLEVEL=1
## Type: string
## Default: ""
@ -19,16 +11,6 @@ KERNEL_LOGLEVEL=1
#
SYSLOGD_PARAMS=""
## Type: string
## Default: -x
## Config: ""
## ServiceRestart: syslog
#
# if not empty: parameters for klogd
# for example KLOGD_PARAMS="-x" to avoid (duplicate) symbol resolution
#
KLOGD_PARAMS="-x"
## Type: list(syslogd,syslog-ng,rsyslogd,"")
## Default: ""
## Config: ""

12
sysconfig.syslogd Normal file
View File

@ -0,0 +1,12 @@
## Path: System/Logging
## Description: System logging
## Type: string
## Default: ""
## Config: ""
## ServiceRestart: syslog
#
# if not empty: parameters for syslogd
# for example SYSLOGD_PARAMS="-r -s my.dom.ain"
#
SYSLOGD_PARAMS=""

View File

@ -81,6 +81,15 @@ syslog-ng)
esac
done < ${config}
fi
if test -r "$config" ; then
while read line; do
case $line in
file*/proc/kmsg*)
start_klogd=no
break
esac
done < $config
fi
/bin/mkdir -p -m 0755 ${socksdir#/var}
/bin/touch -m 0600 ${socks#/var}
params="$SYSLOG_NG_PARAMS"
@ -135,15 +144,6 @@ rsyslogd)
case "$action" in *@*) network=network.target ;; esac
done < ${config}
fi
if test -r "$config" ; then
while read line; do
case $line in
file*/proc/kmsg*)
start_klogd=no
break
esac
done < $config
fi
/bin/mkdir -p -m 0755 ${socksdir#/var}
/bin/touch -m 0600 ${socks#/var}
params="$SYSLOGD_PARAMS"
@ -295,23 +295,29 @@ fi
syslogserv=$SYSUNITDIR/syslog.service
enableserv=$SYSCONFDIR/multi-user.target.wants/syslog.service
if test ! -h $enableserv ; then
/bin/rm -f $enableserv
/bin/rm -f $enableserv
/bin/ln -sf $syslogserv $enableserv
fi
klogserv=$SYSUNITDIR/klogd.service
enableserv=$SYSCONFDIR/multi-user.target.wants/klogd.service
disablserv=$SYSCONFDIR/klogd.service
if test "$start_klogd" != no -a -x ${klog_bin} ; then
if test "$start_klogd" != no -a -e $klogserv ; then
if test ! -h $enableserv ; then
/bin/rm -f $enableserv
/bin/rm -f $enableserv
/bin/ln -sf $klogserv $enableserv
fi
if test -h $disablserv ; then
/bin/rm -f $disablserv
fi
else
if test ! -h $disablserv ; then
/bin/rm -f $disablserv
/bin/rm -f $disablserv
/bin/ln -sf /dev/null $disablserv
fi
if test -h $enableserv ; then
/bin/rm -f $enableserv
fi
fi
#

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Aug 22 13:07:16 UTC 2011 - werner@suse.de
- Package split: klogd -> klogd + syslog-service because the
service boot scripts and service unit files do belong to all
system logger daemons.
-------------------------------------------------------------------
Mon Aug 22 11:10:10 UTC 2011 - werner@suse.de
- Check for klogd buitin service for syslog-ng and not syslogd
- Remove the klogd enable/disable service links if required
-------------------------------------------------------------------
Fri Aug 19 12:32:29 UTC 2011 - werner@suse.de

View File

@ -24,8 +24,10 @@ Name: syslogd
License: GPLv2+
Group: System/Daemons
BuildRequires: pkg-config systemd-devel
PreReq: coreutils %fillup_prereq klogd sed
PreReq: coreutils %fillup_prereq sed
PreReq: klogd syslog-service
Provides: syslog
Provides: sysklogd
AutoReqProv: on
Version: 1.4.1
Release: 741
@ -40,6 +42,7 @@ Source6: syslog.8
Source7: syslog-service-generator
Source8: klogd.service
Source9: syslog.service
Source10: klog.service
Patch0: sysklogd-1.4.1.dif
Patch1: sysklogd-1.4.1-dgram.patch
Patch2: sysklogd-1.4.1-sparc.patch
@ -88,10 +91,7 @@ Authors:
%package -n klogd
License: GPLv2+
PreReq: %insserv_prereq %fillup_prereq
Provides: sysklogd
Provides: syslogd:/sbin/klogd
Requires: /etc/init.d/network logrotate
Provides: klogd:/sbin/klogd
Summary: The kernel log daemon
Group: System/Daemons
@ -111,6 +111,24 @@ Authors:
Juha Virtanen <jiivee@hut.fi>
Shane Alderton <shane@scs.apana.org.au>
%package -n syslog-service
License: GPLv2+
PreReq: %insserv_prereq %fillup_prereq
Provides: klogd:/etc/init.d/syslog
Requires: /etc/init.d/network logrotate
Summary: The kernel log daemon
Group: System/Daemons
%description -n syslog-service
The package syslog-service provides the service boot
scripts for SysV and the service unit files for systemd.
Authors:
--------
Marius Tomaschewsk
Werner Fink
%prep
%setup -n sysklogd-1.4.1
%patch1 -p0 -b .dgram
@ -169,6 +187,7 @@ mv sample-s390.conf sample.conf
install -m 755 %{SOURCE7} $RPM_BUILD_ROOT%{sysdsysunitdir}-generators/
install -m 644 %{SOURCE8} $RPM_BUILD_ROOT%{sysdsysunitdir}/
install -m 644 %{SOURCE9} $RPM_BUILD_ROOT%{sysdsysunitdir}/
install -m 644 %{SOURCE10} $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
@ -176,10 +195,9 @@ mv sample-s390.conf sample.conf
%post
#
# add syslog variables provided by klogd if needed
# add syslog variables provided by syslogd if needed
#
%{fillup_and_insserv -ny syslog syslog}
%{fillup_and_insserv -nY syslog earlysyslog}
%{fillup_only -ns syslog syslogd}
#
# check if daemon configured in SYSLOG_DAEMON is
# installed and switch to ourself if it's missed
@ -214,11 +232,6 @@ 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
mkdir -p -m 0755 /var/run/syslog-ng
%preun
%stop_on_removal syslog
%postun
%restart_on_update syslog
@ -232,36 +245,63 @@ if test -f etc/sysconfig/syslog ; then
fi
fi
%preun -n klogd
%post -n syslog-service
#
# add syslog variables provided by klogd if needed
#
%{fillup_and_insserv -ny syslog syslog}
%{fillup_and_insserv -nY syslog earlysyslog}
mkdir -p -m 0755 var/run/rsyslog
mkdir -p -m 0755 var/run/syslog-ng
%preun -n syslog-service
%stop_on_removal syslog
%postun -n syslog-service
%restart_on_update syslog
%{insserv_cleanup}
%post -n klogd
#
# add syslog variables provided by klogd if needed
#
%{fillup_only -ns syslog klogd}
%restart_on_update syslog
%preun -n klogd
%restart_on_update syslog
%postun -n klogd
%restart_on_update syslog
%{insserv_cleanup}
%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
/sbin/syslogd
%files -n klogd
%defattr(-,root,root)
/var/adm/fillup-templates/sysconfig.syslog
/var/adm/fillup-templates/sysconfig.klogd
%config %{sysdsysunitdir}/klogd.service
%doc %{_mandir}/man8/klogd.8.gz
/sbin/klogd
%files -n syslog-service
%defattr(-,root,root)
%config(noreplace) /etc/logrotate.d/syslog
%config /etc/init.d/syslog
%config /etc/init.d/earlysyslog
%config %{sysdsysunitdir}/klogd.service
%config %{sysdsysunitdir}/syslog.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}-generators/syslog-service-generator
%attr(0755,root,root) %dir %ghost /var/run/rsyslog/
%attr(0755,root,root) %dir %ghost /var/run/syslog-ng/
%attr(0755,root,root) %dir %ghost /var/run/rsyslog
%attr(0755,root,root) %dir %ghost /var/run/syslog-ng
%{omc_svcdir}/syslog.xml
%changelog