From 8d869cd8404dca6bd668d60a2ea040dbfaa8c147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Tue, 13 Apr 2021 22:37:59 +0200 Subject: [PATCH] contrib/dracut: 90: generator: only log to kmsg if debug set on cmdline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "debug" is also used by systemd itself, and there's really no reason for the generator to write this much garbage by default Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #11898 --- contrib/dracut/90zfs/zfs-generator.sh.in | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/contrib/dracut/90zfs/zfs-generator.sh.in b/contrib/dracut/90zfs/zfs-generator.sh.in index 12293bd24f..8e97b896c2 100755 --- a/contrib/dracut/90zfs/zfs-generator.sh.in +++ b/contrib/dracut/90zfs/zfs-generator.sh.in @@ -1,6 +1,7 @@ #!/bin/sh -echo "zfs-generator: starting" >> /dev/kmsg +grep -wq debug /proc/cmdline && debug=1 +[ -n "$debug" ] && echo "zfs-generator: starting" >> /dev/kmsg GENERATOR_DIR="$1" [ -n "$GENERATOR_DIR" ] || { @@ -12,7 +13,7 @@ GENERATOR_DIR="$1" [ -f /usr/lib/dracut/modules.d/99base/dracut-lib.sh ] && dracutlib=/usr/lib/dracut/modules.d/99base/dracut-lib.sh command -v getarg >/dev/null 2>&1 || { - echo "zfs-generator: loading Dracut library from $dracutlib" >> /dev/kmsg + [ -n "$debug" ] && echo "zfs-generator: loading Dracut library from $dracutlib" >> /dev/kmsg . "$dracutlib" } @@ -34,7 +35,7 @@ case ",${rootflags}," in *) rootflags="zfsutil,${rootflags}" ;; esac -echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR"/sysroot.mount.d/zfs-enhancement.conf >> /dev/kmsg +[ -n "$debug" ] && echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR/sysroot.mount.d/zfs-enhancement.conf" >> /dev/kmsg [ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR" [ -d "$GENERATOR_DIR"/sysroot.mount.d ] || mkdir "$GENERATOR_DIR"/sysroot.mount.d @@ -67,4 +68,6 @@ ln -s ../sysroot.mount "$GENERATOR_DIR"/initrd-root-fs.target.requires/sysroot.m echo "After=zfs-import.target" } > "$GENERATOR_DIR"/dracut-pre-mount.service.d/zfs-enhancement.conf -echo "zfs-generator: finished" >> /dev/kmsg +[ -n "$debug" ] && echo "zfs-generator: finished" >> /dev/kmsg + +exit 0