Print a warning before formatting disks
This commit is contained in:
parent
6e9ff465dc
commit
4b42b9d849
|
@ -49,6 +49,12 @@
|
|||
internal = true;
|
||||
};
|
||||
|
||||
deviceVariable = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the variable holding the name of the disk";
|
||||
internal = true;
|
||||
};
|
||||
|
||||
partitions = mkOption {
|
||||
type = types.attrsOf (types.nullOr partitionType);
|
||||
description = "The partitions of the disk.";
|
||||
|
@ -169,6 +175,7 @@
|
|||
partitions);
|
||||
in {
|
||||
id = if osDisk then "os" else "disk-${name}";
|
||||
deviceVariable = diskVar;
|
||||
|
||||
deviceScript = if osDisk && config.devicePath == null then ''
|
||||
${diskSelector}
|
||||
|
@ -348,6 +355,10 @@
|
|||
(_: "sudo swapon ${partPath _}")
|
||||
(builtins.filter (_: _.useSwap) partitions));
|
||||
in lib.strings.concatLines (
|
||||
(builtins.map (_: _.deviceScript) disks) ++ lib.optional ((builtins.length disks) > 0) (
|
||||
''echo "Continuing this script will wipe the contents of '' + (
|
||||
lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") disks)
|
||||
) + (if (builtins.length disks) > 1 then " and " else "") + (lib.lists.last disks).deviceVariable) ++
|
||||
(builtins.map (_: _.script) disks) ++ [
|
||||
mountScript
|
||||
swapScript
|
||||
|
|
Loading…
Reference in a new issue