2 # shellcheck disable=SC2016,SC1004,SC2154
4 grep -wq debug
/proc
/cmdline
&& debug
=1
5 [ -n "$debug" ] && echo "zfs-generator: starting" >> /dev
/kmsg
8 [ -n "$GENERATOR_DIR" ] ||
{
9 echo "zfs-generator: no generator directory specified, exiting" >> /dev
/kmsg
13 # shellcheck source=zfs-lib.sh.in
14 .
/lib
/dracut-zfs-lib.sh
15 decode_root_args ||
exit 0
17 [ -n "$debug" ] && echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR/sysroot.mount.d/zfs-enhancement.conf" >> /dev
/kmsg
20 mkdir
-p "$GENERATOR_DIR"/sysroot.mount.d
"$GENERATOR_DIR"/dracut-pre-mount.service.d
24 echo "Before=initrd-root-fs.target"
25 echo "After=zfs-import.target"
28 echo "PassEnvironment=BOOTFS BOOTFSFLAGS"
31 echo 'Options=${BOOTFSFLAGS}'
32 } > "$GENERATOR_DIR"/sysroot.mount.d
/zfs-enhancement.conf
33 ln -fs ..
/sysroot.mount
"$GENERATOR_DIR"/initrd-root-fs.target.requires
/sysroot.mount
37 echo "After=zfs-import.target"
38 } > "$GENERATOR_DIR"/dracut-pre-mount.service.d
/zfs-enhancement.conf
40 [ -n "$debug" ] && echo "zfs-generator: finished" >> /dev
/kmsg