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