Using Firefox, CCK2 and AutoPKG

Are you using Firefox and CCK2 in your environment? Are you fed up with manually repackaging your CCK2 tweaks each time Firefox is updated prior to deployment? Are you fed up of not being able to use AutoPKG to do this for you? Well this blog is for you!
But first, a little background.
If you’ve seen some of my previous blogs, you’ll have seen the various attempts I’ve made to customise, package, detect and deploy Firefox.
For customisation, CCK2 (from Mike Kaply) is still the best way to do it. Check out some of my previous blogs for detailed guides on how to do so.
For others, you may have heard about the new(-ish) phenomenon that has swept the Mac Admin community AutoPKG.
This blog aims to pull these three together items together allowing the automatic detection of new Firefox updates, automatically add in a CCK2 auto config file, and package the app as a pkg (or add into a Munki Repository).
Credit where credit is due
I can’t take anything like full responsibility for the AutoPKG recipe this blog uses. This is all down to the excellent Greg Neagle. So the next time you see him, feel free to say thanks…I’ve heard a beer is the normal charge for Mac Admins!
Other credit goes to Mike Kaply whom without, customising Firefox would be a daunting and ever changing task. Again thanks is always welcome!

Obtaining the recipe

Firstly, we need to get hold of the recipe to run it! I’ll assume you already have AutoPKG installed at this point.

    1. Fire up the Terminal application on your AutoPKG Mac and enter the following, followed by the ‘return’ key.
autopkg search firefox

(The new ‘search’ verb has been added recently to AutoPKG to scan through a number of recipe repositories on GitHub searching for the phrase you provide and returning a list of possible recipes that could match it.)

    1. You’ll get returned a long list of results, listed by Repo name, but displaying the recipe name and the repo path it is located at.

repo name

    1. The ones we’re looking for are called “FirefoxAutoconfig” (highlighted here)

firefox auto config highlighted

    1. How do we get these into our AutoPKG ready for use? Well the search results already provide the command for you!

autopkg repo

    1. So let’s run that.
autopkg repo-add gregneagle-recipes

auto pkg repo add

    1. You’ll then see AutoPKG try to pull down the new repo, and update the local AutoPKG search paths. I’ve highlighted the newly added repo.

auto pkg pulldown

    1. There we go, we now have the new repo added and the recipes it contains available for use.
    2. But what if you’ve downloaded a new recipe and are not sure how to use it? AutoPKG has you covered. Run the below command to see any provided information about the recipe specified.
autopkg info FirefoxAutoConfig.pkg

auto pkg firefox autoconfig

    1. In this example, I have run it on one of the new recipes we grabbed from Greg’s repo. Look at all that lovely documentation!

gregs repo

Using the Autoconfig CCK2 file

So now we’ve got the recipe we need, but what’s this? The recipe information talks about placing an ‘’ file somewhere? Let me help.

    1. Launch Firefox and the CCK2 tool and build your customisation as desired (or import one you’ve already completed).
    2. On the last page, select the option for ‘Use AutoConfig’.

auto config cck2

    1. This will spit out a .zip file called “AutoConfig” into the directory you told the CCK tool to save its file. This is the golden file we need to use with AutoPKG.

auto config zip demo

    1. Locate this file in the GUI.

auto config gui

    1. Open a second Finder window and navigate to the location of the nearly downloaded repo. By default, this would be at:

auto config recipe repos

    1. Into this Mozilla folder, drag in a copy of your ‘’ file.

mozilla folder

    1. Ta Da! This all the preparation work done.

prep done

Using the final recipe

But how do I make it go? Don’t worry, I’ll take you through running this in the command line.

    1. Go back to that Terminal window you had open. Did you close it? No problem! Just open a new one.
    2. Run the below command to start the process.
autopkg run -v FirefoxAutoConfig.pkg

final recipe run
(In case you’re wondering, the `-v` isn’t required but gives a more verbose output. Good to see what’s going on and where any issues might be)

    1. This will run a whole lot of task and, especially if you use `-v`, will show a lot of output.

final recipe 2

    1. As you can see by the last line, it packaged up a new version 39.0 of Firefox with the CCK file already extracted into the bundle.

cck auto config zip

    1. Open that location in the Finder and there’s your nice pre-done Firefox package.

firefox package

  1. Add that into your usual deployment solution to push out your updated Firefox bundle complete with CCK2 customisations!

But what if…

But what if I use Munki?
Assuming you have AutoPKG configured with Munki integration, run the .munki recipe instead of the .pkg one to automatically import the finished product into your Munki repo.
But what if I use Casper?
To my knowledge, there is not yet a recipe to add this Firefox into the Casper solution, however you can manually upload the package and adjust any relevant smart groups and policies. Alternatively, why not have a go at building your own ‘bolt-on’ recipe to do this?
But what if I want to automate this?
Ah, my favourite word (sort of). If you’re running AutoPKGr, simply enable the required recipe (‘FirefoxAutoConfig.pkg’ or ‘FirefoxAutoConfig.munki’) in the AutoPKGr GUI and off you go. For any other solution (such as using Jenkins) simply add the recipe as you have done for any others you are running.
The important thing is that the file is in the same directory as the recipe.
But what if I don’t want to keep my file there?
Fair point. As you may have seen in the `autopkg info` run, you can create a recipe override that specifies another location for the file.


Well there you go! I hope that gives you enough information to add even more automation to your Firefox deployment workflows and gives you more free time for answering tickets. Or maybe that time off you’ve been promising yourself.
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.