Skip to content

Commit

Permalink
refactor(ps): wsl_setup
Browse files Browse the repository at this point in the history
Disable appending Windows path.
  • Loading branch information
szymonos committed Oct 2, 2023
1 parent 042bef3 commit 4fff514
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wsl/wsl_distro_get.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ begin {
@{ Name = 'Name'; Expression = { $_.DistributionName } }
'DefaultUid'
@{ Name = 'Version'; Expression = { $_.Flags -lt 8 ? 1 : 2 } }
'Flags'
@{ Name = 'BasePath'; Expression = { $_.BasePath -replace '^\\\\\?\\' } }
'PSPath'
)
} else {
$distros = [Collections.Generic.List[PSCustomObject]]::new()
Expand Down
6 changes: 6 additions & 0 deletions wsl/wsl_setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ begin {
exit 1
}
}
# disable appending Windows path inside distro to fix mounting issues
$lxss = wsl/wsl_distro_get.ps1 -FromRegistry | Where-Object Name -EQ $Distro
if ($lxss -and $lxss.Flags -ne 13) {
Set-ItemProperty -Path $lxss.PSPath -Name 'Flags' -Value 13
wsl.exe --shutdown $Distro
}
} elseif ($lxss) {
Write-Host "Found $($lxss.Count) distro$($lxss.Count -eq 1 ? '' : 's') to update." -ForegroundColor White
$lxss.Name.ForEach({ Write-Host "- $_" })
Expand Down

0 comments on commit 4fff514

Please sign in to comment.