-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install WSL and MSYS2 on Windows Images #342
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
################################################################################ | ||
## File: Install-DebianImage.ps1 | ||
## Desc: Install Debian Image for WSL | ||
################################################################################ | ||
|
||
Import-Module -Name ImageHelpers | ||
|
||
debianTempDir = "C:\Temp\debian" | ||
AndreyMaslennikov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (-not (Test-Path $debianPath)) { | ||
New-Item -Path debianTempDir -ItemType Directory | ||
} | ||
|
||
Push-Location debianTempDir | ||
|
||
$debianZipName = "debian.zip" | ||
Invoke-WebRequest -Uri "https://aka.ms/wsl-debian-gnulinux" -OutFile $debianZipName | ||
AndreyMaslennikov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$debianPath = "C:\tools\debian" | ||
Expand-Archive -Path $debianZipName -DestinationPath $debianPath | ||
|
||
Add-MachinePathItem $debianPath | ||
|
||
debian install --root | ||
debian run apt update | ||
debian run DEBIAN_FRONTEND=noninteractive apt upgrade -y | ||
|
||
Pop-Location | ||
Remove-Item debianTempDir -Recurse -Force |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
################################################################################ | ||
## File: Install-MSYS2.ps1 | ||
## Desc: Install MSYS2 via chocolaty | ||
################################################################################ | ||
|
||
Import-Module -Name ImageHelpers | ||
|
||
$msys2Path = "C:\tools\msys64" | ||
choco install msys2 -y --params "/InstallDir:$msys2Path" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm rather sure that the mingw toolchains can be installed through msys2 so ideally we do that here and remove the separate installation of mingw. Also, I wonder if it's possible to tell GitForWindows to just use the installed msys2/mingw rather than bring in it's own. Any thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, how does this affect existing builds that depend on the currently installed mingw? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. another comment. if avoiding chocolatey is not substantially difficult, I think we should avoid it since waiting for choco packages adds another layer of delay and potential problems that we can't control. This comment by @eine suggests it should be easy enough to just untar and execute setup. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re using the tar, I created an Having used MSYS2 for a while, the main tar is not revised often, as the current release is dated 2019-May-24. Hence, the more important code is the update code, which hopefully can be run any time images are updated... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I beg to differ. Updating by default prevents users from testing their tools on a stable environment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
Add-MachinePathItem $msys2Path |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
################################################################################ | ||
## File: Install-WSL.ps1 | ||
## Desc: Install Windows subsystem for Linux | ||
################################################################################ | ||
|
||
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
################################################################################ | ||
## File: Validate-MSYS2.ps1 | ||
## Desc: Validate MSYS2 installation | ||
################################################################################ | ||
|
||
$msysCommand = "msys2" | ||
|
||
Get-Command $msysCommand -ErrorAction SilentlyContinue -OutVariable commandInfo | ||
if ($commandInfo) { | ||
Write-Host "$msysCommand is successfully installed" | ||
} else { | ||
Write-Host "$msysCommand command unavailable" | ||
exit 1 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
################################################################################ | ||
## File: Validate-WSL.ps1 | ||
## Desc: Validate Windows Subsystem for Linux installation | ||
################################################################################ | ||
|
||
$FeatureInfo = (Get-WindowsOptionalFeature -Online | Where FeatureName -eq Microsoft-Windows-Subsystem-Linux) | ||
|
||
if ($FeatureInfo.State -eq "Disabled") { | ||
Write-Host "Microsoft-Windows-Subsystem-Linux is Disabled" | ||
exit 1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should make these changes to the Windows2016 - I don't see any requests asking for them and it just adds one more element to destabilize an older setup. @thejoebourneidentity thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I can see there is a request for the both Windows2016 and 2019 images in the issue #50.
We also planned to use bash from the WSL as default . Wouldn't it be confused if we'll use different
bash.exe
for these images?