Register WSL before running OneShot tasks

This commit is contained in:
Manuel Thalmann 2024-08-21 03:37:44 +02:00
parent fdeb84f42b
commit 31e3c51f97

View file

@ -170,6 +170,13 @@ $null = New-Module {
Set-Stage ([SetupStage]::Configure); Set-Stage ([SetupStage]::Configure);
break; break;
} }
default {
if (-not (& { $null = wsl -l; $? })) {
wsl --import-in-place "PortValhalla" "$wslLocation/ext4.vhdx";
wsl --set-default "PortValhalla";
}
switch ($_) {
([SetupStage]::OneShot) { ([SetupStage]::OneShot) {
Write-Host "Running OneShot task ``$(Get-OneShotTask)``"; Write-Host "Running OneShot task ``$(Get-OneShotTask)``";
@ -185,11 +192,6 @@ $null = New-Module {
break; break;
} }
default { default {
if (-not (& { $null = wsl -l; $? })) {
wsl --import-in-place "PortValhalla" "$wslLocation/ext4.vhdx";
wsl --set-default "PortValhalla";
}
if (Test-Admin) { if (Test-Admin) {
$null = Import-Module PSWindowsUpdate; $null = Import-Module PSWindowsUpdate;
@ -486,7 +488,7 @@ $null = New-Module {
}; };
} }
switch (Get-Stage) { switch ($_) {
([SetupStage]::Configure) { ([SetupStage]::Configure) {
if (Get-Config "valhalla.windows.dualboot.enable") { if (Get-Config "valhalla.windows.dualboot.enable") {
if (-not (Test-Qemu)) { if (-not (Test-Qemu)) {
@ -610,6 +612,8 @@ $null = New-Module {
} }
} }
} }
}
}
function Invoke-WindowsInstallation([Context] $context) { function Invoke-WindowsInstallation([Context] $context) {
$Global:InformationPreference = "Continue"; $Global:InformationPreference = "Continue";