Add GitHub Desktop as a Windows FMA (#36444)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/fleetdm/fleet/v4/orbit/pkg/constant"
|
||||
@@ -75,9 +76,15 @@ func appExists(ctx context.Context, logger kitlog.Logger, appName, _, appVersion
|
||||
result.Name = software.Name
|
||||
|
||||
level.Info(logger).Log("msg", fmt.Sprintf("Found app: '%s' at %s, Version: %s", result.Name, result.InstallLocation, result.Version))
|
||||
// Check exact match first
|
||||
if result.Version == appVersion {
|
||||
return true, nil
|
||||
}
|
||||
// Check if found version starts with expected version (handles suffixes like ".0")
|
||||
// This handles cases where the app version is "3.5.4.0" but expected is "3.5.4"
|
||||
if strings.HasPrefix(result.Version, appVersion+".") {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "GitHub Desktop",
|
||||
"slug": "github-desktop/windows",
|
||||
"package_identifier": "GitHub.GitHubDesktop",
|
||||
"unique_identifier": "GitHub Desktop",
|
||||
"installer_arch": "x64",
|
||||
"installer_type": "msi",
|
||||
"installer_scope": "machine",
|
||||
"default_categories": ["Developer tools"]
|
||||
}
|
||||
@@ -309,6 +309,13 @@
|
||||
"unique_identifier": "Mozilla Firefox (x64 en-US)",
|
||||
"description": "Firefox is a powerful, open-source web browser built for speed, privacy, and customization."
|
||||
},
|
||||
{
|
||||
"name": "GitHub Desktop",
|
||||
"slug": "github-desktop/windows",
|
||||
"platform": "windows",
|
||||
"unique_identifier": "GitHub Desktop",
|
||||
"description": "GitHub Desktop is a desktop client for GitHub repositories."
|
||||
},
|
||||
{
|
||||
"name": "GitHub Desktop",
|
||||
"slug": "github/darwin",
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"version": "3.5.4",
|
||||
"queries": {
|
||||
"exists": "SELECT 1 FROM programs WHERE name = 'GitHub Desktop' AND publisher = 'GitHub, Inc.';"
|
||||
},
|
||||
"installer_url": "https://desktop.githubusercontent.com/releases/3.5.4-9dfb8d8d/GitHubDesktopSetup-x64.msi",
|
||||
"install_script_ref": "8959087b",
|
||||
"uninstall_script_ref": "b336b955",
|
||||
"sha256": "ecf65cb2074b5b4be2f1c7e087de7551d38d57fdefc68a6c0697e708d6cf8eab",
|
||||
"default_categories": [
|
||||
"Developer tools"
|
||||
],
|
||||
"upgrade_code": "{00D8E2EE-13EA-5BEB-87F0-70EFC46A7D4A}"
|
||||
}
|
||||
],
|
||||
"refs": {
|
||||
"8959087b": "$logFile = \"${env:TEMP}/fleet-install-software.log\"\n\ntry {\n\n$installProcess = Start-Process msiexec.exe `\n -ArgumentList \"/quiet /norestart /lv ${logFile} /i `\"${env:INSTALLER_PATH}`\"\" `\n -PassThru -Verb RunAs -Wait\n\nGet-Content $logFile -Tail 500\n\nExit $installProcess.ExitCode\n\n} catch {\n Write-Host \"Error: $_\"\n Exit 1\n}\n",
|
||||
"b336b955": "# Fleet uninstalls app by finding all related product codes for the specified upgrade code\n$inst = New-Object -ComObject \"WindowsInstaller.Installer\"\n$timeoutSeconds = 300 # 5 minute timeout per product\n\nforeach ($product_code in $inst.RelatedProducts(\"{00D8E2EE-13EA-5BEB-87F0-70EFC46A7D4A}\")) {\n $process = Start-Process msiexec -ArgumentList @(\"/quiet\", \"/x\", $product_code, \"/norestart\") -PassThru\n \n # Wait for process with timeout\n $completed = $process.WaitForExit($timeoutSeconds * 1000)\n \n if (-not $completed) {\n Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue\n Exit 1603 # ERROR_UNINSTALL_FAILURE\n }\n \n # If the uninstall failed, bail\n if ($process.ExitCode -ne 0) {\n Write-Output \"Uninstall for $($product_code) exited $($process.ExitCode)\"\n Exit $process.ExitCode\n }\n}\n\n# All uninstalls succeeded; exit success\nExit 0\n"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Reference in New Issue
Block a user