Accepting request 650560 from home:sbrabec:branches:Base:System

- Use setlogcons and dmesg instead of klogconsole;
  perform migration of sysconfig/boot file (boo#1116277).

OBS-URL: https://build.opensuse.org/request/show/650560
OBS-URL: https://build.opensuse.org/package/show/Base:System/syslogd?expand=0&rev=142
This commit is contained in:
Marcus Meissner 2018-12-06 14:42:30 +00:00 committed by Git OBS Bridge
parent 3c6a47d136
commit a033302229
4 changed files with 101 additions and 10 deletions

View File

@ -29,12 +29,14 @@ Type=oneshot
StandardError=tty StandardError=tty
StandardOutput=tty StandardOutput=tty
RemainAfterExit=yes RemainAfterExit=yes
Environment=KLOGCONSOLE_PARAMS= Environment=CONSOLE_LOGLEVEL=
Environment=KLOG_CONSOLE=10
EnvironmentFile=-/etc/sysconfig/boot 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 "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 "/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 -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 || :" ExecStart=/bin/sh -c "test -c /dev/tty$KLOG_CONSOLE && /usr/bin/setlogcons $KLOG_CONSOLE || :"
ExecStart=/bin/sh -c "if test -n \"$CONSOLE_LOGLEVEL\" ; then /bin/dmesg -n $CONSOLE_LOGLEVEL || : ; fi"
[Install] [Install]
WantedBy=basic.target WantedBy=basic.target

View File

@ -1,7 +1,15 @@
## Type: string ## Path: System/Logging
## Default: "" ## Description: System logging
## Type: list(1,2,3,4,5,6,7,8,9,10,11,12)
## Default: 10
# #
# Set additional parameters for klogconsole, e.g. "-l 7" # Console for logging
# #
KLOGCONSOLE_PARAMS="" KLOG_CONSOLE="10"
## Type: list(,0,emerg,1,alert,2,crit,3,err,4,warning,5,notice,6,info,7,debug)
## Default:
#
# Loglevel for log console (numbers are equal to corresponding strings)
#
CONSOLE_LOGLEVEL=""

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Nov 20 22:47:25 CET 2018 - sbrabec@suse.com
- Use setlogcons and dmesg instead of klogconsole;
perform migration of sysconfig/boot file (boo#1116277).
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Nov 23 13:42:15 UTC 2017 - rbrown@suse.com Thu Nov 23 13:42:15 UTC 2017 - rbrown@suse.com

View File

@ -1,7 +1,7 @@
# #
# spec file for package syslogd # spec file for package syslogd
# #
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via https://bugs.opensuse.org/
# #
@ -28,7 +28,7 @@ Name: syslogd
Version: 1.4.1 Version: 1.4.1
Release: 0 Release: 0
Summary: The Syslog daemon Summary: The Syslog daemon
License: GPL-2.0+ License: GPL-2.0-or-later
Group: System/Daemons Group: System/Daemons
Url: http://www.infodrom.org/projects/sysklogd/ Url: http://www.infodrom.org/projects/sysklogd/
Source: http://www.infodrom.org/projects/sysklogd/download/sysklogd-%{version}.tar.gz Source: http://www.infodrom.org/projects/sysklogd/download/sysklogd-%{version}.tar.gz
@ -182,7 +182,7 @@ install -m 644 %{SOURCE7} %{buildroot}%{_unitdir}/
install -m 644 %{SOURCE8} %{buildroot}%{_unitdir}/ install -m 644 %{SOURCE8} %{buildroot}%{_unitdir}/
install -m 755 %{SOURCE9} %{buildroot}/%{_sbindir}/ install -m 755 %{SOURCE9} %{buildroot}/%{_sbindir}/
install -m 755 %{SOURCE10} %{buildroot}/sbin/rcsyslog install -m 755 %{SOURCE10} %{buildroot}/sbin/rcsyslog
install -m 755 %{SOURCE12} %{buildroot}%{_fillupdir} install -m 644 %{SOURCE12} %{buildroot}%{_fillupdir}
for sbin in klogd syslogd ; do for sbin in klogd syslogd ; do
ln -sf %{_sbindir}/${sbin} %{buildroot}/sbin/${sbin} ln -sf %{_sbindir}/${sbin} %{buildroot}/sbin/${sbin}
done done
@ -249,7 +249,82 @@ chown news:news var/log/news/news.notice
%post -n syslog-service %post -n syslog-service
%{remove_and_set -n syslog SYSLOG_DAEMON} %{remove_and_set -n syslog SYSLOG_DAEMON}
%{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK} %{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK}
%{remove_and_set -n boot KLOGCONSOLE_PARAMS}
%{fillup_only -n boot} %{fillup_only -n boot}
#BEGIN KLOGCONSOLE_PARAMS migration
# KLOGCONSOLE_PARAMS was supported in /etc/sysconfig/boot up to Leap 15 and SLE 15.
# Based on genopts-1.3 options parser.
if test "$KLOGCONSOLE_PARAMS" != "no" ; then
KLOG_CONSOLE=
CONSOLE_LOGLEVEL=
function optarg_parse {
until [ $# -eq 0 ] ; do
case "$1" in
-* )
OPTTMP="${1:1}"
until [[ -z "$OPTTMP" ]] ; do
case "${OPTTMP:0:1}" in
r )
KLOG_CONSOLE="${OPTTMP:1}"
if [[ -z "$KLOG_CONSOLE" ]] ; then
shift
KLOG_CONSOLE="$1"
else
break
fi
;;
l )
CONSOLE_LOGLEVEL="${OPTTMP:1}"
if [[ -z "$CONSOLE_LOGLEVEL" ]] ; then
shift
CONSOLE_LOGLEVEL="$1"
else
break
fi
;;
esac
OPTTMP="${OPTTMP:1}"
done
;;
esac
shift
done
}
optarg_parse $KLOGCONSOLE_PARAMS
case "$CONSOLE_LOGLEVEL" in
0) CONSOLE_LOGLEVEL=emerg ;;
1) CONSOLE_LOGLEVEL=alert ;;
2) CONSOLE_LOGLEVEL=crit ;;
3) CONSOLE_LOGLEVEL=err ;;
4) CONSOLE_LOGLEVEL=warning ;;
5) CONSOLE_LOGLEVEL=notice ;;
6) CONSOLE_LOGLEVEL=info ;;
7) CONSOLE_LOGLEVEL=debug ;;
esac
unset OPTTMP
cat >%{_sysconfdir}/sysconfig/boot.update <<EOF
## Path: System/Logging
## Description: System logging
## Type: list(1,2,3,4,5,6,7,8,9,10,11,12)
## Default: 10
#
# Console for logging
#
KLOG_CONSOLE="$KLOG_CONSOLE"
## Type: list(,0,emerg,1,alert,2,crit,3,err,4,warning,5,notice,6,info,7,debug)
## Default:
#
# Loglevel for log console
#
CONSOLE_LOGLEVEL="$CONSOLE_LOGLEVEL"
EOF
fillup -m %{_sysconfdir}/sysconfig/boot.update %{_sysconfdir}/sysconfig/boot %{_sysconfdir}/sysconfig/boot
rm %{_sysconfdir}/sysconfig/boot.update
fi
#END KLOGCONSOLE_PARAMS migration
# when exists, remove the broken link pointing to the # when exists, remove the broken link pointing to the
# common syslog.service file, we've provided before... # common syslog.service file, we've provided before...
rm -f %{_sysconfdir}/systemd/system/multi-user.target.wants/syslog.service rm -f %{_sysconfdir}/systemd/system/multi-user.target.wants/syslog.service