Re: Installing a Launchd.plist

Jack Brindle

That’s one of the cool things about it. Nothing special about the lower level (main) app. It is simply a standard app. You can either do the installation yourself there, have the top level installer run the command line installer as the privileged app, or a combination where the lower level app calls the command line installer. Remember, once the applescript command is executed, the application it runs is running at elevated level (root), so you can do a lot of both good and damage.

We used this method to replace the standard installer user interface with one of our own, and invoke the command-line interface to do the actual installation job. In another product, we do the actual file copies, privilege setting and other installation work in the lower-level app itself. There are some gotchas there, like handling file download quarantines, but with some effort they can be handled. Both apps have a lot to install, so there is a lot of work happening here. There is a big advantage to being root in this situation...

For the top-level installer app, we use a user-agent (so as not to show icons, menus, etc). It does some checking, then calls the lower-level (main) installer using the applescript. That is not too difficult to set up. I wonder if it would be easier to just use an Applescript app to do that job. The top-level app usually does not have any UI - the exception is if something goes wrong, we tell the user.

If you need some help with the Applescript setup, just ask and I’ll dig up that info!

- Jack

On Jul 22, 2017, at 9:48 PM, John Brownie <john_brownie@...> wrote:

21 July 2017 at 05:41
SMJobBless is a royal pain to get going. By far the easiest (and perhaps coolest) way of running a privileged app (usually for an installer) is to do it through AppleScript.
Something like: “do shell script xxx with administrator privileges” does the job of setting up authentication quite nicely and gets around all the SMJobBless mess.
This is set up in a top-level app, one that runs when the installer is launched. It then launches a lower-level app (with privileges) where the actual work is done.
Once thing to watch for - the low level program does not inherent the same settings as a normal application. It will probably run in English with a US locale, as
opposed to whatever language and locale setting the user has set. It is easy to capture these in the top level app and send them over to the main installer,
usually through command line arguments.

For my own purposes, this looks like a good solution to a problem. I've never been much of a user of AppleScript, though, so I'm not sure how one creates such a lower-level app to be called from the main app. Any pointers on where to learn how to do this?

John Brownie
SIL-PNG, Ukarumpa, Eastern Highlands, Papua New Guinea
Mussau-Emira language, New Ireland Province, Papua New Guinea

Join { to automatically receive all group messages.