Pergunta

I have created the Mac Package in order to install some of my stuff. I have the postflight script that is supposed to copy over some data to /Library/Application Support/Apple/Mail/Stationery/Apple/Contents/Resources/Stationery/Contents/Resources/ - and for reasons mentioned in here: How can I build a Mac package on linux? (BOM file problem) it needs to be postflight script.

However it did not work (it was just downloading a zip file, unpacking it and cp to mentioned location). So I've checked the errors by adding 2> to cp and here's what happened:

cp: /Library/Application Support/Apple/Mail/Stationery/Apple/Contents/Resources/Stationery/Contents/Resources/: Permission denied

I've double check my Info.plist and looks like proper setting is preserved:

<key>IFPkgFlagAuthorizationAction</key>
<string>RootAuthorization</string>

But the script still don't have permissions. I've tried the "whoami" and it returned currently logged in user. What's more curious, the installer ia actually asking for admin authentication. You guys have any ideas what should I do to have this script running as root/admin/whoever with greater permissions?

Foi útil?

Solução

I think it's impossible in Lion.Installer of Lion launches scripts from current user.

Outras dicas

The fact that the installer is bringing up the admin authentication alert means that the installer is already authenticated (presumably to install files into admin/root-only places).

If I remember correctly, in my own Postflight scripts, I added calls to sudo within the script to do admin/root privileged things. Try that approach and see if it works. I don't know if this is the "best practice" approach though (or maybe it is, since installers can be signed).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top