Blame SOURCES/0013-dracut-logger.sh-do-not-log-to-syslog-kmsg-journal-f.patch

18971c
From d87da4c7776d0e16b8ce6c3a583d21209c3db144 Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Wed, 2 Oct 2013 12:48:57 +0200
18971c
Subject: [PATCH] dracut-logger.sh: do not log to syslog/kmsg/journal for UID
18971c
 != 0
18971c
18971c
Don't clutter the system log with user actions.
18971c
18971c
Also check, if systemd-cat works, before using it.
18971c
---
18971c
 dracut-logger.sh | 10 ++++++++--
18971c
 1 file changed, 8 insertions(+), 2 deletions(-)
18971c
18971c
diff --git a/dracut-logger.sh b/dracut-logger.sh
18971c
index b052581e..f679dc94 100755
18971c
--- a/dracut-logger.sh
18971c
+++ b/dracut-logger.sh
18971c
@@ -140,11 +140,16 @@ dlog_init() {
18971c
         fi
18971c
     fi
18971c
 
18971c
+    if (( $UID  != 0 )); then
18971c
+        kmsgloglvl=0
18971c
+        sysloglvl=0
18971c
+    fi
18971c
+
18971c
     if (( $sysloglvl > 0 )); then
18971c
         if [[ -d /run/systemd/journal ]] \
18971c
             && type -P systemd-cat &>/dev/null \
18971c
-            && (( $UID  == 0 )) \
18971c
-            && systemctl is-active systemd-journald.socket  &>/dev/null; then
18971c
+            && systemctl --quiet is-active systemd-journald.socket &>/dev/null \
18971c
+            && { echo "dracut-$DRACUT_VERSION" | systemd-cat -t 'dracut' &>/dev/null; } ; then
18971c
             readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)"
18971c
             readonly _systemdcatfile="$_dlogdir/systemd-cat"
18971c
             mkfifo "$_systemdcatfile"
18971c
@@ -153,6 +158,7 @@ dlog_init() {
18971c
             exec 15>"$_systemdcatfile"
18971c
         elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then
18971c
             # We cannot log to syslog, so turn this facility off.
18971c
+            kmsgloglvl=$sysloglvl
18971c
             sysloglvl=0
18971c
             ret=1
18971c
             errmsg="No '/dev/log' or 'logger' included for syslog logging"