Force the use of the managed distribution

This commit is contained in:
Manuel Thalmann 2024-08-27 04:26:25 +02:00
parent 6022adac79
commit c292a3c7fc
2 changed files with 9 additions and 1 deletions

View file

@ -173,7 +173,7 @@ $null = New-Module {
return; return;
} }
if (-not (Test-WslDistributions)) { if (-not (Test-WslDistribution)) {
if (-not (Test-Path (Get-WslDistributionDisk))) { if (-not (Test-Path (Get-WslDistributionDisk))) {
Install-WslDistribution; Install-WslDistribution;
} }

View file

@ -40,6 +40,14 @@ function Test-WslDistributions {
& { $null = wsl -l; $?; }; & { $null = wsl -l; $?; };
} }
<#
.SYNOPSIS
Checks whether the managed distribution is installed.
#>
function Test-WslDistribution {
& { $null = wsl -d (Get-WslDistributionName) -e true; $?; };
}
<# <#
.SYNOPSIS .SYNOPSIS
Installs `wsl` on the system. Installs `wsl` on the system.