• 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: installing in the user's home directory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: installing in the user's home directory?


  • Subject: Re: installing in the user's home directory?
  • From: "Perbix, Michael" <email@hidden>
  • Date: Sat, 02 Apr 2011 20:38:56 -0400
  • Acceptlanguage: en-US
  • Thread-topic: installing in the user's home directory?

Using Iceberg makes this easy.  Either install files somewhere on your HD (like the user template located at /System/Library/User Template/English.lproj and inside there is the template of what gets copied to all new users. Lets say you want to install prefs for an application you are pushing out.  Install the pref file at /System/Library/User Template/English.lproj/Library/Preferences then create a text file script that will copy that to all your users.  Lets say the pref file is myapp.plist.

____ 8< snip ________

#!/bin/sh

# get listing of /Users Directory
# and set template locaton

dirs=`ls /Users`
template="/System/Library/User Template/English.lprog"

# now do something for each entry

for dir in $dirs
do
     # exclude /Users/Shared
     if [ "$dirs" != "Shared" ]; then
     cp "$template/Library/Preferences/myapp.plist" "/Users/$dir/Library/Preferences"
     chown $dir:$dir "/Users/$dir/Library/Preferences/myapp.plist"
     chmod 700 "/Users/$dir/Library/Preferences/myapp.plist"
     fi
done

______ 8< snip _______

Take this script and make it a postflight script.  Iceberg will take care of naming it correctly and such for you.

Now, if you simply want to make a quick package to copy stuff you can do this....Make a new dummy package and put the item  you want to copy in the "Resources" section of Iceberg (Iceberg will add it to the Resources folder of your package for you).  Then do a postflight script  which is something like above...


____ 8< snip ________

#!/bin/sh

# get listing of /Users Directory

dirs=`ls /Users`

# now do something for each entry

for dir in $dirs
do
     # exclude /Users/Shared
     if [ "$dirs" != "Shared" ]; then
     cp "$1/Contents/Resources/myapp.plist" "/Users/$dir/Library/Preferences"
     chown $dir:$dir "/Users/$dir/Library/Preferences/myapp.plist"
     chmod 700 "/Users/$dir/Library/Preferences/myapp.plist"
     fi
done
______ 8< snip _______


the $1 indicates the path to the script and then follow the path to the Resources folder.

The chown and chmod commands make sure the file has the correct owner and permissions.

   -Mike

On Apr 2, 2011, at 2:56 AM, Colin Cornaby wrote:

> This isn't really simple. You've got to install into a temp location, and then copy the file into place in the user directory with a script, and then use the script to fix the permissions (if you're nice, not simply setting the permissions to 777...)
>
> It's been a bit so I don't recall offhand the trick I used to line up the permissions properly. It involved reading the permissions of the parent folder and copying them to the installed files. I'm sure someone else here can help you with that.
>
> If you only need to support 10.5 and higher, I believe the 10.5 package format has an added feature that allows you to install into a home directory.
>
> On Apr 2, 2011, at 12:40 AM, Rich Morin wrote:
>
>> I'm trying to use PackageMaker to create an installer
>> that unpacks a directory tree into a sub-directory of
>> the user's home directory.
>>
>> I'd like the permissions and ownership to be "normal"
>> (eg, allow the user to read and write files, but not
>> everyone on the system).  So, the usual advice about
>> setting things to root/admin isn't really appropriate
>> and I certainly don't want things to be set to MY uid
>> on someone else's machine.
>>
>> Suggestions?
>>
>> -r
>> --
>> http://www.cfcl.com/rdm            Rich Morin
>> http://www.cfcl.com/rdm/resume     email@hidden
>> http://www.cfcl.com/rdm/weblog     +1 650-873-7841
>>
>> Software system design, development, and documentation
>> _______________________________________________
>> 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

 _______________________________________________
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

References: 
 >installing in the user's home directory? (From: Rich Morin <email@hidden>)
 >Re: installing in the user's home directory? (From: Colin Cornaby <email@hidden>)

  • Prev by Date: requiring a file with a variable path?
  • Next by Date: Re: Mysterious .app/Finder corruption?
  • Previous by thread: Re: installing in the user's home directory?
  • Next by thread: requiring a file with a variable path?
  • Index(es):
    • Date
    • Thread