From a033302229b41c50698ba4e4ffa5e243b9ef108bdf78a7c037c4a46bb2bcab90 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Thu, 6 Dec 2018 14:42:30 +0000 Subject: [PATCH] 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 --- klog.service | 6 ++-- sysconfig.boot | 16 +++++++--- syslogd.changes | 6 ++++ syslogd.spec | 83 ++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 101 insertions(+), 10 deletions(-) diff --git a/klog.service b/klog.service index cad8451..cf479fc 100644 --- a/klog.service +++ b/klog.service @@ -29,12 +29,14 @@ Type=oneshot StandardError=tty StandardOutput=tty RemainAfterExit=yes -Environment=KLOGCONSOLE_PARAMS= +Environment=CONSOLE_LOGLEVEL= +Environment=KLOG_CONSOLE=10 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 || :" +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] WantedBy=basic.target diff --git a/sysconfig.boot b/sysconfig.boot index 8e55021..79573a8 100644 --- a/sysconfig.boot +++ b/sysconfig.boot @@ -1,7 +1,15 @@ -## Type: string -## Default: "" +## Path: System/Logging +## 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="" diff --git a/syslogd.changes b/syslogd.changes index a1ace0e..5d737cf 100644 --- a/syslogd.changes +++ b/syslogd.changes @@ -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 diff --git a/syslogd.spec b/syslogd.spec index 7ec7e76..24c67c8 100644 --- a/syslogd.spec +++ b/syslogd.spec @@ -1,7 +1,7 @@ # # 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 # 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) # 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 Release: 0 Summary: The Syslog daemon -License: GPL-2.0+ +License: GPL-2.0-or-later Group: System/Daemons Url: http://www.infodrom.org/projects/sysklogd/ 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 755 %{SOURCE9} %{buildroot}/%{_sbindir}/ 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 ln -sf %{_sbindir}/${sbin} %{buildroot}/sbin/${sbin} done @@ -249,7 +249,82 @@ chown news:news var/log/news/news.notice %post -n syslog-service %{remove_and_set -n syslog SYSLOG_DAEMON} %{remove_and_set -n syslog SYSLOG_REQUIRES_NETWORK} +%{remove_and_set -n boot KLOGCONSOLE_PARAMS} %{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 <