• 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
Re: 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]

Re: How to execute script as root, and then an another script on behalf of an ordinary user


  • Subject: Re: How to execute script as root, and then an another script on behalf of an ordinary user
  • From: Karl Kuehn <email@hidden>
  • Date: Wed, 5 Jan 2011 08:25:14 -0800


On Jan 5, 2011, at 7:46 AM, eveningnick eveningnick wrote:

There are a lot of different places where i need to install files. it is /Library/LaunchAgents, /Library/LaunchDaemons, /Library/Application Support, /Library/PreferencePanes. It would require as many "PackageMaker targets" as locations.

This indicates that you are trying to use Apple's PackageMaker. While it is the Apple tool for this, there are better ones available for free. I would suggest using Iceberg or Packages (for "old style" and "flat file" packages respectively). But regardless you can always just select the root of the filesystem as your target, and then put all of your payload in there.

There are a lot of problems going down the route you have chosen, and you will get a lot of flack for doing it (Greg is one of the more vocal, so I expect him to respond as well once he makes it to work today). The first problem is that you have totally blown out any idea of system administrators being able to use the package receipt system to audit their computers. Just killed it dead. Since everything gets moved by a script there is no automate-able way of auditing this. This also means that auto-delete systems fail. This is bad.

You have also opened up the potential for you to mess up in the scripting in so many ways... An example would be a system that does not properly use $3 everywhere, so now can't be used in system image creation tools like InstaDMG or System Image Utility.

By going off the normal path you have made yourself responsible to know every single variation out there... is that really a burden you want to take on?


This is difficult to do correctly in all instances. See http://stackoverflow.com/questions/1106638/starting-stopping-a-launchd-agent-for-all-users-with-gui-sessions

Thanks a lot for the link!
What do you mean by "all instances"? As far as i understand, i need to find a pid of some process that was launched by the current logged in user. Finder, for example. And then execute launchctl bsexec [finderPID] "/tmp/myloadscript". Or i am wrong? Are there any additional pitfalls?

Yes, there are lots. As a simple example: why are you assuming that there is only one person logged in, or that there is even one person logged in to the computer. Both cases are valid.

It may be easier to simply require a logout (or a reboot) after install; when the user logs back in the LaunchDaemon will be loaded.

Yes, i was thinking about, but users don't like to reboot the system, at least me, i consider that as old past times. Of course if i am unable to do this without rebooting, i'd use your advice.

We don't know exactly what you are trying to do, backing out a step or two might be a really good idea. There are a lot of people on this list that can probably better help you out if you give them the information they need to help you.
--
Karl Kuehn
email@hidden




 _______________________________________________
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: eveningnick eveningnick <email@hidden>
    • Re: How to execute script as root, and then an another script on behalf of an ordinary user
      • From: Greg Neagle <email@hidden>
References: 
 >How to execute script as root, and then an another script on behalf of an ordinary user (From: eveningnick eveningnick <email@hidden>)
 >Re: How to execute script as root, and then an another script on behalf of an ordinary user (From: Greg Neagle <email@hidden>)
 >Re: How to execute script as root, and then an another script on behalf of an ordinary user (From: eveningnick eveningnick <email@hidden>)

  • Prev by Date: Re: How to execute script as root, and then an another script on behalf of an ordinary user
  • 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: How to execute script as root, and then an another script on behalf of an ordinary user
  • 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