diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2018-02-14 07:46:11 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-02-26 19:52:45 +0000 |
commit | cb6709ce5c48a31ba1170c71494c1a3869ffa5bb (patch) | |
tree | 8fdb8721a71cba868c2fbfe7c9fbc237d1f990a8 /coin/provisioning/common/windows/mysql.ps1 | |
parent | 08c88de5c8d531fb4fee03a0c337dd93739d365a (diff) |
Unify Windows provisioning scripts & improve error handlingv5.11.0-beta1
While Coin should also see exit codes != 0 as error, we should
stick to one way of handling script errors. As Power Shell cmdlets
signal an error by throwing an exception we should do the same
(and that approach also works in Coin).
Additionally extracting 7zip files was unified across scripts by
using the existing helper function instead of reinventing the wheel
again and again.
A similar helper function was introduced for starting an external
application (and handling its errors).
Also echo and other "cmd" commands were replaced by their PowerShell
equivalents to have a unified approach across our Windows provisioning
scripts.
Change-Id: I70129ce38692f1396c33c13b33a2918485fa5271
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'coin/provisioning/common/windows/mysql.ps1')
-rw-r--r-- | coin/provisioning/common/windows/mysql.ps1 | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/coin/provisioning/common/windows/mysql.ps1 b/coin/provisioning/common/windows/mysql.ps1 index 63088861..a22e439a 100644 --- a/coin/provisioning/common/windows/mysql.ps1 +++ b/coin/provisioning/common/windows/mysql.ps1 @@ -48,16 +48,16 @@ function DownloadAndInstall [string]$installPath ) - echo "Fetching from URL ..." + Write-Host "Fetching from URL ..." Copy-Item $internalUrl $package $zipDir = [io.path]::GetFileNameWithoutExtension($package) Extract-Dev-Folders-From-Zip $package $zipDir $installPath - Remove-Item $package + Remove-Item -Path $package } -if( (is64bitWinHost) -eq 1 ) { +if (Is64BitWinHost) { # Install x64 bit version $architecture = "x64" $installFolder = "C:\Utils\my_sql\my_sql" @@ -65,26 +65,23 @@ if( (is64bitWinHost) -eq 1 ) { DownloadAndInstall $internalUrl $packagex64 $installFolder - echo "Set environment variables ..." - [Environment]::SetEnvironmentVariable("MYSQL_INCLUDE_x64", "$installFolder\include", "Machine") - [Environment]::SetEnvironmentVariable("MYSQL_LIB_x64", "$installFolder\lib", "Machine") + Set-EnvironmentVariable "MYSQL_INCLUDE_x64" "$installFolder\include" + Set-EnvironmentVariable "MYSQL_LIB_x64" "$installFolder\lib" } # Install x86 bit version $architecture = "x86" $internalUrl = "\\ci-files01-hki.intra.qt.io\provisioning\windows\mysql-$version-win32.zip" -if( (is64bitWinHost) -eq 1 ) { +if (Is64BitWinHost) { $installFolder = "C:\Utils\my_sql\my_sql$architecture" -} -else { +} else { $installFolder = "C:\Utils\my_sql\my_sql" } DownloadAndInstall $internalUrl $packagex86 $installFolder -echo "Set environment variables ..." -[Environment]::SetEnvironmentVariable("MYSQL_INCLUDE_x86", "$installFolder\include", "Machine") -[Environment]::SetEnvironmentVariable("MYSQL_LIB_x86", "$installFolder\lib", "Machine") +Set-EnvironmentVariable "MYSQL_INCLUDE_x86" "$installFolder\include" +Set-EnvironmentVariable "MYSQL_LIB_x86" "$installFolder\lib" # Store version information to ~/versions.txt, which is used to print version information to provision log. -echo "MySQL = $version" >> ~/versions.txt +Write-Output "MySQL = $version" >> ~/versions.txt |