From b1d70b54dfc351fab2922cf624f1772a7ec319de Mon Sep 17 00:00:00 2001 From: Alessandro Riolo Date: Wed, 7 Jun 2023 21:01:40 +0100 Subject: [PATCH 1/3] Re-Update to partially fix 31 This fix #31 (probably also #32). The fix is partial because it only applies to the x64 version. I tested in 4 devices, 2 updates and 2 install. It is likely something similar could fix also the x86 version, if affected, but I don't have how to test that. --- package/tools/chocolateyinstall.ps1 | 46 ++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/package/tools/chocolateyinstall.ps1 b/package/tools/chocolateyinstall.ps1 index 36a73d4..c2f48a3 100644 --- a/package/tools/chocolateyinstall.ps1 +++ b/package/tools/chocolateyinstall.ps1 @@ -1,15 +1,23 @@ +$LicensedCommandsRegistered = Get-Command "Invoke-ValidateChocolateyLicense" -EA SilentlyContinue +if (!$LicensedCommandsRegistered) { + Write-Warning "Package Requires Commercial License - Installation cannot continue as Package Internalizer use require endpoints to be licensed with Chocolatey Licensed Extension v3.0.0+ (chocolatey.extension). Please see error below for details and correction instructions." + throw "This package requires a commercial edition of Chocolatey as it was built/internalized with commercial features. Please install the license and install/upgrade to Chocolatey Licensed Extension v3.0.0+ as per https://docs.chocolatey.org/en-us/licensed-extension/setup." +} + +Invoke-ValidateChocolateyLicense -RequiredLicenseTypes @('Business','ManagedServiceProvider') + $ErrorActionPreference = 'Stop' $DisplayName = 'Adobe Acrobat Reader DC MUI' -$MUIurl = 'https://ardownload2.adobe.com/pub/adobe/reader/win/AcrobatDC/1500720033/AcroRdrDC1500720033_MUI.exe' -$MUIurl64 = 'https://ardownload2.adobe.com/pub/adobe/acrobat/win/AcrobatDC/2300120093/AcroRdrDCx642300120093_MUI.exe' +$MUIurl = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\AcroRdrDC1500720033_MUI.exe" +$MUIurl64 = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\AcroRdrDCx642300120093_MUI.exe" $MUIchecksum = 'dfc4b3c70b7ecaeb40414c9d6591d8952131a5fffa0c0f5964324af7154f8111' $MUIchecksum64 = '69a3b05f4b90445024963af79b37520f26b289a8979894a5c9d8ef9c290c2ee4' -$MUImspURL = 'https://ardownload2.adobe.com/pub/adobe/reader/win/AcrobatDC/2300320201/AcroRdrDCUpd2300320201_MUI.msp' -$MUImspURL64 = 'https://ardownload2.adobe.com/pub/adobe/acrobat/win/AcrobatDC/2300320201/AcroRdrDCx64Upd2300320201_MUI.msp' +$MUImspURL = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\AcroRdrDCUpd2300320201_MUI.msp" +$MUImspURL64 = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\AcroRdrDCx64Upd2300320201_MUI.msp" $MUImspChecksum = '0b42a8d5fcabc10b7badac93a9ab1095efa375d6dfa74c9bb9ee40fbb1cd7d919498551c4bae16373e9ea8bcf16085abf8c4b1cdd19c3baf503df15aa8568a0e' -$MUImspChecksum64 = "2cbf05ce6526c617c77ae30c5720485cdf0596d1fb3f5941c541d384ec94722b34942b2a5d2c95cd5d4c318a784e631be40eb948954c5700a4110f30b937cc7b" +$MUImspChecksum64 = '3BD1B3EF7B9EE6BB5871E5A7035650E1C3323647A546FE78F0D482038B2AD0BC3114DC141C0EE98AC355523422A33E5A0AAB02BF0D0CB90F527D1A4E9D61F017' $MUIinstalled = $false $UpdateOnly = $false @@ -172,7 +180,7 @@ $DownloadArgs = @{ checksumType = 'SHA512' GetOriginalFileName = $true } -$mspPath = Get-ChocolateyWebFile @DownloadArgs +$mspPath = Get-ChocolateyWebFileCmdlet @DownloadArgs if ($UpdateOnly) { $UpdateArgs = @{ @@ -201,7 +209,7 @@ else { checksumType = 'SHA256' GetOriginalFileName = $true } - $MUIexePath = Get-ChocolateyWebFile @DownloadArgs + $MUIexePath = Get-ChocolateyWebFileCmdlet @DownloadArgs $packageArgsEXE = @{ packageName = "$env:ChocolateyPackageName (installer)" @@ -212,7 +220,7 @@ else { " /L*v `"$env:TEMP\$env:chocolateyPackageName.$env:chocolateyPackageVersion.Install.log`"" validExitCodes = @(0, 1000, 1101, 1603) } - $exitCode = Install-ChocolateyInstallPackage @packageArgsEXE + $exitCode = Install-ChocolateyInstallPackageCmdlet @packageArgsEXE if ($exitCode -eq 1603) { Write-Warning "For code 1603, Adobe recommends to 'shut down Microsoft Office and all web browsers' and try again." @@ -222,6 +230,28 @@ else { } } +# verify the 64 bit installation, if the update is not found attempt a second update +[array]$32_or_64bitsoftware = get-itemproperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' +[array]$32_on_64bitsoftware = get-itemproperty 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' +$installedProducts = [system.linq.enumerable]::union([object[]]$32_or_64bitsoftware, [object[]]$32_on_64bitsoftware) +if (($installedProducts | Where-Object {($_.DisplayName -contains 'Adobe Acrobat (64-bit)') -and ($_.DisplayVersion.replace('.', '') -eq $UpdaterVersion)} | measure).Count -lt 1){ + $UpdateArgs = @{ + Statements = "/p `"$mspPath`" /norestart /quiet ALLUSERS=1 EULA_ACCEPT=YES $options" + + " /L*v `"$env:TEMP\$env:chocolateyPackageName.$env:chocolateyPackageVersion.Reupdate.log`"" + ExetoRun = 'msiexec.exe' + validExitCodes = @(0, 1603) + } + $exitCode = Start-ChocolateyProcessAsAdmin @UpdateArgs + + if ($exitCode -eq 1603) { + Write-Warning "For code 1603, Adobe recommends to 'shut down Microsoft Office and all web browsers' and try again." + Write-Warning 'The update log should provide more details about the encountered issue:' + Write-Warning " $env:TEMP\$env:chocolateyPackageName.$env:chocolateyPackageVersion.Update.log" + Throw "Patching of $env:ChocolateyPackageName to the latest version was unsuccessful." + } +} + + if ($PackageParameters.NoUpdates -or $UpdateMode -lt 2) { Unregister-ScheduledTask 'Adobe Acrobat Update Task' -Confirm:$false -ErrorAction SilentlyContinue } From 2ab75dd721e3dd315efae981bfcbdb65848a5941 Mon Sep 17 00:00:00 2001 From: Alessandro Riolo Date: Wed, 7 Jun 2023 21:09:16 +0100 Subject: [PATCH 2/3] Removed internalised bits I copied this from an internalised package, this is to remove the non community related bits --- package/tools/chocolateyinstall.ps1 | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/package/tools/chocolateyinstall.ps1 b/package/tools/chocolateyinstall.ps1 index c2f48a3..f49c140 100644 --- a/package/tools/chocolateyinstall.ps1 +++ b/package/tools/chocolateyinstall.ps1 @@ -1,23 +1,15 @@ -$LicensedCommandsRegistered = Get-Command "Invoke-ValidateChocolateyLicense" -EA SilentlyContinue -if (!$LicensedCommandsRegistered) { - Write-Warning "Package Requires Commercial License - Installation cannot continue as Package Internalizer use require endpoints to be licensed with Chocolatey Licensed Extension v3.0.0+ (chocolatey.extension). Please see error below for details and correction instructions." - throw "This package requires a commercial edition of Chocolatey as it was built/internalized with commercial features. Please install the license and install/upgrade to Chocolatey Licensed Extension v3.0.0+ as per https://docs.chocolatey.org/en-us/licensed-extension/setup." -} - -Invoke-ValidateChocolateyLicense -RequiredLicenseTypes @('Business','ManagedServiceProvider') - $ErrorActionPreference = 'Stop' $DisplayName = 'Adobe Acrobat Reader DC MUI' -$MUIurl = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\AcroRdrDC1500720033_MUI.exe" -$MUIurl64 = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\AcroRdrDCx642300120093_MUI.exe" +$MUIurl = 'https://ardownload2.adobe.com/pub/adobe/reader/win/AcrobatDC/1500720033/AcroRdrDC1500720033_MUI.exe' +$MUIurl64 = 'https://ardownload2.adobe.com/pub/adobe/acrobat/win/AcrobatDC/2300120093/AcroRdrDCx642300120093_MUI.exe' $MUIchecksum = 'dfc4b3c70b7ecaeb40414c9d6591d8952131a5fffa0c0f5964324af7154f8111' $MUIchecksum64 = '69a3b05f4b90445024963af79b37520f26b289a8979894a5c9d8ef9c290c2ee4' -$MUImspURL = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\AcroRdrDCUpd2300320201_MUI.msp" -$MUImspURL64 = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)\files\AcroRdrDCx64Upd2300320201_MUI.msp" +$MUImspURL = 'https://ardownload2.adobe.com/pub/adobe/reader/win/AcrobatDC/2300320201/AcroRdrDCUpd2300320201_MUI.msp' +$MUImspURL64 = 'https://ardownload2.adobe.com/pub/adobe/acrobat/win/AcrobatDC/2300320201/AcroRdrDCx64Upd2300320201_MUI.msp' $MUImspChecksum = '0b42a8d5fcabc10b7badac93a9ab1095efa375d6dfa74c9bb9ee40fbb1cd7d919498551c4bae16373e9ea8bcf16085abf8c4b1cdd19c3baf503df15aa8568a0e' -$MUImspChecksum64 = '3BD1B3EF7B9EE6BB5871E5A7035650E1C3323647A546FE78F0D482038B2AD0BC3114DC141C0EE98AC355523422A33E5A0AAB02BF0D0CB90F527D1A4E9D61F017' +$MUImspChecksum64 = "3BD1B3EF7B9EE6BB5871E5A7035650E1C3323647A546FE78F0D482038B2AD0BC3114DC141C0EE98AC355523422A33E5A0AAB02BF0D0CB90F527D1A4E9D61F017" $MUIinstalled = $false $UpdateOnly = $false @@ -180,7 +172,7 @@ $DownloadArgs = @{ checksumType = 'SHA512' GetOriginalFileName = $true } -$mspPath = Get-ChocolateyWebFileCmdlet @DownloadArgs +$mspPath = Get-ChocolateyWebFile @DownloadArgs if ($UpdateOnly) { $UpdateArgs = @{ @@ -209,7 +201,7 @@ else { checksumType = 'SHA256' GetOriginalFileName = $true } - $MUIexePath = Get-ChocolateyWebFileCmdlet @DownloadArgs + $MUIexePath = Get-ChocolateyWebFile @DownloadArgs $packageArgsEXE = @{ packageName = "$env:ChocolateyPackageName (installer)" @@ -220,7 +212,7 @@ else { " /L*v `"$env:TEMP\$env:chocolateyPackageName.$env:chocolateyPackageVersion.Install.log`"" validExitCodes = @(0, 1000, 1101, 1603) } - $exitCode = Install-ChocolateyInstallPackageCmdlet @packageArgsEXE + $exitCode = Install-ChocolateyInstallPackage @packageArgsEXE if ($exitCode -eq 1603) { Write-Warning "For code 1603, Adobe recommends to 'shut down Microsoft Office and all web browsers' and try again." From 708a4729d3f1585c4ab95c82a853056f5ef2cb98 Mon Sep 17 00:00:00 2001 From: Alessandro Riolo Date: Thu, 8 Jun 2023 12:28:05 +0100 Subject: [PATCH 3/3] Includes Adobe Acrobat Reader This is to update also on computers with DisplayName set to Adobe Acrobat Reader. This was successfully tested in 200 computers. --- package/tools/chocolateyinstall.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/tools/chocolateyinstall.ps1 b/package/tools/chocolateyinstall.ps1 index 0acdb80..b6d5cf3 100644 --- a/package/tools/chocolateyinstall.ps1 +++ b/package/tools/chocolateyinstall.ps1 @@ -226,7 +226,7 @@ else { [array]$32_or_64bitsoftware = get-itemproperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' [array]$32_on_64bitsoftware = get-itemproperty 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' $installedProducts = [system.linq.enumerable]::union([object[]]$32_or_64bitsoftware, [object[]]$32_on_64bitsoftware) -if (($installedProducts | Where-Object {($_.DisplayName -contains 'Adobe Acrobat (64-bit)') -and ($_.DisplayVersion.replace('.', '') -eq $UpdaterVersion)} | measure).Count -lt 1){ +if (($installedProducts | Where-Object {(($_.DisplayName -contains 'Adobe Acrobat (64-bit)') -or ($_.DisplayName -contains 'Adobe Acrobat Reader')) -and ($_.DisplayVersion.replace('.', '') -eq $UpdaterVersion)} | measure).Count -lt 1){ $UpdateArgs = @{ Statements = "/p `"$mspPath`" /norestart /quiet ALLUSERS=1 EULA_ACCEPT=YES $options" + " /L*v `"$env:TEMP\$env:chocolateyPackageName.$env:chocolateyPackageVersion.Reupdate.log`""