Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Last active December 4, 2022 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/8b53adb27a9c366365a7845a39cc072a to your computer and use it in GitHub Desktop.
Save rtrouton/8b53adb27a9c366365a7845a39cc072a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Description: Script to uninstall NexThink Collector.
ERROR=0
# File Paths
if [[ -f "$(/usr/bin/find $(dirname $0) -maxdepth 1 \( -iname \*\.dmg \))" ]]; then
dmgFile="$(/usr/bin/find $(dirname $0) -maxdepth 1 \( -iname \*\.dmg \))"
fi
dmgMount="$(/usr/bin/mktemp -d /tmp/NexThink_Collector_Uninstaller.XXXX)"
# Remove the trailing slash from the dmgMount variable if needed.
dmgMount=${dmgMount%%/}
# Mount the DMG
/usr/bin/hdiutil attach "$dmgFile" -mountpoint "$dmgMount" -nobrowse -noverify -noautoopen
# Uninstall the NexThink Collector software
"$dmgMount"/uninstaller
# Unmount the DMG
hdiutil detach $dmgMount -force
exit $ERROR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment