Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add a URL-tile to the Dock from an Installer?



On Dec 30, 2004, at 9:13 PM, Gregory Clarke wrote:
The problem I'm running into is when I try to use the above within my PackageMaker's postinstall script. What occurs is the entire com.apple.dock.plist file gets reset to the factory default.
I have seen this before when exploring a script to add to the Dock. I don't remember the details, but I recall that there was a big difference if the script was executed as the user compared to root. I think if the same command is done using sudo then the users dock plist gets replaced with the factory default. My gut tells me that the clue to your problem is in this somewhere.

This is the same issue that plagues any process running as root: a plist file written by CFPreferences is _deleted_, THEN replaced with the new content. In an environment where either the uid or euid is root, this means the file is created by root. CFPrefs sets permissions on plist files such that only the file's owner can read the file (rw-------), so when a non-root process goes to read the file, it fails. CFPrefs then deletes the file in question (which it can do thanks to the write permission on the containing directory) and goes with the application-provided default values. The only way around this is to ensure that your euid is NEVER root when CFPrefs is called into (by 'defaults' or directly). I don't know offhand how one would do this in a shell script.


-- Gwynne, key to the Code
Email: email@hidden
Website: http://musicimage.plasticchicken.com/
"This whole world is an asylum for the incurable."

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >How to add a URL-tile to the Dock from an Installer? (From: Jay Koutavas <email@hidden>)
 >Re: How to add a URL-tile to the Dock from an Installer? (From: Gregory Clarke <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.