From 41cf95c4ebc9159e36254ca125227722c3bf9a92 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Tue, 24 Sep 2019 09:41:15 +0200 Subject: win-setup: Use an environment variable to chose not to use 7zip. Company security policies may make it impossible to use 7zip from a powershell script. Use an environment variable to chose to use the built in Expand-Archive instead. Change-Id: I4fc914c089e25e9cfedf79aef14c42a54b44b845 Reviewed-on: https://code.wireshark.org/review/34601 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- tools/win-setup.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools/win-setup.ps1') diff --git a/tools/win-setup.ps1 b/tools/win-setup.ps1 index 9130934230..a44c12808d 100644 --- a/tools/win-setup.ps1 +++ b/tools/win-setup.ps1 @@ -320,6 +320,15 @@ function DownloadArchive($fileName, $checksum, $subDir) { if ($subDir -and -not (Test-Path $archiveDir -PathType 'Container')) { New-Item -ItemType Directory -Path $archiveDir > $null } + if (Test-Path 'env:WIRESHARK_DO_NOT_USE_7ZIP') { + # Display a progress bar while extracting and overwriting existing files. + Expand-Archive $archiveFile $archiveDir -Force -ErrorVariable $expandError + if ($expandError) { + exit 1 + } + return + } + $activity = "Extracting into $($archiveDir)" Write-Progress -Activity "$activity" -Status "Running 7z x $archiveFile ..." & "$SevenZip" x "-o$archiveDir" -y "$archiveFile" 2>&1 | -- cgit v1.2.3