If JSM fails to complete, it will continue to launch and the uninstall script fails #29

Closed
opened 2026-01-19 18:31:17 +00:00 by michael · 1 comment
Owner

Originally created by @mattdjerome on GitHub.

If JSM fails to complete and place the /private/var/db/.JamfSetupEnrollmentDone file. it continues to launch until the process completes. THe problem with the uninstall script, is it shows a failure if the remove /private/var/db/.JamfSetupEnrollmentDone is uncommented.

Here's a version of the uninstall script with logic to detect the setup complete file.

`#!/bin/sh

export PATH=/usr/bin:/bin:/usr/sbin:/sbin

appName="Setup Manager"
bundleID="com.jamf.setupmanager"
setupComplete="/private/var/db/.JamfSetupEnrollmentDone"
appPath="/Applications/Utilities/${appName}.app"

if [ "$(whoami)" != "root" ]; then
echo "needs to run as root!"
exit 1
fi

if launchctl list | grep -q "$bundleID" ; then
echo "unloading launch daemon"
launchctl unload /Library/LaunchDaemons/"$bundleID".plist
fi
if [ -e "$appPath" ]; then
rm $appPath
echo "removing files"
rm -rfv "$appPath"
rm -v /Library/LaunchDaemons/"$bundleID".plist
rm -v /Library/LaunchAgents/"$bundleID".loginwindow.plist
fi
echo "forgetting $bundleID pkg receipt"
pkgutil --forget "$bundleID"

if [ -e $setupComplete ]; then
rm -v /private/var/db/.JamfSetupEnrollmentDone
fi
`

Originally created by @mattdjerome on GitHub. If JSM fails to complete and place the /private/var/db/.JamfSetupEnrollmentDone file. it continues to launch until the process completes. THe problem with the uninstall script, is it shows a failure if the remove /private/var/db/.JamfSetupEnrollmentDone is uncommented. Here's a version of the uninstall script with logic to detect the setup complete file. `#!/bin/sh export PATH=/usr/bin:/bin:/usr/sbin:/sbin appName="Setup Manager" bundleID="com.jamf.setupmanager" setupComplete="/private/var/db/.JamfSetupEnrollmentDone" appPath="/Applications/Utilities/${appName}.app" if [ "$(whoami)" != "root" ]; then echo "needs to run as root!" exit 1 fi if launchctl list | grep -q "$bundleID" ; then echo "unloading launch daemon" launchctl unload /Library/LaunchDaemons/"$bundleID".plist fi if [ -e "$appPath" ]; then rm $appPath echo "removing files" rm -rfv "$appPath" rm -v /Library/LaunchDaemons/"$bundleID".plist rm -v /Library/LaunchAgents/"$bundleID".loginwindow.plist fi echo "forgetting $bundleID pkg receipt" pkgutil --forget "$bundleID" if [ -e $setupComplete ]; then rm -v /private/var/db/.JamfSetupEnrollmentDone fi `
michael added the enhancement label 2026-01-19 18:31:17 +00:00
Author
Owner

@scriptingosx commented on GitHub:

uninstall sample script was updated in 1.4beta

@scriptingosx commented on GitHub: uninstall sample script was updated in [1.4beta](https://github.com/jamf/Setup-Manager/blob/beta/Examples/uninstall.sh)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jamf/Setup-Manager#29