site_archiver@lists.apple.com Delivered-To: installer-dev@lists.apple.com You should use 'su $USER -c defaults write...' to edit the pref and $HOME to get the user's homedir instead of assuming it will be in /Users. -pmb Thanks again, Cormac On 15 Mar 2007, at 13:24, Steve Stockman wrote: Hello Cormac, A couple of things to try ... From: Cormac Daly <<mailto:cormac@abaltat.com>cormac@abaltat.com> Date: Thu, 15 Mar 2007 11:21:15 +0000 To: <<mailto:installer-dev@lists.apple.com>installer-dev@lists.apple.com> Subject: Shell scripts not executing correctly Hi List, Many thanks. Cormac _______________________________________________ Do not post admin requests to the list. They will be ignored. Installer-dev mailing list (Installer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/installer-dev/site_archiver%40lists.a... If you do that, the preferences file will be created (if missing) as root, which will prevent the user from modifying their own preferences. At 3:42 PM +0000 3/15/07, Cormac Daly wrote: Thank you both for the replies - the preferences were indeed being written to /var/root/Library/Preferences. I would prefer to use the user preference system instead of the root preferences, however, so I am now running the following commands: THEUSER=`logname` defaults write "$3/Users/$THEUSER/Library/Preferences/com.domain.appname" installertestkeyPOSTFLIGHT installerteststringPOSTFLIGHT This appears to function corretly but I have yet to extensively test it - can anyone see a potential problem with writing user preferences in this way? If your installer requires authorization, then the defaults command is probably writing to the superuser's preferences (/var/root/Library/Preferences). If you want the defaults to apply to everyone, then Scott Russell's suggestion of explicitly directing it to /Library/Preferences/com.domain.appname will take care of that. However, unless your installer forces the current startup disk to be selected as the target, then you should put a "$3" on the front of that path to make sure it goes to the correct disk. -- Steve Stockman Software Architect Consumer Products - Macintosh Symantec Corporation Office: 402-296-4026 Fax: 402-296-2026 Email: <mailto:steve_stockman@symantec.com>steve_stockman@symantec.com <http://www.symantec.com>www.symantec.com First, whether it's overkill or not, I always fully address the plist I want to write to: defaults write /Library/Preferences/com.domain.appname .... Second, does the choice of quoting matter? (Probably not since you say this works when you run it manually) defaults write /Library/Preferences/com.domain.appname installertestkeyPOSTFLIGHT 'installerteststringPOSTFLIGHT' (no quotes for the property, single quotes for the value) Finally, have you tried explicitly setting the value type? defaults write /Library/Preferences/com.domain.appname installertestkeyPOSTFLIGHT -string 'installerteststringPOSTFLIGHT' `man defaults` lists: -string, -data, -int, -float, -bool, -date, -array, and -dict I don't know if any of those will help for certain, but they're avenues I'd explore if I were having this trouble. Best wishes, Scott -- Scott Russell I'm using PackageMaker to deliver a metapackage and wish to execute shell scripts to write certain keys and values to the defaults system at various stages of the installation. The scripts are executing, however the scripts will not write to the defaults system - here is the postflight script (currently just used for testing) for one of my packages: #!/bin/sh echo "***Application postflight script***" MYDEFAULTS=`whereis defaults` echo DEFAULTS IS $MYDEFAULTS defaults write com.domain.appname "installertestkeyPOSTFLIGHT" "installerteststringPOSTFLIGHT" open "$1/Contents/Resources/DemoInstaller.app" I know PackageMaker is executing the script as DemoInstaller.app is being launched, but the defaults system is not being affected - if I run the script directly from the terminal using ./postflight, the defaults system IS written to. Anybody got any suggestions? This email sent to site_archiver@lists.apple.com