Skip to content

Commit bf8ae34

Browse files
committed
dracut: support mountpoint=legacy for root dataset
Support mountpoint=legacy for the root dataset in the dracut zfs support scripts. mountpoint=/ or mountpoint=/sysroot also works. Change zfs-env-bootfs.service to add zfsutil to BOOTFSFLAGS only for non-legacy root datasets, using the support function determine_rootflags() added to zfs-lib.sh. Signed-off-by: Rafael Kitover <[email protected]>
1 parent e47e9bb commit bf8ae34

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

contrib/dracut/90zfs/zfs-env-bootfs.service.in

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ ExecStart=/bin/sh -c '
1111
. /lib/dracut-zfs-lib.sh; \
1212
decode_root_args || exit 0; \
1313
[ "$root" = "zfs:AUTO" ] && root="$(@sbindir@/zpool list -H -o bootfs | grep -m1 -vFx -)"; \
14-
rootflags="$(getarg rootflags=)"; \
15-
case ",$rootflags," in \
16-
*,zfsutil,*) ;; \
17-
,,) rootflags=zfsutil ;; \
18-
*) rootflags="zfsutil,$rootflags" ;; \
19-
esac; \
14+
determine_rootflags; \
2015
exec systemctl set-environment BOOTFS="$root" BOOTFSFLAGS="$rootflags"'
2116

2217
[Install]

contrib/dracut/90zfs/zfs-lib.sh.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,19 @@ decode_root_args() {
118118

119119
return 1
120120
}
121+
122+
# Gets rootflags and adds zfsutil for non-legacy mountpoints.
123+
# Requires that decode_root_args() has already been called and $root is set.
124+
determine_rootflags() {
125+
rootflags="$(getarg rootflags=)"
126+
127+
mountpoint="$(zfs get -H -o value mountpoint "$root")"
128+
129+
if [ "$mountpoint" != legacy ]; then
130+
case ",$rootflags," in
131+
*,zfsutil,*) ;;
132+
,,) rootflags=zfsutil ;;
133+
*) rootflags="zfsutil,$rootflags" ;;
134+
esac
135+
fi
136+
}

0 commit comments

Comments
 (0)