edting firefox 35 with munki

Deploy a Firefox CCK2 package with Munki

Hi Munki / Firefox admin!

I’ve been known to use both JAMF’s Casper suite and Munki, situation dependent, but recently all of my Firefox CCK2 posts have been geared for Casper admins. Time to give some love to Munki in this area!

This blog assumes you have packaged the autoconfig files that CCK2 outputs and are ready to deploy them. It also assumes you have already got Firefox installed in your Munki Repo, either manually or via AutoPKG.

I have written the details using Munki Admin to take advantage of the easier GUI to show what’s happening. If you’d rather use the command line tools and edit the pkginfo files directly (and why not?) or you administrate your Munki setup without using Munki Admin, you should be able to take what I’ve written and easily translate it over to manually editing with the appropriate tools.

As always, this is how I have resolved the challenge I was faced with. I don’t make any promises that it’s the best way and I’m very open to hearing others’ opinions!

Package Info for your CCK2 package

1. Nice and simple. Import your CCK2 installer package into Munki, either using ‘munkiimport’ or Munki Admin. If you’ve used ‘munkiimport’, open up Munki Admin.

2. Find your newly added installer, and double click it to view and edit the pkginfo file.

3. (Personal Preference but) I would suggest ticking the ‘unattended install’ so that this ‘restrictions’ profile can be installed without alerting the user. The user will still be alerted if there are any installs / updates that are available that do not have ‘unattended install’ ticked.

4. Go to the “Requirements” tab. Add your ‘Firefox’ installer into the “Update for” section.
This will mean that you don’t need to add the CCK2 installer to a manifest and it will install after the Firefox installation (and not be replaced!)

editing firefox 35 cck2 installer

5. Click “OK” and then run ‘Save’/’Make’ to save the changes to the appropriate files.

6. This should now deploy fine.

What if this CCK2 installer is for a specific version of Firefox?

Ah, so you’ve read my previous blog about Mozilla changing the location of the CCK2 files between versions of Firefox? In this case, you’ll have a little more work to do. Once you’ve completed the above steps:

1. Navigate to your Munki Repo and find the pkginfo directory.

2. Open the pkginfo file for the CCK2 installer package in your favourite script-editing app (avoid word processes, such as Microsoft Word, and TextEdit as these can screw up the formatting of these files, thereby making them unusable).

3. Find the “update_for” key, and change this from “Firefox” to the full name of the pkginfo file (without the .plist) for the version of Firefox that this CCK2 installer is for.
e.g. To set my pkginfo to be for my Firefox-35.0.0.plist I will modify the CCK2 pkginfo from:

modifying firefox 35

to

modifying firefox 35

4. Save the file, and run the ‘make’ from Munki Admin, or the below command in terminal:

/usr/local/munki/makecatalogs

5. This should now only install the update, if the Mac is detected as having Firefox v35.0 installed (as detected by your Firefox-35.0 pkginfo).

Installation Detection

Now you will find you experience at least one (likely both) of the below scenarios:

  • If a user was to replace the entire Firefox application, or manually remove the CCK2 files, they will be able to remove the restrictions, and Munki won’t know to reinstall them
  • Munki will not be able to detect the installation of the CCK2 package and so will ask to update it at every Munki run.

More information for this can be found on the Munki site, however; it boils down to telling Munki (via the pkginfo file) what items correspond as the installer being ‘installed’.

This can be achieved through either an Installs Item/Array or an Install Check Script.

Please Note: Munki works through a priority list to determine which method to use to detect if an install is required. Regardless of the success or failure of the detection, it will stop when it finds the required information in the pkginfo, e.g. If you provide an Installs Array and an Install Check Script, it will only use the Install Check Script and will not failover to the Installs Array. The priority order is:

1st – Install Check Script

2nd – Installs Array / Items

3rd – Receipts

Installs Array

The first method I’ll show you is the Installs Array method. Again, as mentioned above, I’ll show you the Munki Admin method to try to make it as easy to follow as possible. Those who are happy to edit the pkginfo files, please feel free to do so! It would also help to know the actual files and directories that are being deployed.

1. Run the CCK2 installer package on a test device.

2. Install and Configure access to the Munki Repo from this device. Launch the Munki Admin application.

3. As before, find the CCK2 installer package, and double click it to view / edit the pkginfo data.

4. Navigate to the “Contents” tab. The top box is where the Installs Items are listed.

5. Open a Finder window and one by one drag in the files that the CCK2 installer deploys.

6. My example ended up as this:

editing firefox 35 munki

7. Click “OK” and then run ‘Save’/’Make’ to save the changes. This should now correctly detect when the package has been correctly installed and also reinstall should any of these files be missing (for example, should a user replace the Firefox application).

8. The relevant area of my final pkginfo file looked like this:

final pkg info file firefox munki
Install Check Script

So you didn’t like the Installs Array method? Or maybe you are intrigued as to other ways you could maybe carry out an amazing “Stupid Munki Trick” (https://github.com/munki/munki/wiki/What%20Are%20Stupid%20Munki%20Tricks)? In that case follow on. If not, please skip this bit.

1. Launch Munki Admin and access the CCK2 Installer pkginfo as mentioned above.

2. Go to the last “Install Check Scripts” tab. Check the left hand tick box and use the large left hand text window to write your script. The general rules are:
a. Any language that the Mac Supports, Munki will also support.
b. Most Importantly: An exit code of 0 means the item needs to be installed. Anything else means the item does not need to be installed.

3. For this example, I’ll cheat and use my CCK2 Casper Extension Attribute script to cut corners.

cck2 casper extension attributes script

4. I’ve changed line 36 to be “exit 0” as this is when the CCK2 items will need to be reinstalled.

5. I’ve also changed line 39 to be “exit 1” as this is when the CCK2 items have been detected as being installed.

6. As before, click “OK” and then run ‘Save’/’Make’ to save the changes

Summary

There you go. As always, I hope it helps someone out and saves you some time as well as give you more ideas for how to work with your Munki solutions.

As always, if you have any questions, queries or comments, let us know below and I’ll try to respond to and delve into as many as I can.

Disclaimer:
While the author has taken care to provide our readers with accurate information, please use your discretion before acting upon information based on the blog post. Amsys will not compensate you in any way whatsoever if you ever happen to suffer a loss/inconvenience/damage because of/while making use of information in this blog.

Leave a Reply

Your email address will not be published. Required fields are marked *