Merge pull request #291825 from WilliButz/repart/max-label-length
nixos/systemd-repart: add assertion for partition label length
This commit is contained in:
commit
b9fe04d671
@ -10,6 +10,20 @@ let
|
|||||||
"repart.d"
|
"repart.d"
|
||||||
format
|
format
|
||||||
(lib.mapAttrs (_n: v: { Partition = v; }) cfg.partitions);
|
(lib.mapAttrs (_n: v: { Partition = v; }) cfg.partitions);
|
||||||
|
|
||||||
|
partitionAssertions = lib.mapAttrsToList (fileName: definition:
|
||||||
|
let
|
||||||
|
maxLabelLength = 36; # GPT_LABEL_MAX defined in systemd's gpt.h
|
||||||
|
labelLength = builtins.stringLength definition.Label;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
assertion = definition ? Label -> maxLabelLength >= labelLength;
|
||||||
|
message = ''
|
||||||
|
The partition label '${definition.Label}' defined for '${fileName}' is ${toString labelLength}
|
||||||
|
characters long, but the maximum label length supported by systemd is ${toString maxLabelLength}.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
) cfg.partitions;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
@ -81,7 +95,7 @@ in
|
|||||||
'boot.initrd.systemd.repart.enable' requires 'boot.initrd.systemd.enable' to be enabled.
|
'boot.initrd.systemd.repart.enable' requires 'boot.initrd.systemd.enable' to be enabled.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
];
|
] ++ partitionAssertions;
|
||||||
|
|
||||||
# systemd-repart uses loopback devices for partition creation
|
# systemd-repart uses loopback devices for partition creation
|
||||||
boot.initrd.availableKernelModules = lib.optional initrdCfg.enable "loop";
|
boot.initrd.availableKernelModules = lib.optional initrdCfg.enable "loop";
|
||||||
|
Loading…
Reference in New Issue
Block a user