Update JumpCloud Agent.munki.recipe
@@ -55,6 +55,54 @@ else
}
EOF
fi</string>
+ <key>uninstall_script</key>
+ <string>#!/bin/bash
+# Script downloaded from: https://support.jumpcloud.com/customer/portal/articles/2426853--all-oses-how-to-uninstall-the-jumpcloud-agent
+
+if [[ $(id -u) -ne 0 ]]; then
+ echo "Must run as root!"
+ exit 1
+fi
+
+AGENT_UNINSTALL_SCRIPT="/opt/jc/bin/removeAgent"
+
+if [[ -f $AGENT_UNINSTALL_SCRIPT ]]; then
+ chmod 0700 $AGENT_UNINSTALL_SCRIPT
+ $AGENT_UNINSTALL_SCRIPT
+ exit $?
+fi
+
+launchctl remove com.jumpcloud.darwin-agent
+rm /Library/LaunchDaemons/com.jumpcloud.darwin-agent.plist
+
+sw_vers -productVersion | cut -d'.' -f1-2 | grep '^10.9$' &amp;> /dev/null
+if [[ $? -ne 0 ]]; then
+ security authorizationdb read system.login.console | \
+ sed 's# &lt;string>jumpcloud-loginwindow:invoke &lt;/string>#&lt;string>loginwindow:login&lt;/string>;#' | \
+ security authorizationdb write system.login.console
+fi
+
+rm -rf /Library/Security/SecurityAgentPlugins/jumpcloud-loginwindow.bundle
+rm -rf /opt/jc
+
+# if the service account is present, delete it:
+if (id -u _jumpcloudserviceaccount > /dev/null 2>&amp;1); then
+ dscl . -delete /Users/_jumpcloudserviceaccount
+fi
+
+# uninstall the tray-app
+# first unload the app for all console users (logged in on UI)
+for uid in $(ps -axo uid,args | grep -i "[l]oginwindow.app" | awk '{ print $1 }')
+do
+ if launchctl asuser "$uid" launchctl list 'com.jumpcloud.jcagent-tray' &amp;> /dev/null; then
+ launchctl bootout gui/"$uid" '/Library/LaunchAgents/com.jumpcloud.jcagent-tray.plist'
+ fi
+done
+# then delete the app plist and app folder
+rm /Library/LaunchAgents/com.jumpcloud.jcagent-tray.plist
+rm -rf /Applications/Jumpcloud.app</string>
+ <key>uninstall_method</key>
+ <string>uninstall_script</string>
<key>unattended_install</key>
<true/>
</dict>
