How to execute script as root, and then an another script on behalf of an ordinary user
How to execute script as root, and then an another script on behalf of an ordinary user
- Subject: How to execute script as root, and then an another script on behalf of an ordinary user
- From: eveningnick eveningnick <email@hidden>
- Date: Wed, 5 Jan 2011 02:00:15 +0200
hello
I have faced with a problem needing to execute 2 actions after
installation (i placed them as postinstall scripts).
Firstly, i need to install plist files into /Library/LaunchDaemons and
/Library/LaunchAgents (this can be done only from "root" script)
And then i need to start a daemon and an agent using launchctl
The problem is that while daemon can be started (because post
installation script is running as root, i can execute launchctl load
-w /Library/LaunchDaemons/com.mydaemon), i can't start an agent. Agent
needs to be loaded and started by a user, not by a root - if a user
executes a command "sudo launchctl load -w
/Library/LaunchAgents/com.myagent", this agent will be loaded into
system domain - i.e. by a global launchd instance while i need to load
it using a per-session launchd instance.
In short, is it possible somehow to install files as root, the to
execute a script on behalf of a normal user, who launched installation
script, and then execute another script on behalf of root?
I am currently reading manuals about command line packagemaker
utilities, because it seems that GUI tool doesn't allow to explicitly
specify how to run postinstallation scripts.
How could i solve this? Is it possible? Or the only solution is to
tell the user to reboot the machine after installing my application?
Thanks for any advice!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden