Skip to content

Commit 6b98b81

Browse files
committed
luks-interactive-login: don't use passwordFile
1 parent 7ded58b commit 6b98b81

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

example/luks-btrfs-subvolumes.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
type = "luks";
2626
name = "crypted";
2727
# disable settings.keyFile if you want to use interactive password entry
28-
#passwordFile = "/tmp/secret.key"; # Interactive
28+
# passwordFile = "/tmp/secret.key"; # Interactive
2929
settings = {
3030
allowDiscards = true;
3131
keyFile = "/tmp/secret.key";

example/luks-interactive-login.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
type = "luks";
2323
name = "crypted";
2424
settings.allowDiscards = true;
25-
passwordFile = "/tmp/secret.key";
2625
content = {
2726
type = "filesystem";
2827
format = "ext4";
@@ -35,4 +34,11 @@
3534
};
3635
};
3736
};
37+
38+
# If we don't set passwordFile above, we will be interactively prompted by the
39+
# disko script to set the LUKS password. However, as passwordFile is necessary
40+
# for installTest we set it here.
41+
disko.tests.extraDiskoConfig = {
42+
devices.disk.vdb.content.partitions.luks.content.passwordFile = "/tmp/secret.key";
43+
};
3844
}

tests/luks-interactive-login.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{ pkgs ? import <nixpkgs> { }
22
, diskoLib ? pkgs.callPackage ../lib { }
33
}:
4-
diskoLib.testLib.makeDiskoTest {
4+
diskoLib.testLib.makeDiskoTest (let
5+
disko-config = import ../example/luks-interactive-login.nix;
6+
in {
57
inherit pkgs;
68
name = "luks-interactive-login";
7-
disko-config = ../example/luks-interactive-login.nix;
9+
inherit disko-config;
10+
inherit (disko-config.disko.tests) extraDiskoConfig;
811
extraTestScript = ''
912
machine.succeed("cryptsetup isLuks /dev/vda2");
1013
'';
1114
bootCommands = ''
1215
machine.wait_for_console_text("vda")
1316
machine.send_console("secretsecret\n")
1417
'';
15-
}
18+
})

0 commit comments

Comments
 (0)