diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-05-08 14:28:56 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-06-06 20:15:28 +0000 |
commit | ce47238ed94f3a989c13fef93b037904589910cf (patch) | |
tree | 5f16dc99871dd87585441f0c2174667222f05a3b /coin/provisioning/common/helpers.ps1 | |
parent | 982659b081c73d7ed373dd2845d2a926057b0f83 (diff) |
Improve Postgresql installation on Windows
Similar to the mysql change (parent commit) it's faster to rename any
older artifacts and install only what we need. This also generalizes the
zip archive extraction code for "dev" packages.
Change-Id: I3ad1f23efaed80fab3e0778a3e8c46317138f1ad
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'coin/provisioning/common/helpers.ps1')
-rw-r--r-- | coin/provisioning/common/helpers.ps1 | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/coin/provisioning/common/helpers.ps1 b/coin/provisioning/common/helpers.ps1 index 0e684452..132fcdd3 100644 --- a/coin/provisioning/common/helpers.ps1 +++ b/coin/provisioning/common/helpers.ps1 @@ -30,6 +30,32 @@ function Extract-Zip $destinationFolder.CopyHere($zipfile.Items(), 16) } +function Extract-Dev-Folders-From-Zip +{ + Param ( + [string]$package, + [string]$zipDir, + [string]$installPath + ) + + $shell = new-object -com shell.application + + echo "Extracting contents of $package" + foreach ($subDir in "lib", "include", "bin", "share") { + $zip = $shell.Namespace($package + "\" + $zipDir + "\" + $subDir) + if ($zip) { + Write-Host "Extracting $subDir from zip archive" + } else { + Write-Host "$subDir is missing from zip archive - skipping" + continue + } + $destDir = $installPath + "\" + $subdir + New-Item $destDir -type directory + $destinationFolder = $shell.Namespace($destDir) + $destinationFolder.CopyHere($zip.Items(), 16) + } +} + function BadParam { Param ([string]$Description) @@ -44,7 +70,11 @@ function Download [string] $Destination = $(BadParam("a download target location")) ) try { - Invoke-WebRequest -UseBasicParsing $CachedUrl -OutFile $Destination + if ($CachedUrl.StartsWith("http")) { + Invoke-WebRequest -UseBasicParsing $CachedUrl -OutFile $Destination + } else { + Copy-Item $CachedUrl $Destination + } } catch { Invoke-WebRequest -UseBasicParsing $OfficialUrl -OutFile $Destination } |