zpool: fix default dataset getting shadowed

If the zpool's root dataset is not the rootfs and gets mounted on
creation, the actual rootfs will get mounted later and shadow the
current mountpoint.

Running `zfs unmount` is the easiest way to unmount the zpool's root
dataset on creation without messing up the value of the `mountpoint`
setting.
This commit is contained in:
Michael Hoang 2023-12-19 23:49:30 +11:00
parent 4346558fd4
commit 9f9ff673d1

View File

@ -67,6 +67,9 @@
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-o ${n}=${v}") config.options)} \
${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "-O ${n}=${v}") config.rootFsOptions)} \
"''${zfs_devices[@]}"
${lib.optionalString ((config.rootFsOptions.mountpoint or "") != "none") ''
zfs unmount ${config.name}
''}
${lib.concatMapStrings (dataset: dataset._create) (lib.attrValues config.datasets)}
'';
};