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

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