fleet/ee/maintained-apps/inputs/winget/scripts/airtame_uninstall.ps1
Allen Houchins a5731d540d
Add Airtame as a macOS and Windows FMA (#37248)
This pull request adds support for the Airtame application on both macOS
and Windows platforms. It introduces metadata, installation and
uninstallation scripts, and icon support for Airtame, making it
available in the maintained apps catalog and ensuring it displays
correctly in the frontend.

**Airtame Application Support:**

- Added input metadata for Airtame for both Homebrew (macOS) and Winget
(Windows) in `airtame.json` files, specifying installer formats,
identifiers, and categories.
[[1]](diffhunk://#diff-448b5795b8fb5f9487415e1d64f1fca6b57fa434b4d78ce452f732a9ffda479eR1-R8)
[[2]](diffhunk://#diff-146d9ec4238b454a4f86989b068060760f2d70523aed34b68f935d493b3f23dbR1-R10)
- Added output definitions for Airtame in `darwin.json` and
`windows.json`, including version info, installation/uninstallation
scripts, installer URLs, SHA256 hashes, and verification queries.
[[1]](diffhunk://#diff-0c571f0352dfef93766b985359e9f1ab34ed36284fd701429edc5b733be5aef6R1-R21)
[[2]](diffhunk://#diff-23e19ef30503f3c50c25a06132b64d193ecfd70698e2a4ae433dbde55148b6f0R1-R22)
- Updated `apps.json` to include Airtame entries for both macOS and
Windows, with appropriate descriptions and unique identifiers.

**Frontend/Icon Integration:**

- Added a new React icon component for Airtame in `Airtame.tsx`, using a
base64-encoded image.
- Registered the Airtame icon in the icon index and mapped it in
`SOFTWARE_NAME_TO_ICON_MAP` for proper display in the software catalog.
[[1]](diffhunk://#diff-628095892e1d16090be1db6cc1a5c9cebc65248c32a8b1312385394818f2907bR12)
[[2]](diffhunk://#diff-628095892e1d16090be1db6cc1a5c9cebc65248c32a8b1312385394818f2907bR233)
2025-12-14 21:45:47 -06:00

98 lines
3 KiB
PowerShell

# Fleet extracts name from installer (EXE) and saves it to PACKAGE_ID
# variable
$softwareName = $PACKAGE_ID
# It is recommended to use exact software name here if possible to avoid
# uninstalling unintended software.
$softwareNameLike = "*Airtame*"
# NSIS installers require /S flag for silent uninstall
$uninstallArgs = "/S"
$paths = @(
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
)
$exitCode = 0
try {
[array]$uninstallKeys = Get-ChildItem `
-Path $paths `
-ErrorAction SilentlyContinue |
ForEach-Object { Get-ItemProperty $_.PSPath }
$foundUninstaller = $false
foreach ($key in $uninstallKeys) {
# If needed, add -notlike to the comparison to exclude certain similar
# software
if ($key.DisplayName -like $softwareNameLike) {
$foundUninstaller = $true
# Get the uninstall command. Some uninstallers do not include
# 'QuietUninstallString' and require a flag to run silently.
$uninstallCommand = if ($key.QuietUninstallString) {
$key.QuietUninstallString
} else {
$key.UninstallString
}
# The uninstall command may contain command and args, like:
# "C:\Program Files\Software\uninstall.exe" /S
# Split the command and args
$splitArgs = $uninstallCommand.Split('"')
if ($splitArgs.Length -gt 1) {
if ($splitArgs.Length -eq 3) {
$existingArgs = $splitArgs[2].Trim()
# Append /S if not already present
if ($existingArgs -notmatch '\b/S\b') {
$uninstallArgs = "$existingArgs /S".Trim()
} else {
$uninstallArgs = $existingArgs
}
} elseif ($splitArgs.Length -gt 3) {
Throw `
"Uninstall command contains multiple quoted strings. " +
"Please update the uninstall script.`n" +
"Uninstall command: $uninstallCommand"
}
$uninstallCommand = $splitArgs[1]
} else {
# No quotes, check if /S is already in the command
if ($uninstallCommand -notmatch '\b/S\b') {
$uninstallArgs = "/S"
} else {
$uninstallArgs = ""
}
}
Write-Host "Uninstall command: $uninstallCommand"
Write-Host "Uninstall args: $uninstallArgs"
$processOptions = @{
FilePath = $uninstallCommand
PassThru = $true
Wait = $true
}
if ($uninstallArgs -ne '') {
$processOptions.ArgumentList = $uninstallArgs
}
$process = Start-Process @processOptions
$exitCode = $process.ExitCode
Write-Host "Uninstall exit code: $exitCode"
break
}
}
if (-not $foundUninstaller) {
Write-Host "Uninstall entry not found for $softwareNameLike"
Exit 0
}
Exit $exitCode
} catch {
Write-Host "Error: $_"
Exit 1
}