Collect all affected devices

This commit is contained in:
Manuel Thalmann 2024-12-07 22:18:10 +01:00
parent ccbf77ce3f
commit 7c3297b993

View file

@ -88,6 +88,11 @@ in
)
(builtins.attrValues cfg.mounts))
);
affected = (builtins.map (_: _.deviceVariable) devices) ++
(builtins.concatMap
(_: builtins.map (_: lib.escapeShellArg _) _.devices)
(builtins.attrValues cfg.btrfs.volumes));
in
''
#!/bin/bash
@ -96,14 +101,14 @@ in
${lib.strings.concatLines (lib.optionals ((builtins.length devices) > 0) [
''echo "$(tput setaf 3)=== WARNING ====$(tput sgr0)"''
(''echo "Continuing this script will alter the partitions of ''
+ (lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") (lib.lists.init devices)))
+ (if (builtins.length devices) > 1 then " and " else "") + (lib.lists.last devices).deviceVariable + ''"'')
+ (lib.strings.concatStringsSep ", " (lib.lists.init affected))
+ (if (builtins.length affected) > 1 then " and " else "") + (lib.lists.last affected) + ''"'')
''
if ! fish ${./fileSystems/confirm.fish} "Are you sure you want to continue?" "n"; then
exit 1
fi
''
])}
])}
${cfg.diskSetup.scripts.partition}
${cfg.btrfs.script}
${mountScript}