Enlarge size before windows installation

This commit is contained in:
Manuel Thalmann 2023-07-03 13:10:53 +02:00
parent 0617938d3c
commit 53032abea3

View file

@ -15,8 +15,8 @@ $Global:SetupConfigPostprocessor = {
$installationPartition.InnerText = "$($newIndex + 1)"; $installationPartition.InnerText = "$($newIndex + 1)";
$partitionCreations = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace); $partitionCreations = $diskConfig.SelectSingleNode("./ua:CreatePartitions", $namespace);
$newPartition = $partitionCreations.SelectNodes("./ua:CreatePartition", $namespace)[0].CloneNode($true); $newPartition = $partitionCreations.SelectNodes("./ua:CreatePartition", $namespace)[0].CloneNode($true);
$newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex";
$newPartition.SelectSingleNode("./ua:Size", $namespace).InnerText = "65536"; # For testing purposes $offset = 0;
for ($i = 0; $i -lt $partitionCreations.ChildNodes.Count; $i++) { for ($i = 0; $i -lt $partitionCreations.ChildNodes.Count; $i++) {
$partition = $partitionCreations.ChildNodes[$i]; $partition = $partitionCreations.ChildNodes[$i];
@ -24,9 +24,15 @@ $Global:SetupConfigPostprocessor = {
if ($order -ge $newIndex) { if ($order -ge $newIndex) {
$partition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$($order + 1)"; $partition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$($order + 1)";
} else {
$offset += [int]$partition.SelectSingleNode("./ua:Size", $namespace).InnerText;
} }
} }
# Add 1 TB space before Windows installation... wha-!? For Linux, ofc! I use Arch Linux, btw.
$newPartition.SelectSingleNode("./ua:Size", $namespace).InnerText = "$((1 * 1024 * 1024) - $offset)";
$newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex";
$null = $partitionCreations.AppendChild($newPartition); $null = $partitionCreations.AppendChild($newPartition);
$partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace); $partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace);