Blog

Creating an Adobe CS3 Installer with pkgGen

By Zack Smith posted on August 20th, 2007

Here is an introductory guide on how to create an Adobe CS3 .pkg installer ( in lieu of the slient install ) with little to no fuss(1), and more importantly no real manual interaction with all the associated files. I have modified a perl script from Geoff Franks that was created for parsing Microsoft Office update log files to now parse the output of logGen. Please note that Perl is not my primary language ( As of late the snake is eating most of my llama time. ) and so this is not yet as polished as other scripts I publicly post ( I really didn’t have to change too much to get this working. ). I encourage the community to send back code additions and bug reports.
1. Its worth mentioning there are easier to use commercial pieces of software such as composer and other methodologies such as the slightly immature package snapshot feature (Not recommended for CS3, trust me I’ve tried it).

Please read the article below and then download pkgGen

Before we begin I want to let you know that you can click the code through most of this article or download command files to double click on if you don’t feel like typing,you can use the followings types of links to either download the ->command<- , modify it in a Text Editor (and make it executable) or run it directly by clicking on the code it’s self:

echo "hello world"Just click the Run button to “Run” the script via Terminal.app

Repackaging Adobe CS3 with logGen, pkgGen and PackageMaker:If you haven’t heard of logGen here is the description curiosity of its creators :

“logGen is a command-line utility (for now) for detecting filesystem changes after a preference change or package installation. This is primarily useful when creating your own .pkg files so you know what you need to package. This package is only compatible with OS X 10.3 and above due to some perl modules that are missing in earlier version. If you need to run it on OS X 10.2, you’ll need to install the necessary perl modules manually.”

Its also good to know that by default logGen excludes the following directories:

/Users/
/Network/
/Temporary Items/
/Volumes/
/dev/
/private/Network/
/private/tmp/
/private/var/
/afs/
/.vol/
/.Spotlight-V100/
NOTE file:// links must be dragged to the location bar to activateSo first of-course you will need to download logGen from here[DMG] Docs [TXT]

Run through the installation of logGen on your target machine, and then login as an admin user ( you could also su ). If you want to use the automator action below its best to login as or enable root either now or towards the end (Use a secure password!).
Before you install CS3, create a current fileset for the state of the system using the following command:

this will save a file on the currently logged in user’s Desktop called “Before.dat”. sudo /usr/local/sbin/logGen "$HOME/Desktop/Before.dat"
ABOVE:Type in your (admin) password and hit return , you will see the status change to “Checking File: 000000″ and it will return the prompt when complete.

Then simply run through your installation of CS3 (or really any other Application ) , I would recommend doing nothing else during this period that would effect files outside of the exclusion list above, as it could add more false positives to your results.

When your CS3 installation (and Volume Registration) is complete, you can run the following command : this command will generate two files on the Desktop “After.dat” and “Differences.txt” which is the one we are mainly concerned with.
sudo /usr/local/sbin/logGen "$HOME/Desktop/After.dat" \ "$HOME/Desktop/Before.dat" > "$HOME/Desktop/Differences.txt"

You can open this output file (Differences.txt) by just double clicking on it.

Example: (Here) is a Design Premium logGen report of the files needed for install Note that I didn’t have Office installed and choose not to install the Version Cue Server. (Here) is an alternative version highlighted with some false positives in red and orange.

Differences

WARNING: You must look through this file before deploying as things like /private/etc/cups/printers.conf could overwrite (printer) configurations.

You can delete any paths you don’t want added to your package, and then for good measure you can also delete the comments, copyright notices and such ( pkgGen is set to ignore them and while it lowers the complexity of your parsing, it is not required )

Now that you have generated a list of files, you can use pkgGen to copy the files to a fauxroot folder suitable for use with a Package Maker Project.

Download and install pkgGen[DMG]. Run the following command to have pkgGen copy the files, owner and permissions to a “fauxroot” directory on your desktop Note: fauxroot directory cannot exist or script will fail, also obviously you must have enough disk space to copy all the files..
sudo /usr/local/sbin/pkgGen "$HOME/Desktop/Differences.txt" \ "$HOME/Desktop/fauxroot"

Now you can use Package Maker, either installed via the Apple Developer tools (OS DVD-”/Other Installs/Xcode Tools/XcodeTools.mpkg) or the Apple Remote Desktop CD to then create a package installer using the fauxroot you just created on the Desktop. While going through a complete walk through of all the aspects of using Package Maker is beyond the scope of this article, you can really have one built by modifying just three tabs:

Modify the Contents to show the fauxroot we just created as the “Root:”, enable compression to get our 5GB+ worth of data down to a manageable 2.xGB (optional)

PackageMaker

In the “Configuration” tab choose “Root” authentication from the pop up menu, then in the “Package Version” tab setup a bundle identifier as shown. When complete use the “Project” Menu Bar Item to build +B). Save the Package where ever you like (make sure you have enough disk space ).

Package Maker ConfigPackage Maker Version

ottoHere is an automator action (10.4+) to help you if your new to this

Due to a “feature” in automator you must run this Application as root

Why not use the “Assist me” button?
I would caution you against using the “Assist me” (Xcode 2.2+)button in this instance as it will automatically apply recommended file permissions which is kind of a waste as we just copied the files permissions from the originals, also due to the securityd time out you will continually see the authorization boxes every five minutes or so ( logging in as root or modifying /etc/authorization temporarily would be a fix though not recommended. ):
com.apple.packagemaker.chmod
Summary and Clean Up
You can now move your fauxroot into its own folder and save the package maker project in the same directory (there is also a “relative to project” option for paths in PackageMaker using the Action menu (“gear” icon), if you clicked on any of the Apple Script links you can also save them as stand alone applications using the “File”>”Save” Dialog box and choosing Application Bundle. see screen shot below. Obviously you should test your package on a clean and then configured system noting as configuration “resets” Afterwards your ready to deploy CS3 via Apple Remote Desktop and the like. If you enabled root earlier make sure to disable when finished

Create AppleScript App
There are other factors to consider like creating a postflight script that would modify preferences such as update configurations but this guide will get you going with a base and useable package to start with. Check back on this blog as I will be publishing quite a few deployment scripts over the next month or so. If you enjoyed the article please feel free to contribute code, translations and bug reports. I do also teach the Apple Deployment (310) class if your interested in learning more tips and tricks. ( or just send me an email to forward, thanking my girlfriend for letting me spend our weekend writing this :) .

If would you like to contact me with comments or inaccuracies about this article, feel free but support requests will be ignored unless you would like to sign up for Iris Professional Services service.

Thanks -Zack

Posted in One liners, Scripts, System Administration, Tips and Tricks

Comments are closed.