• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to execute script as root, and then an another script on behalf of an ordinary user
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How to execute script as root, and then an another script on behalf of an ordinary user
      • From: Greg Neagle <email@hidden>
  • Prev by Date: Re: Installer-dev Digest, Vol 77, Issue 2
  • Next by Date: Re: How to execute script as root, and then an another script on behalf of an ordinary user
  • Previous by thread: Re: Installer-dev Digest, Vol 77, Issue 2
  • Next by thread: Re: How to execute script as root, and then an another script on behalf of an ordinary user
  • Index(es):
    • Date
    • Thread