aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-04-13 22:37:59 +0200
committerBrian Behlendorf <[email protected]>2021-04-16 15:24:06 -0700
commit51bc60e5828808296bd7bc7f3197ef574029b371 (patch)
tree17eb071d9019379610867f1b3cddd8f9e075bef6
parent626a792bb37231d1257e5948efa69466f9840f60 (diff)
contrib/dracut: 90: generator: only log to kmsg if debug set on cmdline
"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 <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #11898
-rwxr-xr-xcontrib/dracut/90zfs/zfs-generator.sh.in11
1 files changed, 7 insertions, 4 deletions
diff --git a/contrib/dracut/90zfs/zfs-generator.sh.in b/contrib/dracut/90zfs/zfs-generator.sh.in
index 12293bd24..8e97b896c 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