Add missing parameters to xml selections

This commit is contained in:
Manuel Thalmann 2023-07-03 12:49:06 +02:00
parent 64c3ba7584
commit dee04e3c2a

View file

@ -9,38 +9,38 @@ $Global:SetupConfigPostprocessor = {
$namespace);
$diskConfig = $setupComponent.SelectSingleNode("./ua:DiskConfiguration/ua:Disk", $namespace);
$installationPartition = $setupComponent.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo/ua:PartitionID");
$installationPartition = $setupComponent.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo/ua:PartitionID", $namespace);
$newIndex = [int]$installationPartition.InnerText;
$installationPartition.InnerText = "$($newIndex + 1)";
$partitionCreations = $diskConfig.SelectSingleNode("./ua:CreatePartitions");
$partitionCreations = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace);
$newPartition = $partitionCreations.FirstChild.CloneNode($true);
$newPartition.SelectSingleNode("./ua:Order").InnerText = "$newIndex";
$newPartition.SelectSingleNode("./ua:Size").InnerText = "65536"; # For testing purposes
$newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex";
$newPartition.SelectSingleNode("./ua:Size", $namespace).InnerText = "65536"; # For testing purposes
for ($i = 0; $i -lt $partitionCreations.ChildNodes.Count; $i++) {
$partition = $partitionCreations.ChildNodes[$i];
$order = [int]$partition.SelectSingleNode("./ua:Order").InnerText;
$order = [int]$partition.SelectSingleNode("./ua:Order", $namespace).InnerText;
if ($order -ge $newIndex) {
$partition.SelectSingleNode("./ua:Order").InnerText = "$($order + 1)";
$partition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$($order + 1)";
}
}
$partitionCreations.AppendChild($newPartition);
$partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions");
$partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace);
$newModification = $diskConfig.ChildNodes[2].CloneNode($true);
$newModification.SelectSingleNode("./ua:Order").InnerText = "$newIndex";
$newModification.SelectSingleNode("./ua:PartitionID").InnerText = "$newIndex";
$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];
$partitionID = [int]$partition.SelectSingleNode("./ua:PartitionID").InnerText;
$partitionID = [int]$partition.SelectSingleNode("./ua:PartitionID", $namespace).InnerText;
if ($partitionID -ge $newIndex) {
$partition.SelectSingleNode("./ua:PartitionID").InnerText = "$($partitionID + 1)";
$partition.SelectSingleNode("./ua:Order").InnerText = "$($partitionID + 1)";
$partition.SelectSingleNode("./ua:PartitionID", $namespace).InnerText = "$($partitionID + 1)";
$partition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$($partitionID + 1)";
}
}