2 Description=Set BOOTFS and BOOTFSFLAGS environment variables for dracut
4 After=zfs-import-cache.service
5 After=zfs-import-scan.service
6 Before=zfs-import.target
10 ExecStart=/bin/sh -c ' \
11 . /lib/dracut-zfs-lib.sh; \
12 decode_root_args || exit 0; \
13 [ "$root" = "zfs:AUTO" ] && root="$(@sbindir@/zpool list -H -o bootfs | grep -m1 -vFx -)"; \
14 rootflags="$(getarg rootflags=)"; \
15 [ "$(@sbindir@/zfs get -H -o value mountpoint "$root")" = legacy ] || \
16 case ",$rootflags," in \
18 ,,) rootflags=zfsutil ;; \
19 *) rootflags="zfsutil,$rootflags" ;; \
21 exec systemctl set-environment BOOTFS="$root" BOOTFSFLAGS="$rootflags"'
24 WantedBy=zfs-import.target