fleet/ee/maintained-apps/inputs/homebrew/scripts/dbeaverultimate-install.sh
Allen Houchins 3c63c81331
Add multiple macOS FMAs (#37036)
This pull request adds support for several new macOS applications to the
maintained apps system. It introduces metadata and installer/uninstaller
scripts for each app and updates the main apps output file to include
them with descriptions and platform information. The most significant
changes are grouped below.

**New Application Integrations:**

* Added support for `balenaEtcher`, including metadata
(`balenaetcher.json`), installer/uninstaller scripts, and entry in
`apps.json` with description.
[[1]](diffhunk://#diff-929134bb1d28b55d168f4dc3e35f9f08a0d1e45d46bcf6f4183f99f79428433cR1-R8)
[[2]](diffhunk://#diff-8d03c90ab45b7ed733912e7ba94c2601b8a80047896ed6812dbacb91d538b2edR1-R21)
[[3]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R165-R171)
* Added support for `CleanMyMac`, including metadata
(`cleanmymac.json`), installer/uninstaller scripts, and entry in
`apps.json` with description.
[[1]](diffhunk://#diff-a3148bf2381a87133a9daf9bb676da3561b68458fac4a8bf5a13ee4b2ca1e6a0R1-R8)
[[2]](diffhunk://#diff-3c53d70fb16a8d91fddbe12c90115a282738652ce25e082795baff88d67cb4afR1-R21)
[[3]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R305-R318)
* Added support for `CleanShot X`, `Clockify Desktop`, `CotEditor`,
`DBeaver` (Community, Enterprise, Lite, Ultimate), `DeepL`, and
`Dialpad` with metadata files and entries in `apps.json`.
[[1]](diffhunk://#diff-371522e9c06a5ea355102f316203a3e6c9227337e418fa477c6a70e04f558da4R1-R8)
[[2]](diffhunk://#diff-32597ee59d679b740ccc62e2bf05354aa0918a3662d9949d27f117526128ab62R1-R8)
[[3]](diffhunk://#diff-1be741483848b645a6c7e85e58d79c3b5eb1b4353b27f57316c00ec6e176b6e5R1-R8)
[[4]](diffhunk://#diff-dff15693362fcb9e4b7d6dde7a8eafa67806903a0b05d6ab07e2eb923cf7bbe1R1-R8)
[[5]](diffhunk://#diff-cef23a1c4601fb334e1bd6cc7f4a96a7e25550b08b381942998bb108fc64d58dR1-R8)
[[6]](diffhunk://#diff-5df1e672d5a9546c5acbfe9d82ddddfa82bc946d1c0b18900d5bc055efbbcdd9R1-R8)
[[7]](diffhunk://#diff-b249fc32817185ddef560ebee1c3271e480c8ad3a15e276b9603f573d24b76b2R1-R8)
[[8]](diffhunk://#diff-0c12c073b1a807c9688bc529c1c5ab8682fbd6e8ddeb70cfa44ce9758e5ae4e7R1-R8)
[[9]](diffhunk://#diff-d9099249f5d9ce758e4c9dfe6a5df22821ff466fdcfecb8138f1880b7f9c76e6R1-R8)
[[10]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R305-R318)
[[11]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R340-R346)
[[12]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R361-R367)
[[13]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R403-R451)

**Installer and Uninstaller Scripts:**

* Added custom install and uninstall shell scripts for `balenaEtcher`
and `CleanMyMac`, referenced in their respective output JSON files for
automated deployment and removal.
[[1]](diffhunk://#diff-8d03c90ab45b7ed733912e7ba94c2601b8a80047896ed6812dbacb91d538b2edR1-R21)
[[2]](diffhunk://#diff-3c53d70fb16a8d91fddbe12c90115a282738652ce25e082795baff88d67cb4afR1-R21)

**App Metadata and Categorization:**

* Each new app includes metadata such as name, unique identifier,
installer format, slug, and default categories in its respective input
JSON file for improved organization and categorization.
[[1]](diffhunk://#diff-929134bb1d28b55d168f4dc3e35f9f08a0d1e45d46bcf6f4183f99f79428433cR1-R8)
[[2]](diffhunk://#diff-a3148bf2381a87133a9daf9bb676da3561b68458fac4a8bf5a13ee4b2ca1e6a0R1-R8)
[[3]](diffhunk://#diff-371522e9c06a5ea355102f316203a3e6c9227337e418fa477c6a70e04f558da4R1-R8)
[[4]](diffhunk://#diff-32597ee59d679b740ccc62e2bf05354aa0918a3662d9949d27f117526128ab62R1-R8)
[[5]](diffhunk://#diff-1be741483848b645a6c7e85e58d79c3b5eb1b4353b27f57316c00ec6e176b6e5R1-R8)
[[6]](diffhunk://#diff-dff15693362fcb9e4b7d6dde7a8eafa67806903a0b05d6ab07e2eb923cf7bbe1R1-R8)
[[7]](diffhunk://#diff-cef23a1c4601fb334e1bd6cc7f4a96a7e25550b08b381942998bb108fc64d58dR1-R8)
[[8]](diffhunk://#diff-5df1e672d5a9546c5acbfe9d82ddddfa82bc946d1c0b18900d5bc055efbbcdd9R1-R8)
[[9]](diffhunk://#diff-b249fc32817185ddef560ebee1c3271e480c8ad3a15e276b9603f573d24b76b2R1-R8)
[[10]](diffhunk://#diff-0c12c073b1a807c9688bc529c1c5ab8682fbd6e8ddeb70cfa44ce9758e5ae4e7R1-R8)
[[11]](diffhunk://#diff-d9099249f5d9ce758e4c9dfe6a5df22821ff466fdcfecb8138f1880b7f9c76e6R1-R8)

**Main Apps Output Update:**

* Updated `apps.json` to include all new applications, complete with
platform, unique identifier, and descriptive text for each, ensuring
visibility in the maintained apps catalog.
[[1]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R165-R171)
[[2]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R305-R318)
[[3]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R340-R346)
[[4]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R361-R367)
[[5]](diffhunk://#diff-4c1446cfc02c6bb0bda874481e333c65b84e184fcea52f656b49a6489f73c9c2R403-R451)
2025-12-09 23:14:56 -06:00

59 lines
1.7 KiB
Bash
Executable file

#!/bin/sh
# variables
APPDIR="/Applications/"
TMPDIR=$(dirname "$(realpath $INSTALLER_PATH)")
# functions
quit_application() {
local bundle_id="$1"
local timeout_duration=10
# check if the application is running
if ! osascript -e "application id \"$bundle_id\" is running" 2>/dev/null; then
return
fi
local console_user
console_user=$(stat -f "%Su" /dev/console)
if [[ $EUID -eq 0 && "$console_user" == "root" ]]; then
echo "Not logged into a non-root GUI; skipping quitting application ID '$bundle_id'."
return
fi
echo "Quitting application '$bundle_id'..."
# try to quit the application within the timeout period
local quit_success=false
SECONDS=0
while (( SECONDS < timeout_duration )); do
if osascript -e "tell application id \"$bundle_id\" to quit" >/dev/null 2>&1; then
if ! pgrep -f "$bundle_id" >/dev/null 2>&1; then
echo "Application '$bundle_id' quit successfully."
quit_success=true
break
fi
fi
sleep 1
done
if [[ "$quit_success" = false ]]; then
echo "Application '$bundle_id' did not quit."
fi
}
# extract contents
# Use 'yes' to automatically accept license agreement when mounting DMG
# This replicates Homebrew's behavior for DMG files with license agreements
MOUNT_POINT=$(mktemp -d /tmp/dmg_mount_XXXXXX)
yes | hdiutil attach -plist -nobrowse -readonly -mountpoint "$MOUNT_POINT" "$INSTALLER_PATH" || exit 1
sudo cp -R "$MOUNT_POINT"/* "$TMPDIR"
hdiutil detach "$MOUNT_POINT" || true
# copy to the applications folder
quit_application 'com.dbeaver.product.ultimate'
if [ -d "$APPDIR/DBeaverUltimate.app" ]; then
sudo mv "$APPDIR/DBeaverUltimate.app" "$TMPDIR/DBeaverUltimate.app.bkp"
fi
sudo cp -R "$TMPDIR/DBeaverUltimate.app" "$APPDIR"