I'm still facing an issue with registering the agents. I left the bootout of the launch agents in the preinstall script, thinking i would be in a clear state with respect to the registration status. But when i launch the UI and check the registration status of the launch agent its 1 (enabled). So I was able to succcessfully unregister it (status=0 notRegistered), and then i keep getting this error when trying to register:
User Agent Registration Failed: Error Domain=SMAppServiceErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedFailureReason=Operation not permitted}
What could be happening here thats causing me not to be able to register the agent? Is the fact that I have two launch agent plists for the same agent is causing it (even though there will be at least a bootout of the agent required for existing users to implement this flow). Is this something to do with Should I "Code Sign on Copy" the plist files that represent the launch agent configuration? Starting to think SMAppService cannot fit my use case..
Note that the plists defined in /Library/LaunchAgents, and the one SMAppService references in the app bundle are different and that is expected (BundleProgram replace Program, and relative path for that)
Preinstall script commands:
CURRENT_UID=$(ls -ln /dev/console | awk '{print $3}')
if [ -n "$CURRENT_UID" ]; then
/bin/launchctl bootout gui/"$CURRENT_UID" "/Library/LaunchAgents/com.amazon.persist.user-service.plist" 2>/dev/null || true
/bin/launchctl bootout gui/"$CURRENT_UID" "/Library/LaunchAgents/com.amazon.persist.privileged-service.plist" 2>/dev/null || true
fi
Topic:
App & System Services
SubTopic:
Core OS
Tags: