mirror of
https://github.com/nix-community/disko.git
synced 2026-12-02 05:53:28 +01:00
luks: add test for multiple partitions and fix handling if on same disk (#1281)
This PR addresses the handling of multiple LUKS partitions on the same disk and adds a corresponding test case. - **Fix:** The core logic for handling multiple LUKS partitions on a single disk was improved to ensure correct partition mapping and unlocking. (Implemented using a custom pi agent and the **mimo-v2.5** model). - **Tests:** Added `luks-multiple` test to verify the behavior of multiple LUKS partitions on the same disk. (Tests written by me). Reproduces and fixes #1263
This commit is contained in:
4 files changed
+101
-14
No files matched your search
@@ -82,6 +82,8 @@ let
|
||||
efi ? !pkgs.stdenv.hostPlatform.isRiscV64,
|
||||
enableCanokey ? false,
|
||||
postDisko ? "",
|
||||
postUnmountPreMount ? "",
|
||||
postMount ? "",
|
||||
testMode ? "module", # can be one of direct module cli
|
||||
testBoot ? true, # if we actually want to test booting or just create/mount
|
||||
enableOCR ? false,
|
||||
@@ -369,7 +371,9 @@ let
|
||||
machine.succeed("${lib.getExe tsp-mount}") # verify that mount is idempotent
|
||||
machine.succeed("${lib.getExe tsp-unmount}")
|
||||
machine.succeed("${lib.getExe tsp-unmount}") # verify that umount is idempotent
|
||||
${postUnmountPreMount}
|
||||
machine.succeed("${lib.getExe tsp-mount}") # verify that mount is idempotent
|
||||
${postMount}
|
||||
machine.succeed("${lib.getExe tsp-disko} --yes-wipe-all-disks") # verify that we can destroy and recreate
|
||||
machine.succeed("mkdir -p /mnt/home")
|
||||
machine.succeed("touch /mnt/home/testfile")
|
||||
@@ -383,7 +387,9 @@ let
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.mount}") # verify that mount is idempotent
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.unmount}")
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.unmount}") # verify that unmount is idempotent
|
||||
${postUnmountPreMount}
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.mount}") # verify that mount is idempotent
|
||||
${postMount}
|
||||
machine.succeed("${lib.getExe nodes.machine.system.build.destroyFormatMount} --yes-wipe-all-disks") # verify that we can destroy and recreate again
|
||||
machine.succeed("mkdir -p /mnt/home")
|
||||
machine.succeed("touch /mnt/home/testfile")
|
||||
|
||||
+8
-14
@@ -342,30 +342,24 @@ in
|
||||
inherit config options;
|
||||
default =
|
||||
let
|
||||
partMounts = lib.foldr lib.recursiveUpdate { } (
|
||||
map (partition: lib.optionalAttrs (partition.content != null) partition.content._mount) (
|
||||
lib.attrValues config.partitions
|
||||
)
|
||||
);
|
||||
activePartitions = lib.filter (p: p.content != null) (lib.attrValues config.partitions);
|
||||
mounts = map (p: p.content._mount) activePartitions;
|
||||
in
|
||||
{
|
||||
dev = partMounts.dev or "";
|
||||
fs = partMounts.fs or { };
|
||||
dev = lib.concatStringsSep "\n" (map (m: m.dev or "") mounts);
|
||||
fs = lib.foldr lib.recursiveUpdate { } (map (m: m.fs or { }) mounts);
|
||||
};
|
||||
};
|
||||
_unmount = diskoLib.mkUnmountOption {
|
||||
inherit config options;
|
||||
default =
|
||||
let
|
||||
partMounts = lib.foldr lib.recursiveUpdate { } (
|
||||
map (partition: lib.optionalAttrs (partition.content != null) partition.content._unmount) (
|
||||
lib.attrValues config.partitions
|
||||
)
|
||||
);
|
||||
activePartitions = lib.filter (p: p.content != null) (lib.attrValues config.partitions);
|
||||
unmounts = map (p: p.content._unmount) activePartitions;
|
||||
in
|
||||
{
|
||||
dev = partMounts.dev or "";
|
||||
fs = partMounts.fs or { };
|
||||
dev = lib.concatStringsSep "\n" (map (m: m.dev or "") unmounts);
|
||||
fs = lib.foldr lib.recursiveUpdate { } (map (m: m.fs or { }) unmounts);
|
||||
};
|
||||
};
|
||||
_config = lib.mkOption {
|
||||
|
||||
Reference in new issue
Block a user