I downloaded the sample code given in: https://developer.apple.com/documentation/servicemanagement/updating-your-app-package-installer-to-use-the-new-service-management-api?language=objc
Made necessary changes and I was able to install and test successfully.
Next, I watched: https://developer.apple.com/videos/play/wwdc2023/10266/
I noted the example given at: 14:52 Example launchd plist constraint.
Applied the KeepAlive, RunAtLoad and SpawnConstraints parameters to the sample code downloaded earlier.
I got the log in the console and agent was not allowed:
default 11:35:26.885483+0300 kernel AMFI: Launch Constraint Violation (enforcing), error info: c[5]p[1]m[1]e[0], (Constraint not matched) launching proc[vc: 10 pid: 19439]: /Library/Application Support/X/SMAppServiceSampleCode.app/Contents/Resources/SampleLaunchAgent, launch type 0, failure proc [vc: 10 pid: 19439]: /Library/Application Support/X/SMAppServiceSampleCode.app/Contents/Resources/SampleLaunchAgent
Is SpawnConstraint not applicable for launch agents?
Since launchd is the only parent process that can spawn the launch agent based on the plist, is the example given at 14:52 still valid?
Post
Replies
Boosts
Views
Activity
Hi, I noticed in this page, there is no explanation about who/when/how the method handle_checkbox_toggle is called.
Page:
https://developer.apple.com/documentation/servicemanagement/updating-helper-executables-from-earlier-versions-of-macos?language=objc
Ultimately, how should the app come to know when a app service is allowed or disallowed in System Settings > Login Items ?
Found that sudo sysctl -a does not complete on macOS Catalina 10.15.5 Beta 19F53f. Killing with -9 also does not help to terminate the process. Create a feed back FB7653964.
A package contains lot of components. My product launches the main application of the package at the end of installation of the package through postinstall script. Such an application is expected to run in the context of logged in Console user.But the installer runs the postinstall script in root privilege with uid value 0. Therefore to launch the application in Console user context, the following command has been used so far:sudo su - $CONSOLE_USER -c open $MAIN_APP_OF_PKGWhere CONSOLE_USER and MAIN_APP_OF_PKG are computed which is not in this scope.The above way has been working so far good in Mac systems.In the new macOS Catalina Version 10.15.4 Beta (19E234g), this “sudo” and “su” fail with “Operation not permitted” when run from postinstall.When installing a test.pkg, this issue is observed in /var/log/install.log:——————2020-02-21 17:04:14+02 Testers-Mac-mini package_script_service[4256]: ./postinstall: sudo su - tester -c open "/Applications/HelloWorld.app"2020-02-21 17:04:14+02 Testers-Mac-mini package_script_service[4256]: ./postinstall: /tmp/PKInstallSandbox.LnPlJo/Scripts/com.senthil.HelloWorld.AmxxUq/post-install: line 4: /usr/bin/sudo: Operation not permitted——————1) Will the upcoming macOS update have the same behaviour? Why?2) What is the alternate way to launch the installed app in console user context?