summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2017-01-23 12:04:25 +0200
committerLiang Qi <liang.qi@qt.io>2017-01-31 18:33:41 +0000
commitdb9682888c384b3e8333d7b01719adb96a23becb (patch)
tree9ebb3669f10a6bcb2e4abd815cbde32105078630
parent9be869ba486276cbeb08e0dbf3871f0666bcc63e (diff)
Add PS provisioning helper for 7-Zip files
Change-Id: Ice10e54137da8a0d2372019a195a63121fd00a8a Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
-rw-r--r--coin/provisioning/common/helpers.ps123
1 files changed, 23 insertions, 0 deletions
diff --git a/coin/provisioning/common/helpers.ps1 b/coin/provisioning/common/helpers.ps1
index 0e684452..191be290 100644
--- a/coin/provisioning/common/helpers.ps1
+++ b/coin/provisioning/common/helpers.ps1
@@ -15,6 +15,29 @@ function Verify-Checksum
}
}
+function Extract-7Zip
+{
+ Param (
+ [string]$Source,
+ [string]$Destination
+ )
+ echo "Extracting '$Source' to '$Destination'..."
+
+ if ((Get-Command "7z.exe" -ErrorAction SilentlyContinue) -eq $null) {
+ $zipExe = join-path ${env:ProgramFiles(x86)} '7-zip\7z.exe'
+ if (-not (test-path $zipExe)) {
+ $zipExe = join-path ${env:ProgramW6432} '7-zip\7z.exe'
+ if (-not (test-path $zipExe)) {
+ throw "Could not find 7-zip."
+ }
+ }
+ } else {
+ $zipExe = "7z.exe"
+ }
+
+ & $zipExe x $Source "-o$Destination" -y
+}
+
function Extract-Zip
{
Param (