-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2161 from brogers5/tortoisegit-skip-install-of-cu…
…rrent-version
- Loading branch information
Showing
3 changed files
with
47 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
$ErrorActionPreference = 'Stop' | ||
|
||
$toolsPath = Split-Path $MyInvocation.MyCommand.Definition | ||
. $toolsPath\helpers.ps1 | ||
|
||
$filePath32 = Resolve-Path "$toolsPath\*_x32.msi" | ||
$filePath64 = Resolve-Path "$toolsPath\*_x64.msi" | ||
[version] $softwareVersion = '2.14.0.0' | ||
$installedVersion = Get-InstalledVersion | ||
|
||
$installFile = if ((Get-OSArchitectureWidth 64) -and $env:chocolateyForceX86 -ne 'true') { | ||
Write-Host "Installing 64 bit version" | ||
$filePath64 | ||
} else { | ||
Write-Host "Installing 32 bit version" | ||
$filePath32 | ||
if ($installedVersion -and ($softwareVersion -eq $installedVersion) -and !$env:ChocolateyForce) { | ||
Write-Host "TortoiseGit v$installedVersion is already installed - skipping download and installation." | ||
} | ||
else { | ||
$packageArgs = @{ | ||
PackageName = 'tortoisegit' | ||
FileType = 'msi' | ||
SoftwareName = 'TortoiseGit*' | ||
File = "$toolsPath\" | ||
File64 = "$toolsPath\" | ||
SilentArgs = '/quiet /qn /norestart REBOOT=ReallySuppress' | ||
ValidExitCodes = @(0, 3010) | ||
} | ||
|
||
$packageArgs = @{ | ||
PackageName = 'tortoisegit' | ||
FileType = 'msi' | ||
SoftwareName = 'TortoiseGit*' | ||
File = $installFile | ||
SilentArgs = '/quiet /qn /norestart REBOOT=ReallySuppress' | ||
ValidExitCodes = @(0,3010) | ||
Install-ChocolateyInstallPackage @packageArgs | ||
} | ||
|
||
Install-ChocolateyInstallPackage @packageArgs | ||
|
||
# Lets remove the installer as there is no more need for it. | ||
Remove-Item -Force $filePath32 -ea 0 | ||
Remove-Item -Force $filePath64 -ea 0 | ||
Remove-Item -Force "$toolsPath\*.msi" -ea 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function Get-InstalledVersion() { | ||
[array] $keys = Get-UninstallRegistryKey -SoftwareName 'TortoiseGit*' | ||
|
||
if ($keys.Length -ge 1) { | ||
return [version] ($keys[0].DisplayVersion) | ||
} | ||
|
||
return $null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters