A continuation on the previous post of how to automate the Lion deploy process…
As with the last post, check the foot of the post for references.
Working with Iceberg Package Manager
Some software that we use can only be installed from the App center without the option to download first. This makes it difficult to obtain an installer to roll out to client machines. Luckily, with the help of Iceberg, this isn’t an issue.
Iceberg is able to lift most installed packages right out of the Applications directory and package them into a .pkg ready for redistribution. Some packages aren’t as simple as that and we will get in to those later in the section. For now let’s focus on the simple…
Download and install Iceberg, which you can grab from here:
Launch Iceberg and from the toolbar along the top of the screen, select File>New project. For a basic package, like our example of Texteditor, we can stick with the core template package. Name the package appropriately and continue to the next screen.
In the new window, expand the name of the package from the left hand pane and select Files. In the central pane, right click Applications and select Add Files…
Navigate to the location of the installed application and double click it. Press OK to the popup about absolute paths, if applicable. You should know see the application under the Applications header.
Next, click on the Settings tab from the left hand pane. Here you can amend the details of the package to reflect that of your own business.
From the toolbar along the top of the screen, select Build and Build again. Close the window when it is complete. By default Iceberg saves the built pkg to the current users home area. The directory is named after the package itself. The .pkg will be in the sub directory named Build.
As I mentioned earlier, this method works for the majority of applications, but not all of them. Some applications that I found NOT to work this way were Xcode, Office 2011 and McAfee 1.1.
If you skip down to the references at the bottom of this document, you will get a good example from another blogger detailing the process to repackage Office 2011. I found that this was didn’t work very well with Xcode 4.3.2 so had to go about that another way. Also McAfee I couldn’t repackage at all using Iceberg as the main .mpkg calls upon a further four .pkgs all with their own post and preflight scripts.
The McAfee .mpkg invokes four smaller .pkg’s making it quite difficult to automate. The way I found to get past this was to copy the installer to the client machine using the file copy task in DS. Then to a script that runs at the end of the workflow, I added the following line:
Sudo installer –pkg /users/administrator/desktop/mcafee.mpkg –target /
It’s not the cleanest method, but it works. I then have a cleanup script that runs after this one which deletes the .mpkg.
Deploying Xcode 4.3.2
This was the most challenging package I faced when configuring the deployment. Like McAfee, the .mpkg for Xcode invokes another .pkg, Mobile Device Framework. The only way I was able to get around this was to split this up into two packages. Package one installs the Mobile Device Framework, and the second installs Xcode.
Before we can look at any of this, we will need the download. To get this, you need to create a free developers account and login to the following site:
Once the installer has finished downloading, mount the .dmg. Right click on Xcode and select Show Package Contents and navigate to Xcode>Contents>Resources>Packages and copy MobileDevice.pkg to the desktop for easy access.
Launch Iceberg, and like before create a new project. This time, we will be creating a Darwin Package so select the appropriate package type from the menu and name the project. Before completing the package, I usually copy the MobileDevice.pkg to the newly created project folder. This keeps everything together should I need it again at a later date.
From the project window, expand the package by clicking the down arrow on the item in the left hand pane. From the list, click on Scripts. Simply drag and drop the MobileDevice.pkg into the bottom window and ensure the checkbox to the left of it is ticked.
The next thing we need to do is create a postflight script and link it to the Installation Scripts window as shown in the above screenshot. The script takes the form of:
Sudo installer –pkg “$1/Contents/Resources/MobileDevice.pkg” –target /
Once you have written the script, name it postflight and verify that it doesn’t have an extension of any kind, then make it an executable by running the following command in the terminal:
Sudo chmod a+x /path/to/postflight
Copy the newly created script to the project directory, for the same reasons that we copied the MobileDevice.pkg there earlier. Now drag and drop to the postflight area of the Installation scripts of the project window, ensuring that the checkbox to the left of postflight is ticked.
Once you have done this, build the project and leave it to one side. Now we need to create the package for Xcode itself. To do this we need to install Xcode on a test machine and be sure to install any extras like iOS simulators from Xcode>Preferences>Downloads.
When you are happy with the Xcode installation, we need to run a small command from the terminal to ensure permissions are correctly set before we can capture it:
Sudo chown –R root:wheel /Applications/Xcode.app
Launch iceberg and create a new project, same as last time – a Darwin package. Expand the package so that you can see the Files tab. Under Applications, rightclick and select Add Files. Within the new window that pops up select Applications and choose Xcode. That’s all there is to it! Build the project and move both project directories to your deployment server’s Packages repository.
As mentioned earlier, I took a lot of influence from Mr derflounder’s blog when trying to package Office 2011 and Xcode 4.3.2. I highly recommend a thorough read of his comments before undertaking these deployments. You can find links to his blog at the bottom of this post.
Download the installer for Xcode from the developers site here:
Iceberg User guide:
I had a lot of ideas and help from this insightful blog. Here is a link to one of his posts, which helped me repackage Office 2011:
Another useful post from derflounder: