Skip to content

Commit

Permalink
Install WSL version 2 without distribution, fixes #30
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Dockal <odockal@redhat.com>
  • Loading branch information
odockal authored and adrianriobo committed Oct 13, 2023
1 parent 7e79c1e commit a256e52
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions oci/lib/windows/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ param(
[Parameter(Mandatory,HelpMessage='junit results filename')]
$junitResultsFilename,
[Parameter(HelpMessage='user password to run privileged commands (run installers)')]
$userPassword
$userPassword,
[Parameter(HelpMessage='Check if wsl is installed if not it will install, default true.')]
$wslInstallFix="true"
)

function Install-PD {
Expand All @@ -21,13 +23,17 @@ function Install-PD {
# Run e2e
$env:PATH="$env:PATH;$env:HOME\$targetFolder;"

# Force install just in case
wsl -l -v
$installed=$?
# Force installation of WSL if needed
if ( $wslInstallFix -match 'true' )
{
wsl -l -v
$installed=$?

if (!$installed) {
Write-Host "installing wsl2"
wsl --install
if (!$installed) {
Write-Host "Installing WSL, setting default version 2"
wsl --set-default-version 2
wsl --install --no-distribution
}
}

if (!$pdPath)
Expand Down

0 comments on commit a256e52

Please sign in to comment.