From 4967a1452cc8a3f905d663bdc84746db2893002a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 7 Dec 2024 22:18:10 +0100 Subject: [PATCH] Collect all affected devices --- lib/modules/fileSystems.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/modules/fileSystems.nix b/lib/modules/fileSystems.nix index 7f6d2368..72c576e4 100644 --- a/lib/modules/fileSystems.nix +++ b/lib/modules/fileSystems.nix @@ -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}