소스 검색

(#627) Chocolatey install 32 bit if 64 bit version is not installed

TheCakeIsNaOH 4 년 전
부모
커밋
92288a6af0
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      chocolatey/tools/chocolateyinstall.ps1

+ 14 - 0
chocolatey/tools/chocolateyinstall.ps1

@@ -12,6 +12,20 @@ $packageArgs = @{
     validExitCodes = @(0)
 }
 
+#If only the 32 bit version is installed, upgrade that instead of installing the 64 bit version
+if ((Get-OSArchitectureWidth -compare 64) -and ($env:chocolateyForceX86 -ne $true)) {
+    Write-Host -ForegroundColor green "Checking for 32 bit versions of SyncTrayzor"
+    if (Get-UninstallRegistryKey -SoftwareName 'SyncTrayzor (x86)*') {
+        if (Get-UninstallRegistryKey -SoftwareName 'SyncTrayzor (x64)*') {
+            Write-Host -ForegroundColor green "Both 32 and 64 bit SyncTrayzor found, upgrading 64 bit"
+        } else {
+            Write-Host -ForegroundColor green "32 bit SyncTrayzor found, upgrading"
+            #null out the 64 bit file parameter, so only the 32 bit file is available to install
+            $packageArgs['file64'] = $null
+        }
+    }
+}
+
 Install-ChocolateyInstallPackage @packageArgs
 
 Remove-Item -Force -ea 0 $file, $file64