Files
runner-images/images/win/scripts/Installers/Install-MysqlCli.ps1
2021-11-11 17:18:39 +03:00

31 lines
1.3 KiB
PowerShell

################################################################################
## File: Install-MysqlCli.ps1
## Desc: Install Mysql CLI
################################################################################
# Installing visual c++ redistibutable package.
$InstallerName = "vcredist_x64.exe"
$InstallerURI = "https://download.microsoft.com/download/0/5/6/056dcda9-d667-4e27-8001-8a0c6971d6b1/${InstallerName}"
$ArgumentList = ("/install", "/quiet", "/norestart")
Install-Binary -Url $InstallerURI -Name $InstallerName -ArgumentList $ArgumentList
## Downloading mysql
$MysqlMajorMinor = (Get-ToolsetContent).Mysql.version
$MysqlFullVersion = ((Invoke-WebRequest -Uri https://dev.mysql.com/downloads/mysql/${MysqlMajorMinor}.html).Content | Select-String -Pattern "${MysqlMajorMinor}\.\d+").Matches.Value
$MysqlVersionUrl = "https://dev.mysql.com/get/Downloads/MySQL-${MysqlMajorMinor}/mysql-${MysqlFullVersion}-winx64.zip"
$MysqlArchPath = Start-DownloadWithRetry -Url $MysqlVersionUrl -Name "mysql.zip"
# Expand the zip
Extract-7Zip -Path $MysqlArchPath -DestinationPath "C:\"
# Rename mysql-version to mysql folder
$MysqlPath = "C:\mysql"
Rename-Item -Path "C:\mysql-${MysqlFullVersion}-winx64" -NewName $MysqlPath
# Adding mysql in system environment path
Add-MachinePathItem "${MysqlPath}\bin"
Invoke-PesterTests -TestFile "Databases" -TestName "MySQL"