]> git.proxmox.com Git - mirror_zfs.git/commitdiff
dracut: support mountpoint=legacy for root dataset
authorRafael Kitover <rkitover@gmail.com>
Tue, 8 Aug 2023 16:38:34 +0000 (16:38 +0000)
committerGitHub <noreply@github.com>
Tue, 8 Aug 2023 16:38:34 +0000 (09:38 -0700)
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
root datasets with mountpoint != legacy.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ahelenia ZiemiaƄska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Closes #15149

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

index 7ebab4c1a58da5fca004f078e978bfe3389762f4..fe362b930bf5a2898e1e2dac5dab86114fecdfe0 100644 (file)
@@ -12,11 +12,12 @@ ExecStart=/bin/sh -c '
     decode_root_args || exit 0;                                                                \
     [ "$root" = "zfs:AUTO" ] && root="$(@sbindir@/zpool list -H -o bootfs | grep -m1 -vFx -)"; \
     rootflags="$(getarg rootflags=)";                                                          \
-    case ",$rootflags," in                                                                     \
-        *,zfsutil,*) ;;                                                                        \
-        ,,) rootflags=zfsutil ;;                                                               \
-        *)  rootflags="zfsutil,$rootflags" ;;                                                  \
-    esac;                                                                                      \
+    [ "$(@sbindir@/zfs get -H -o value mountpoint "$root")" = legacy ] ||                      \
+        case ",$rootflags," in                                                                 \
+            *,zfsutil,*) ;;                                                                    \
+            ,,) rootflags=zfsutil ;;                                                           \
+            *)  rootflags="zfsutil,$rootflags" ;;                                              \
+        esac;                                                                                  \
     exec systemctl set-environment BOOTFS="$root" BOOTFSFLAGS="$rootflags"'
 
 [Install]