Posted on 11-11-2011 06:16 AM
Can anyone steer me to web resources/hints/tips/tricks etc. that can help me dig deeper in using scripts in a PKG?
Currently trying to build a package that will install some fonts only in to the current logged-in user's home folder and no one else.
Seems like it should be accomplished with the use of a script in a PKG, but I can't seem to find any info on how to..
Nick Caro Senior Desktop Support Administrator
Phone +1 212-239-5741 Fax 212-946-4010 nick.caro at rga.com<mailto:nick.caro at rga.com>
R/GA 350 West 39th Street New York, NY 10018
www.rga.com<http://www.rga.com/> www.twitter.com/rga<http://www.twitter.com/rga> www.facebook.com/rga<http://www.facebook.com/rga>
The Agency for the Digital Age(tm)
Posted on 11-11-2011 06:52 AM
You could always build a package and have it fill existing users and
fill user template. You could also use the JAMF binary for this:
help page: bash-3.2# jamf help install
Usage: jamf install -package <file name> -path <path to file> -target
<volume>
[-fut] [-feu] [-showProgress]
-package The file name of the package to be installed.
-path The path to the package (not including the package name).
-target The drive that the package will be installed to.
-fut Fill User Templates. This option will take any user data (preferences, docuemnts, etc...) and populate the files to the User Templates meaning that any new user created on the system will have these files.
-feu Fill Existing Users. This option will take any user data (preferences, docuemnts, etc...) and populate the files to every user on the computer with a home directory.
-showProgress Display the progess of the download (HTTP only) and the
installation process.
example code (proof of concept do not use in production, test before
using, use at own risk, etc.):
#!/bin/bash
#set currently logged in user for self service policy
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')
# now install package to this user's
/usr/sbin/jamf install -package myfonts.dmg -path
/Volumes/CasperShare/Packages/ -target
/Users/${currentUser}/Library/fonts
exit 0
You will have to package up your fonts and toss them in Casper Admin
and then replicate to your distribution points.
-Tom
Posted on 11-11-2011 07:05 AM
Ah-Ha, this little snippet seems to be exactly the direction I need to go in.
I only want it to install to the home directory of the currency logged in user.
Maybe PKG is not the direction to go in at all….
Sounds like standard DMG with scripts will bang it out.
Nick Caro Senior Desktop Support Administrator
Posted on 11-11-2011 08:13 AM
Nick,
I don't think that there is an allowance for this (at least not in 8.1), but it can be easily achieved.
Place the fonts you wish to push to a temporary location, eg /tmp/ then in the script run a move command from the temp location to the current users home account.
You can get current user with:
stat -f%Su /dev/console
Worth doing an if statement with a check to ensure that the user is root, hence the machine is at the login window.
Something like:
myUser=stat -f%Su /dev/console
if [[ "myUser" == "root" ]]
then
rm [temp files]
else
mv [temp files]
fi
Sean
Posted on 11-11-2011 08:15 AM
Solid stuff, thank you.
I also got a good recommendation to use PackageMaker that comes bundled with Xcode Dev tools.
Thank you all for the assistance.
Nick Caro Senior Desktop Support Administrator
Posted on 11-14-2011 05:40 AM
Yes, DMG is the only format that Casper can install into a user's home folder with. This isn't a Casper limitation but rather an Apple Installer one. Traditionally, if you're building a stand-alone PKG installer and you need to install to the user's folder you'd actually install your files into /tmp and then move them into the current user's home folder with a postinstall script.
Later versions of Installer added the ability to install directly to the user folder, though I don't recall exactly where that happened along the way. I think it was in and early point release of 10.6 somewhere.
j
---
Jared F. Nichols
Desktop Engineer, Client Services
Information Services Department
MIT Lincoln Laboratory
244 Wood Street
Lexington, Massachusetts 02420
781.981.5436
Posted on 11-14-2011 05:43 AM
Yes, DMG is the only format that Casper can install into a user's home folder with. This isn't a Casper limitation but rather an Apple Installer one. Traditionally, if you're building a stand-alone PKG installer and you need to install to the user's folder you'd actually install your files into /tmp and then move them into the current user's home folder with a postinstall script.
Later versions of Installer added the ability to install directly to the user folder, though I don't recall exactly where that happened along the way. I think it was in and early poi 10.6 somewhere.
j
---
Jared F. Nichols
Desktop Engineer, Client Services
Information Services Department
MIT Lincoln Laboratory
244 Wood Street
Lexington, Massachusetts 02420
781.981.5436