diff options
-rwxr-xr-x | dracut-logger.sh | 21 | ||||
-rw-r--r-- | dracut.conf.d/fedora.conf.example | 2 |
2 files changed, 11 insertions, 12 deletions
diff --git a/dracut-logger.sh b/dracut-logger.sh index 2e3c1ed8..74a8a1bc 100755 --- a/dracut-logger.sh +++ b/dracut-logger.sh @@ -138,6 +138,9 @@ dlog_init() { errmsg="'$logfile' is not a writable file" fi fi + fi + + if (( $sysloglvl > 0 )); then if type -P systemd-cat &>/dev/null && (( $UID == 0 )) ; then readonly _dlogdir="$(mktemp --tmpdir="$TMPDIR/" -d -t dracut-log.XXXXXX)" readonly _systemdcatfile="$_dlogdir/systemd-cat" @@ -145,12 +148,7 @@ dlog_init() { readonly _dlogfd=15 systemd-cat -t 'dracut' <"$_systemdcatfile" & exec 15>"$_systemdcatfile" - fi - fi - - if (( $sysloglvl > 0 )); then - if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null - then + elif ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null; then # We cannot log to syslog, so turn this facility off. sysloglvl=0 ret=1 @@ -320,18 +318,19 @@ _do_dlog() { local lmsg="$lvlc: $*" (( $lvl <= $stdloglvl )) && echo "$msg" >&2 + if (( $lvl <= $sysloglvl )); then - logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg" + if [[ "$_dlogfd" ]]; then + echo "<$(_dlvl2syslvl $lvl)>$msg" >&$_dlogfd + else + logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg" + fi fi if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then echo "$lmsg" >>"$logfile" fi - if (( $lvl <= $fileloglvl )) && [[ "$_dlogfd" ]]; then - echo "<$(_dlvl2syslvl $lvl)>$msg" >&$_dlogfd - fi - (( $lvl <= $kmsgloglvl )) && \ echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg } diff --git a/dracut.conf.d/fedora.conf.example b/dracut.conf.d/fedora.conf.example index fd94e838..c10dca37 100644 --- a/dracut.conf.d/fedora.conf.example +++ b/dracut.conf.d/fedora.conf.example @@ -5,7 +5,7 @@ i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-F i18n_default_font="latarcyrheb-sun16" omit_drivers+=' .*/fs/ocfs/.* i2o_scsi' stdloglvl=3 -fileloglvl=5 +sysloglvl=5 install_items+=" vi /etc/virc ps grep cat rm " prefix="/" systemdutildir=/usr/lib/systemd |