mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Automated ingestion of latest Fleet-maintained app data. Co-authored-by: mostlikelee <16102903+mostlikelee@users.noreply.github.com>
21 lines
5.9 KiB
JSON
21 lines
5.9 KiB
JSON
{
|
|
"versions": [
|
|
{
|
|
"version": "6.4.2",
|
|
"queries": {
|
|
"exists": "SELECT 1 FROM programs WHERE name = 'Telegram Desktop' AND publisher = 'Telegram FZ-LLC';"
|
|
},
|
|
"installer_url": "https://td.telegram.org/tx64/tsetup-x64.6.4.2.exe",
|
|
"install_script_ref": "0b88a95e",
|
|
"uninstall_script_ref": "42311f1b",
|
|
"sha256": "e092ffc4cb63c80b9b36ffe3dc68ac232a93737e0e1b998f8f660dd542c3ee7e",
|
|
"default_categories": [
|
|
"Communication"
|
|
]
|
|
}
|
|
],
|
|
"refs": {
|
|
"0b88a95e": "# Learn more about .exe install scripts:\n# http://fleetdm.com/learn-more-about/exe-install-scripts\n\n$exeFilePath = \"${env:INSTALLER_PATH}\"\n\ntry {\n # Verify installer file exists\n if (-not (Test-Path $exeFilePath)) {\n Write-Host \"Error: Installer file not found at: $exeFilePath\"\n Exit 1\n }\n\n Write-Host \"Installing Telegram Desktop from: $exeFilePath\"\n \n # Add arguments to install silently\n # Telegram uses an Inno Setup-based installer\n # Try /VERYSILENT first (more reliable for Inno Setup), fall back to /S if needed\n $processOptions = @{\n FilePath = \"$exeFilePath\"\n ArgumentList = \"/VERYSILENT /SUPPRESSMSGBOXES /NORESTART\"\n PassThru = $true\n Wait = $true\n NoNewWindow = $true\n }\n \n # Start process and track exit code\n Write-Host \"Starting installation with arguments: $($processOptions.ArgumentList)\"\n $process = Start-Process @processOptions\n \n if ($null -eq $process) {\n Write-Host \"Error: Failed to start installer process\"\n Exit 1\n }\n \n $exitCode = $process.ExitCode\n \n # Prints the exit code\n Write-Host \"Install exit code: $exitCode\"\n \n if ($exitCode -ne 0) {\n Write-Host \"Warning: Installer exited with non-zero code: $exitCode\"\n # Try with /S as fallback for user-scope installs\n Write-Host \"Attempting fallback with /S switch...\"\n $fallbackOptions = @{\n FilePath = \"$exeFilePath\"\n ArgumentList = \"/S\"\n PassThru = $true\n Wait = $true\n NoNewWindow = $true\n }\n $fallbackProcess = Start-Process @fallbackOptions\n if ($null -ne $fallbackProcess) {\n $fallbackExitCode = $fallbackProcess.ExitCode\n Write-Host \"Fallback install exit code: $fallbackExitCode\"\n Exit $fallbackExitCode\n }\n }\n \n Exit $exitCode\n\n} catch {\n Write-Host \"Error: $_\"\n Write-Host \"Error details: $($_.Exception.Message)\"\n if ($_.Exception.InnerException) {\n Write-Host \"Inner exception: $($_.Exception.InnerException.Message)\"\n }\n Exit 1\n}\n",
|
|
"42311f1b": "# Attempts to locate Telegram Desktop's uninstaller from registry and execute it silently\n\n$displayName = \"Telegram Desktop\"\n$publisher = \"Telegram FZ-LLC\"\n\n$paths = @(\n 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall',\n 'HKCU:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall'\n)\n\n$uninstall = $null\nforeach ($p in $paths) {\n $items = Get-ItemProperty \"$p\\*\" -ErrorAction SilentlyContinue | Where-Object {\n $_.DisplayName -and ($_.DisplayName -eq $displayName -or $_.DisplayName -like \"$displayName*\") -and ($publisher -eq \"\" -or $_.Publisher -eq $publisher)\n }\n if ($items) { $uninstall = $items | Select-Object -First 1; break }\n}\n\nif (-not $uninstall -or -not $uninstall.UninstallString) {\n Write-Host \"Uninstall entry not found\"\n Exit 0\n}\n\n# Kill any running Telegram processes before uninstalling\nStop-Process -Name \"Telegram\" -Force -ErrorAction SilentlyContinue\n\n$uninstallString = $uninstall.UninstallString\n$exePath = \"\"\n$arguments = \"\"\n\n# Parse the uninstall string to extract executable path and existing arguments\n# Handles both quoted and unquoted paths\nif ($uninstallString -match '^\"([^\"]+)\"(.*)') {\n $exePath = $matches[1]\n $arguments = $matches[2].Trim()\n} elseif ($uninstallString -match '^([^\\s]+)(.*)') {\n $exePath = $matches[1]\n $arguments = $matches[2].Trim()\n} else {\n Write-Host \"Error: Could not parse uninstall string: $uninstallString\"\n Exit 1\n}\n\n# Build argument list array, preserving existing arguments and adding /S for silent (Inno Setup)\n$baseArgumentList = @()\nif ($arguments -ne '') {\n # Split existing arguments and add them\n $baseArgumentList += $arguments -split '\\s+'\n}\n\nfunction Invoke-Uninstall {\n param(\n [string]$Executable,\n [array]$BaseArgs,\n [array]$ExtraArgs\n )\n\n $finalArgs = @()\n if ($BaseArgs) {\n $finalArgs += $BaseArgs\n }\n if ($ExtraArgs) {\n $finalArgs += $ExtraArgs\n }\n\n Write-Host \"Uninstall executable: $Executable\"\n Write-Host \"Uninstall arguments: $($finalArgs -join ' ')\"\n\n try {\n $processOptions = @{\n FilePath = $Executable\n ArgumentList = $finalArgs\n NoNewWindow = $true\n PassThru = $true\n Wait = $true\n WorkingDirectory = (Split-Path -Path $Executable -Parent)\n }\n\n $process = Start-Process @processOptions\n return $process.ExitCode\n } catch {\n Write-Host \"Error running uninstaller: $_\"\n return 1\n }\n}\n\n$preferredSilentArgs = @(\"/VERYSILENT\", \"/SUPPRESSMSGBOXES\", \"/NORESTART\")\n$exitCode = Invoke-Uninstall -Executable $exePath -BaseArgs $baseArgumentList -ExtraArgs $preferredSilentArgs\n\nif ($exitCode -ne 0) {\n Write-Host \"Preferred silent uninstall failed with exit code $exitCode. Retrying with /S.\"\n $exitCode = Invoke-Uninstall -Executable $exePath -BaseArgs $baseArgumentList -ExtraArgs @(\"/S\")\n}\n\nExit $exitCode\n"
|
|
}
|
|
}
|