aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/dracut/90zfs/zfs-generator.sh.in
diff options
context:
space:
mode:
authorMatthew Thode <[email protected]>2018-01-18 18:20:34 +0000
committerBrian Behlendorf <[email protected]>2018-01-18 10:20:34 -0800
commit7da8f8d81bf1fadc2d9dff10f0435fe601e919fa (patch)
treec7cfb694f5a0fbf8a9645863476d1445d0ebdbb0 /contrib/dracut/90zfs/zfs-generator.sh.in
parent79c3270476b7140220c7946dd0a709a31bb9ed1b (diff)
Run zfs load-key if needed in dracut
'zfs load-key -a' will only be called if needed. If a dataset not needed for boot does not have its key loaded (home directories for example) boot can still continue. zfs:AUTO was not working via dracut, so we still need the generator script to do its thing. Reviewed-by: Richard Yao <[email protected]> Reviewed-by: Manuel Amador (Rudd-O) <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: loli10K <[email protected]> Signed-off-by: Matthew Thode <[email protected]> Closes #6982 Closes #7004
Diffstat (limited to 'contrib/dracut/90zfs/zfs-generator.sh.in')
-rwxr-xr-xcontrib/dracut/90zfs/zfs-generator.sh.in19
1 files changed, 8 insertions, 11 deletions
diff --git a/contrib/dracut/90zfs/zfs-generator.sh.in b/contrib/dracut/90zfs/zfs-generator.sh.in
index c6384f583..8cc85a3d3 100755
--- a/contrib/dracut/90zfs/zfs-generator.sh.in
+++ b/contrib/dracut/90zfs/zfs-generator.sh.in
@@ -23,13 +23,6 @@ type getarg >/dev/null 2>&1 || {
# If root is not ZFS= or zfs: or rootfstype is not zfs
# then we are not supposed to handle it.
[ "${root##zfs:}" = "${root}" -a "${root##ZFS=}" = "${root}" -a "$rootfstype" != "zfs" ] && exit 0
-# If root is set to zfs:AUTO, then we are also not
-# supposed to handle it, and it should be handled
-# by the traditional Dracut mount hook.
-# See https://github.com/zfsonlinux/zfs/pull/4558#discussion_r61118952
-if [ "${root}" = "zfs:AUTO" ] ; then
- exit 0
-fi
rootfstype=zfs
if echo "${rootflags}" | grep -Eq '^zfsutil$|^zfsutil,|,zfsutil$|,zfsutil,' ; then
@@ -40,9 +33,6 @@ else
rootflags=zfsutil
fi
-root="${root##zfs:}"
-root="${root##ZFS=}"
-
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"
@@ -54,7 +44,14 @@ echo "zfs-generator: writing extension for sysroot.mount to $GENERATOR_DIR"/sysr
echo "After=zfs-import-scan.service"
echo "After=zfs-import-cache.service"
echo "[Mount]"
- echo "What=${root}"
+ if [ "${root}" = "zfs:AUTO" ] ; then
+ echo "PassEnvironment=BOOTFS"
+ echo 'What=${BOOTFS}'
+ else
+ root="${root##zfs:}"
+ root="${root##ZFS=}"
+ echo "What=${root}"
+ fi
echo "Type=${rootfstype}"
echo "Options=${rootflags}"
} > "$GENERATOR_DIR"/sysroot.mount.d/zfs-enhancement.conf