Creating Installer Plugins in Packages with same root privileges as the packages to be installed (Mac OS X)

StackOverflow https://stackoverflow.com//questions/9693673

Question

I am working in a Mac OS X project where the installer is built using the Packages tool. I see that this tool is less used than the one called Package Maker and that is why I find difficult to get any help, but well, here is the question:

I have successfully created Installer Plugins following the official guide (http://s.sudre.free.fr/Stuff/Installer/Installer_Plugins/index.html), but now the problem is that I need one of them running with root privileges, prompting for admin password if needed.

Each package is able to be copied with administrative privileges along with the run of a pre-install and post-install script, but this step is after the plugin execution while I needed to run it before.

I could do that writing some basic Authorization code (using the deprecated AuthorizationExecuteWithPrivileges because making the complex workarounds recommended by Apple in a plugin is really though) in the plugin itself.

Now everything works (my privileged code and the installation) but the installer ends asking for an admin password twice, one for the plugin, and the other before the actual (package) install, which is not too "user friendly".

Does anyone know a workaround or possible solution?

Thanks in advance.

Was it helpful?

Solution

Old question but I will put this up as an option.

In a installer I made using packages I had one of the pre / post flight scripts take care of any thing that needed elevated privileges. You need to make that particular package ask for elevation but then the script runs with elevated privileges.

So in this example I have a plugin to ask the user some questions and then I store that information at /tmp for the script to read and execute on.

A little round the bend but works and much easier then trying not to use AuthorizationExecuteWithPrivileges

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top