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 <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11898
This commit is contained in:
наб 2021-04-13 22:37:59 +02:00 committed by Brian Behlendorf
parent 626a792bb3
commit 51bc60e582
1 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/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" GENERATOR_DIR="$1"
[ -n "$GENERATOR_DIR" ] || { [ -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 [ -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 || { 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" . "$dracutlib"
} }
@ -34,7 +35,7 @@ case ",${rootflags}," in
*) rootflags="zfsutil,${rootflags}" ;; *) rootflags="zfsutil,${rootflags}" ;;
esac 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" ] || mkdir "$GENERATOR_DIR"
[ -d "$GENERATOR_DIR"/sysroot.mount.d ] || mkdir "$GENERATOR_DIR"/sysroot.mount.d [ -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" echo "After=zfs-import.target"
} > "$GENERATOR_DIR"/dracut-pre-mount.service.d/zfs-enhancement.conf } > "$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