Improve Windows helpers functions stability (#723)

* Rework windows InstallHelpers; Add retry logic to install function
This commit is contained in:
Maksim Petrov
2020-04-21 11:58:27 +03:00
committed by GitHub
parent 54a14f61b3
commit 8e8fbb4f76
15 changed files with 197 additions and 227 deletions

View File

@@ -9,31 +9,23 @@ $uri = 'https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.21-winx64.zip'
$mysqlPath = 'C:\mysql-5.7.21-winx64\bin'
# Installing visual c++ redistibutable package.
$InstallerURI = 'https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/vcredist_x64.exe'
$InstallerName = 'vcredist_x64.exe'
$ArgumentList = ('/install', '/quiet', '/norestart' )
$InstallerName = "vcredist_x64.exe"
$InstallerURI = "https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/${InstallerName}"
$ArgumentList = ("/install", "/quiet", "/norestart")
$exitCode = Install-EXE -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
if ($exitCode -eq 0 -or $exitCode -eq 3010)
{
# MySQL disabled TLS 1.0 support on or about Jul-14-2018. Need to make sure TLS 1.2 is enabled.
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
Install-Binary -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
# Get the latest mysql command line tools .
Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile mysql.zip
# MySQL disabled TLS 1.0 support on or about Jul-14-2018. Need to make sure TLS 1.2 is enabled.
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
# Expand the zip
Expand-Archive -Path mysql.zip -DestinationPath "C:\" -Force
# Get the latest mysql command line tools .
Invoke-WebRequest -UseBasicParsing -Uri $uri -OutFile mysql.zip
# Deleting zip folder
Remove-Item -Recurse -Force mysql.zip
# Expand the zip
Expand-Archive -Path mysql.zip -DestinationPath "C:\" -Force
# Adding mysql in system environment path
Add-MachinePathItem $mysqlPath
# Deleting zip folder
Remove-Item -Recurse -Force mysql.zip
return 0;
}
else
{
return $exitCode;
}
# Adding mysql in system environment path
Add-MachinePathItem $mysqlPath