Re: Odd question relating to preinstall scripts and administrator access
Re: Odd question relating to preinstall scripts and administrator access
- Subject: Re: Odd question relating to preinstall scripts and administrator access
- From: Cameron Pulsford <email@hidden>
- Date: Thu, 31 Jul 2008 17:07:31 -0400
Ok, so I just tried a combination of both answers but still to no avail.
I tried `who | grep console | awk {'print$1'}` and I tried `users |
grep -v root` (I know only one user will be logged in besides root so
this is safe) and then I also fixed the launchctl line to read
su $actualUserName -c launchctl unload .....
Alright, so really I want this script to execute before anything else,
are there any other ways to do it? I'm looking at the Preinstall
Actions which are sort of promising. The only thing that kind of works
though is "Open File" which does successfully open the file, but it
actually literally opens it. Terminal pops up and runs the script,
which isn't exactly the best user experience. Also, since it's just
opening the file, it opens it and then immediately starts installing,
instead of waiting for the script to be done. There is also a close
action, but since the previous command is just open, instead of run,
the moment terminal opens, it gets closed before the script can even
start. So the only option is to close terminal after the installer is
finished.
Is there anyway I can add a dummy thing to install that doesn't
actually put anything anywhere and just runs the preflight script?
Thanks for all the help so far!
On Jul 31, 2008, at 4:27 PM, Scott Russell wrote:
Hello Cameron,
when you do "$USER" in a postflight script that has root privs,
you'll get "root" back as the $USER. You can get around this in
various ways. Pperhaps `who | grep console | awk {'print $1'}`
would work for you?
I'd like to see a more elegant solution myself if anyone has a
better one to offer.
Best wishes,
Scott
--
Dr. Scott Russell
IT Support Engineer/Consultant
Arts & Letters Computing, Distributed Support Services,
Office of Information Technologies, University of Notre Dame
Instructor of Horn, University of Notre Dame and Saint Mary's College
Assistant Horn, South Bend Symphony Orchestra
234 Decio Hall
574-631-7021
email@hidden
http://www.nd.edu/~srussel2/
On Jul 31, 2008, at 1:54 PM, Cameron Pulsford wrote:
So I seem to have the opposite problem most people have... I am
installing something that needs administrator access but I need to
run a preinstall script that not only doesn't need these rights, it
can't have these rights. I need to run a script that does stuff
with "launchctl unload" and when that is given root access it
defaults to root, even if the explicit path you give it to unload
is ~/Library/xxx for example. That's at least what I have gathered
after some research.
When I run the script from the terminal it works, but when I run
"sudo thescript" it doesn't work.
I tried modifying my script like this...
realUserName=`echo $USER`
sudo -u $realUserName launchctl unlead $HOME/Library/LaunchAgents/
com.racepoint.*.plist
and in the console I still get the same error message "launchctl:
Dubious ownership on file (skipping) /Users/xxx/Library/
LaunchAgents" and then the installer fails.
Just to test I made a new package that just did some bogus stuff
that didn't need administrator access, and I had it run the same
prelaunch script and it worked great. Sorry if this is confusing
but essentially I need a script to run without super user
privileges but the component thats getting installed after the
prelaunch script does. Any ideas?
_______________________________________________
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
_______________________________________________
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