From 1051ac9df84a67325637a9eb837739b9db048f55 Mon Sep 17 00:00:00 2001 From: uncore Date: Sun, 23 Nov 2025 14:52:22 -0700 Subject: [PATCH] add Chocolatey package and uninstall scripts for iDescriptor --- choco/idescriptor.nuspec | 26 ++++++++++++++++++++ choco/tools/chocolateyinstall.ps1 | 17 +++++++++++++ choco/tools/chocolateyuninstall.ps1 | 38 +++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 choco/idescriptor.nuspec create mode 100644 choco/tools/chocolateyinstall.ps1 create mode 100644 choco/tools/chocolateyuninstall.ps1 diff --git a/choco/idescriptor.nuspec b/choco/idescriptor.nuspec new file mode 100644 index 0000000..d2c8e68 --- /dev/null +++ b/choco/idescriptor.nuspec @@ -0,0 +1,26 @@ + + + + idescriptor + 0.1.0 + iDescriptor + The iDescriptor Project contributors + iDescriptor + https://github.com/iDescriptor/iDescriptor/blob/main/LICENSE + https://github.com/iDescriptor/iDescriptor + + https://raw.githubusercontent.com/iDescriptor/iDescriptor/main/resources/icons/app-icon/icon.png + false + A free, open-source, and cross-platform iDevice management tool written in C++. + Cross platform, open-source and free idevice management tool written in C++. + https://github.com/iDescriptor/iDescriptor/releases/tag/v0.1.0 + idescriptor idevice apple ios ipad iphone admin foss cross-platform + https://github.com/iDescriptor/iDescriptor + https://github.com/iDescriptor/iDescriptor + https://github.com/iDescriptor/iDescriptor/blob/main/README.md + https://github.com/iDescriptor/iDescriptor/issues + + + + + \ No newline at end of file diff --git a/choco/tools/chocolateyinstall.ps1 b/choco/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000..9a838af --- /dev/null +++ b/choco/tools/chocolateyinstall.ps1 @@ -0,0 +1,17 @@ +$ErrorActionPreference = 'Stop' +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$url = 'https://github.com/iDescriptor/iDescriptor/releases/download/v0.1.0/iDescriptor-v0.1.0-Windows_x86_64.msi' +$checksum = 'bb803b3e4cfaa75068c28d15808284ad7d3400ed2bb7e98cdf1a2223d0543b6e' +$checksumType = 'sha256' + +$packageArgs = @{ + packageName = $env:ChocolateyPackageName + fileType = 'msi' + url = $url + checksum = $checksum + checksumType = $checksumType + silentArgs = "/quiet /norestart" + validExitCodes = @(0, 3010, 1641) +} + +Install-ChocolateyPackage @packageArgs \ No newline at end of file diff --git a/choco/tools/chocolateyuninstall.ps1 b/choco/tools/chocolateyuninstall.ps1 new file mode 100644 index 0000000..580b08b --- /dev/null +++ b/choco/tools/chocolateyuninstall.ps1 @@ -0,0 +1,38 @@ +$ErrorActionPreference = 'Stop' + +$displayNamePattern = 'iDescriptor*' +Write-Host "Searching for installed application: '$displayNamePattern'" + +$registryKey = Get-ItemProperty -Path @( + 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*', + 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' +) -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -like $displayNamePattern } | Select-Object -First 1 + +if ($registryKey) { + $productCode = $registryKey.PSChildName + $foundName = $registryKey.DisplayName + Write-Host "Found: '$foundName' with Product Code: '$productCode'" + Write-Host "Calling msiexec directly to uninstall..." + + # Build the arguments for msiexec.exe + $uninstallArgs = "/x `"$productCode`" /qn /norestart" + Write-Host "Running: msiexec.exe $uninstallArgs" + + # Start the uninstaller process and wait for it to finish + $process = Start-Process "msiexec.exe" -ArgumentList $uninstallArgs -Wait -PassThru + $exitCode = $process.ExitCode + + Write-Host "msiexec.exe finished with exit code: $exitCode" + + # Check if the exit code indicates success (0) or that a reboot is required (3010) + $validExitCodes = @(0, 3010, 1641) + if ($validExitCodes -notcontains $exitCode) { + throw "Uninstallation failed with exit code $exitCode." + } else { + Write-Host "Uninstallation successful." + } + +} else { + # If the key is not found, it might have been uninstalled already. Don't error. + Write-Warning "Could not find a product starting with '$displayNamePattern' in the registry. The application may have already been uninstalled." +} \ No newline at end of file