This commit is contained in:
Nikita Bykov
2020-10-29 11:05:39 +03:00
36 changed files with 327 additions and 89 deletions

View File

@@ -0,0 +1,23 @@
# Create shells folder
$shellPath = "C:\shells"
New-Item -Path $shellPath -ItemType Directory | Out-Null
# sh and bash <--> C:\msys64\usr\bin\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\bash.exe" -Target "C:\msys64\usr\bin\bash.exe" | Out-Null
New-Item -ItemType SymbolicLink -Path "$shellPath\sh.exe" -Target "C:\msys64\usr\bin\sh.exe" | Out-Null
# WSL is available on Windows Server 2019
if (Test-IsWin19)
{
# winbash <--> C:\Windows\System32\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\winbash.exe" -Target "$env:SystemRoot\System32\bash.exe" | Out-Null
}
# gitbash <--> C:\Program Files\Git\bin\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\gitbash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe" | Out-Null
# msysbash <--> C:\msys64\usr\bin\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\msysbash.exe" -Target "C:\msys64\usr\bin\bash.exe" | Out-Null
# Add shells to PATH
Add-MachinePathItem $shellPath

View File

@@ -30,3 +30,7 @@ New-Item -Path $winInstallDir -ItemType Directory -Force
# Remove AllUsersAllHosts profile
Remove-Item $profile.AllUsersAllHosts -Force
# Clean yarn and npm cache
yarn cache clean
npm cache clean --force

View File

@@ -26,7 +26,7 @@ Install-Binary -Url $downloadUrl `
"/SP-", `
"/CLOSEAPPLICATIONS", `
"/RESTARTAPPLICATIONS", `
"/o:PathOption=CmdTools", `
"/o:PathOption=Cmd", `
"/o:BashTerminalOption=ConHost", `
"/o:EnableSymlinks=Enabled", `
"/COMPONENTS=gitlfs")
@@ -36,15 +36,5 @@ Choco-Install -PackageName hub
# Disable GCM machine-wide
[Environment]::SetEnvironmentVariable("GCM_INTERACTIVE", "Never", [System.EnvironmentVariableTarget]::Machine)
Add-MachinePathItem "C:\Program Files\Git\bin"
if (Test-IsWin16) {
$env:Path += ";$env:ProgramFiles\Git\usr\bin\"
}
# Add well-known SSH host keys to ssh_known_hosts
ssh-keyscan -t rsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts"
ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts"
Invoke-PesterTests -TestFile "Git" -TestName "Git"
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Hub CLI"

View File

@@ -7,7 +7,7 @@ Choco-Install -PackageName mingw
# Make a copy of mingw32-make.exe to make.exe, which is a more discoverable name
# and so the same command line can be used on Windows as on macOS and Linux
$path = where.exe mingw32-make.exe | Get-Item
$path = Get-Command mingw32-make.exe -CommandType All | Where-Object { $_.Path.Contains("C:\ProgramData\Chocolatey") } | Get-Item
Copy-Item -Path $path -Destination (Join-Path $path.Directory 'make.exe')
Invoke-PesterTests -TestFile "Tools" -TestName "Mingw64"

View File

@@ -9,35 +9,19 @@
$dash = "-" * 40
$origPath = $env:PATH
$gitPath = "$env:ProgramFiles\Git"
$msys2_release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
$msys2Uri = ((Invoke-RestMethod $msys2_release).assets | Where-Object {
$_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url
# Download the latest msys2 x86_64, filename includes release date
Write-Host "Starting msys2 download using $($msys2Uri.split('/')[-1])"
# Downloading msys2
$msys2Release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
$msys2Uri = ((Invoke-RestMethod $msys2Release).assets | Where-Object {
$_.name -match "x86_64" -and $_.name.EndsWith("sfx.exe") }).browser_download_url
$msys2File = Start-DownloadWithRetry -Url $msys2Uri
Write-Host "Finished download"
# nix style path for tar
$msys2FileU = "/$msys2File".replace(':', '').replace('\', '/')
# Git tar needs exe's from mingw64\bin
$env:PATH = "$gitPath\usr\bin;$gitPath\mingw64\bin;$origPath"
$tar = "$gitPath\usr\bin\tar.exe"
# extract tar.xz to C:\
# extract sfx.exe to C:\
Write-Host "Starting msys2 extraction"
&$tar -xJf $msys2FileU -C /c/
Remove-Item $msys2File
& $msys2File -y -oC:\
Write-Host "Finished extraction"
# Add msys2 bin tools folders to PATH temporary
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$origPath"
$env:PATH = "C:\msys64\mingw64\bin;C:\msys64\usr\bin;$env:PATH"
Write-Host "`n$dash bash pacman-key --init"
bash.exe -c "pacman-key --init 2>&1"
@@ -73,6 +57,10 @@ Write-Host "`n$dash Install mingw32 packages"
$pre = "mingw-w64-i686-"
pacman.exe -S --noconfirm --needed --noprogressbar $tools32.replace('___', $pre).split(' ')
# install openssh
Write-Host "`n$dash Install openssh package"
pacman.exe -S --noconfirm --needed --noprogressbar openssh
# clean all packages to decrease image size
Write-Host "`n$dash Clean packages"
pacman.exe -Scc --noconfirm
@@ -88,4 +76,23 @@ pacman.exe -Q | grep -v ^mingw-w64-
Write-Host "`nMSYS2 installation completed"
# Environment
# add C:\msys64\mingw64\bin and C:\msys64\usr\bin to PATH
# C:\msys64\mingw64\bin add after C:\Windows\System32 to not replace built-in tar.exe
$regEnvKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\'
$pathValue = Get-ItemPropertyValue -Path $regEnvKey -Name 'Path'
$pathValue += ";C:\msys64\mingw64\bin;C:\msys64\usr\bin"
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $pathValue
# Add well-known SSH host keys to ssh_known_hosts to Msys2
ssh-keyscan -t rsa github.com >> "C:\msys64\etc\ssh\ssh_known_hosts"
ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\msys64\etc\ssh\ssh_known_hosts"
# Add well-known SSH host keys to ssh_known_hosts to Git
if (Test-Path "C:\Program Files\Git\etc\ssh")
{
ssh-keyscan -t rsa github.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts"
ssh-keyscan -t rsa ssh.dev.azure.com >> "C:\Program Files\Git\etc\ssh\ssh_known_hosts"
}
Invoke-PesterTests -TestFile "MSYS2"

View File

@@ -3,7 +3,7 @@
## Desc: Install SQL PowerShell tool
################################################################################
$BaseUrl = "https://download.microsoft.com/download/8/7/2/872BCECA-C849-4B40-8EBE-21D48CDF1456/ENU/x64"
$BaseUrl = "https://download.microsoft.com/download/B/1/7/B1783FE9-717B-4F78-A39A-A2E27E3D679D/ENU/x64"
# install required MSIs
$SQLSysClrTypesName = "SQLSysClrTypes.msi"