Skip to content

Commit

Permalink
Merge pull request #123 from szymonos/fix/wsl-install
Browse files Browse the repository at this point in the history
Fix WSLinstall
  • Loading branch information
szymonos authored Oct 2, 2023
2 parents 9012358 + 33a435f commit a2d6556
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
18 changes: 17 additions & 1 deletion .assets/provision/install_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,27 @@ fi

# determine system id
SYS_ID="$(sed -En '/^ID.*(alpine|arch|fedora|debian|ubuntu|opensuse).*/{s//\1/;p;q}' /etc/os-release)"

# check if package installed already using package manager
case $SYS_ID in
alpine)
exit 0
;;
arch)
pacman -Qqe docker &>/dev/null && exit 0 || true
;;
fedora)
rpm -q docker-ce &>/dev/null && exit 0 || true
;;
debian | ubuntu)
dpkg -s docker-ce &>/dev/null && exit 0 || true
;;
opensuse)
rpm -q docker &>/dev/null && exit 0 || true
;;
esac

# install docker
case $SYS_ID in
arch)
pacman -Sy --needed --noconfirm docker docker-compose
;;
Expand Down
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
2 changes: 1 addition & 1 deletion wsl/wsl_install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ process {
if ($Scope) { $cmd += " -Scope @($($Scope.ForEach({ "'$_'" }) -join ','),'shell')" }
if ($Repos) { $cmd += " -Repos @($($Repos.ForEach({ "'$_'" }) -join ','))" }
if ($FixNetwork) { $cmd += ' -FixNetwork' }
$cmd += '-OmpTheme base -AddCertificate'
$cmd += ' -OmpTheme base -AddCertificate'
pwsh.exe -NoProfile -Command $cmd
}

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 a2d6556

Please sign in to comment.