From db9682888c384b3e8333d7b01719adb96a23becb Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Mon, 23 Jan 2017 12:04:25 +0200 Subject: Add PS provisioning helper for 7-Zip files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ice10e54137da8a0d2372019a195a63121fd00a8a Reviewed-by: Tony Sarajärvi --- coin/provisioning/common/helpers.ps1 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 ( -- cgit v1.2.3