mirror of
https://github.com/nix-community/disko.git
synced 2026-12-02 22:13:28 +01:00
lib/types/bcachefs_filesystem: tolerate already-unlocked filesystem
This commit is contained in:
1 parent
21d9daf255
commit
403186440c
1 file changed
+15
-9
@@ -191,9 +191,11 @@
|
|||||||
(
|
(
|
||||||
TEMPDIR="$(mktemp -d)";
|
TEMPDIR="$(mktemp -d)";
|
||||||
MNTPOINT="$(mktemp -d)";
|
MNTPOINT="$(mktemp -d)";
|
||||||
${lib.optionalString (
|
${lib.optionalString (config.passwordFile != null) ''
|
||||||
config.passwordFile != null
|
if ! bcachefs unlock -k session "/dev/disk/by-uuid/${config.uuid}" < "${config.passwordFile}"; then
|
||||||
) ''bcachefs unlock -k session "/dev/disk/by-uuid/${config.uuid}" < "${config.passwordFile}";''}
|
test -d "/sys/fs/bcachefs/${config.uuid}";
|
||||||
|
fi;
|
||||||
|
''}
|
||||||
mount \
|
mount \
|
||||||
-t bcachefs \
|
-t bcachefs \
|
||||||
-o "${lib.concatStringsSep "," (lib.unique ([ "X-mount.mkdir" ] ++ config.mountOptions))}" \
|
-o "${lib.concatStringsSep "," (lib.unique ([ "X-mount.mkdir" ] ++ config.mountOptions))}" \
|
||||||
@@ -228,9 +230,11 @@
|
|||||||
# @todo Figure out why the "X-mount.mkdir" option here doesn't seem to work,
|
# @todo Figure out why the "X-mount.mkdir" option here doesn't seem to work,
|
||||||
# necessitating running `mkdir` here.
|
# necessitating running `mkdir` here.
|
||||||
mkdir -p "${rootMountPoint}${subvolume.mountpoint}";
|
mkdir -p "${rootMountPoint}${subvolume.mountpoint}";
|
||||||
${lib.optionalString (
|
${lib.optionalString (config.passwordFile != null) ''
|
||||||
config.passwordFile != null
|
if ! bcachefs unlock -k session "/dev/disk/by-uuid/${config.uuid}" < "${config.passwordFile}"; then
|
||||||
) ''bcachefs unlock -k session "/dev/disk/by-uuid/${config.uuid}" < "${config.passwordFile}";''}
|
test -d "/sys/fs/bcachefs/${config.uuid}";
|
||||||
|
fi;
|
||||||
|
''}
|
||||||
mount \
|
mount \
|
||||||
-t bcachefs \
|
-t bcachefs \
|
||||||
-o "${
|
-o "${
|
||||||
@@ -260,9 +264,11 @@
|
|||||||
# @todo Figure out why the "X-mount.mkdir" option here doesn't seem to work,
|
# @todo Figure out why the "X-mount.mkdir" option here doesn't seem to work,
|
||||||
# necessitating running `mkdir` here.
|
# necessitating running `mkdir` here.
|
||||||
mkdir -p "${rootMountPoint}${config.mountpoint}";
|
mkdir -p "${rootMountPoint}${config.mountpoint}";
|
||||||
${lib.optionalString (
|
${lib.optionalString (config.passwordFile != null) ''
|
||||||
config.passwordFile != null
|
if ! bcachefs unlock -k session "/dev/disk/by-uuid/${config.uuid}" < "${config.passwordFile}"; then
|
||||||
) ''bcachefs unlock -k session "/dev/disk/by-uuid/${config.uuid}" < "${config.passwordFile}";''}
|
test -d "/sys/fs/bcachefs/${config.uuid}";
|
||||||
|
fi;
|
||||||
|
''}
|
||||||
mount \
|
mount \
|
||||||
-t bcachefs \
|
-t bcachefs \
|
||||||
-o "${lib.concatStringsSep "," (lib.unique ([ "X-mount.mkdir" ] ++ config.mountOptions))}" \
|
-o "${lib.concatStringsSep "," (lib.unique ([ "X-mount.mkdir" ] ++ config.mountOptions))}" \
|
||||||
|
|||||||
Reference in new issue
Block a user