You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.6 KiB

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