From c9032dd42150c26e5661654a0867e3314c051249 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 9 Jul 2023 00:00:00 +0200 Subject: [PATCH] Refactor processing of partition modifications --- profiles/DerGeret/Windows/Setup.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/profiles/DerGeret/Windows/Setup.ps1 b/profiles/DerGeret/Windows/Setup.ps1 index ae2bd35e..da2b980c 100644 --- a/profiles/DerGeret/Windows/Setup.ps1 +++ b/profiles/DerGeret/Windows/Setup.ps1 @@ -51,13 +51,13 @@ $Global:SetupConfigPostprocessor = { $newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex"; $null = $partitionCreationContainer.AppendChild($newPartition); - $partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace); - $newModification = $partitionModifications.SelectNodes("./ua:ModifyPartition", $namespace)[2].CloneNode($true); + $partitionModificationContainer = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace); + $partitionModifications = $partitionModificationContainer.SelectNodes("./ModifyPartition", $namespace); + $newModification = $partitionModifications[1].CloneNode($true); $newModification.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex"; $newModification.SelectSingleNode("./ua:PartitionID", $namespace).InnerText = "$newIndex"; - for ($i = 0; $i -lt $partitionModifications.ChildNodes.Count; $i++) { - $partition = $partitionModifications.ChildNodes[$i]; + foreach ($partition in $partitionModifications) { $partitionID = [int]$partition.SelectSingleNode("./ua:PartitionID", $namespace).InnerText; $newID = $partitionID; @@ -79,7 +79,7 @@ $Global:SetupConfigPostprocessor = { } } - $null = $partitionModifications.AppendChild($newModification); + $null = $partitionModificationContainer.AppendChild($newModification); } . "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";