mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
installer/tools: Avoid duplicate LUKS device entries in hw config
There are situations where several filesystems reside on a single encrypted LUKS device (e.g. when using BTRFS subvolumes). Simply generating a `boot.init.luks.devices.NAME.device` entry for each mounted filesystem will result in an error later when evaluating the nix expression in `hardware-configuration.nix`.
This commit is contained in:
parent
50555a6d35
commit
352e06d3da
@ -449,7 +449,11 @@ EOF
|
||||
if (-e $slave) {
|
||||
my $dmName = read_file("/sys/class/block/$deviceName/dm/name");
|
||||
chomp $dmName;
|
||||
$fileSystems .= " boot.initrd.luks.devices.\"$dmName\".device = \"${\(findStableDevPath $slave)}\";\n\n";
|
||||
# Ensure to add an entry only once
|
||||
my $luksDevice = " boot.initrd.luks.devices.\"$dmName\".device";
|
||||
if ($fileSystems !~ /^\Q$luksDevice\E/m) {
|
||||
$fileSystems .= "$luksDevice = \"${\(findStableDevPath $slave)}\";\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user