mirror of
https://github.com/timsutton/brigadier.git
synced 2024-09-19 11:18:44 -04:00
Fix 7-Zip install code
This commit is contained in:
parent
9600a25266
commit
455550864c
1 changed files with 8 additions and 3 deletions
|
@ -17,11 +17,12 @@ if (!(Test-Path $OutputDir)) { New-Item -Path $OutputDir -ItemType Directory -Fo
|
|||
|
||||
# Check if at least 7zip 15.14 is installed. If not, download and install it.
|
||||
$7z = "$env:ProgramFiles\7-Zip\7z.exe"
|
||||
$7zDownload = Join-Path $env:Temp $SEVENZIP_URL.Split('/')[-1]
|
||||
if (Test-Path $7z) { $7zInstalled = $true }
|
||||
if ([version](Get-ItemProperty $7z).VersionInfo.FileVersion -lt 15.14) {
|
||||
Write-Host "7-Zip not installed, will install and remove."
|
||||
Invoke-WebRequest -Uri $SEVENZIP_URL -OutFile "$env:Temp\$($SEVENZIP_URL.Split('/')[-1])" -ErrorAction Stop
|
||||
Start-Process -FilePath $env:SystemRoot\System32\msiexec.exe -ArgumentList "/i $OutputDir\$($SEVENZIP_URL.Split('/')[-1]) /qb- /norestart" -Wait -Verbose
|
||||
Invoke-WebRequest -Uri $SEVENZIP_URL -OutFile $7zDownload -ErrorAction Stop
|
||||
Start-Process -FilePath $env:SystemRoot\System32\msiexec.exe -ArgumentList "/i $7zDownload /qb- /norestart" -Wait -Verbose
|
||||
}
|
||||
|
||||
Write-Host "Using model: $Model"
|
||||
|
@ -91,7 +92,11 @@ if (-not (Test-Path -PathType Container $landingDir)) {mkdir $landingDir > $null
|
|||
& $7z -o"$landingDir" -y x "$dmgPath"
|
||||
|
||||
# Uninstall 7zip if we installed it
|
||||
if ($7zInstalled -ne $true) { Start-Process -FilePath $env:SystemRoot\System32\msiexec.exe -ArgumentList "/x $env:Temp\$($SEVENZIP_URL.Split('/')[-1]) /qb- /norestart" -Wait }
|
||||
if ($7zInstalled -ne $true) {
|
||||
Write-Host "Removing 7-Zip..."
|
||||
Start-Process -FilePath $env:SystemRoot\System32\msiexec.exe -ArgumentList "/x $7zDownload /qb- /norestart" -Wait
|
||||
Remove-Item $7zDownload
|
||||
}
|
||||
|
||||
# Install Bootcamp and use MST if specified (I uploaded one that I had to use to fix the latest ESD on an iMac14,1)
|
||||
if ($Install) {
|
||||
|
|
Loading…
Reference in a new issue