Installing to /Users/<username>/...
Installing to /Users/<username>/...
- Subject: Installing to /Users/<username>/...
- From: eveningnick eveningnick <email@hidden>
- Date: Sun, 31 Oct 2010 15:25:48 +0200
Hello!
I need to install my application to /Users/<current user name, who
launched the installer>.
I have searched the list, I know what i want to do is wrong, but i
can't install my application for all users.
The reason is that i have to create
/Users/<username>/LaunchAgents/my.app.plist, and create it in user's
home directory - because later my application will need to have
privileges to delete this file, or to rewrite it, depending on if a
user sets the checkbox "Launch app on startup".
My application (like every other app from /Applications) is not
launched with root privileges - user just "doubleclicks" it, therefore
it can't modify the Launchd's *plist file in
/Library/LaunchAgents/..., but it can do that to
/Users/<username>/Library/LaunchAgents/...
Thus i'm having an issue determining the user's home directory during
installation. Of course, if there was a way to modify the "root's"
.plist in /Library/LaunchAgents from an ordinary app, i wouldn't have
needed all that "dancing around with a tembourine".
What is the most reliable way to get that user directory in
installation script? I was thinking to do it all this way: install the
stuff to a temporary dir, and then copy it altogether to the
/Users/<username> via PostInstall script. But the $User variable
doesn't give the real username out, neither does $home.
Looking for the answer I have found a command
id -p
that gives in one of its lines, together with the text "login",
someone's username (in a second column). In my case, on my system this
was the needed username - a name of a user, who had started the
launching process, but i am not sure it will be that way on everybody
else's mac. If it works for everybody else, i'd use grep | awk or
something in a script, but i'm still afraid that it's not a reliable
idea.
Could you give me a hint, what is the best approach? Or, if there's no
way out, how could my application modify (create, delete, overwrite)
not user's, but "root's" plist (in
/Library/LaunchAgents/my.app.plist)?
Thanks!
_______________________________________________
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