Hi again, and welcome to the third instructional blog in this Munki series. In this post, I will show you how I import a new installer into the Munki Repo from the command line.
Some notes for this series as a whole:
- These instructions have been written for our internal teams and for our typical installations. Tweaks may be required to fit your exact setup.
- The server used in these examples is Mac OS X Server 10.8.4.
- The server uses Mac Server App version 2.2.1.
- The server has been configured with a boot drive called “ServerHD” and a data drive called “DataHD” for the services data.
- The clients used in these examples are Mac OS X 10.8.4, although the instructions have been tested on Mac OS X 10.8.2+.
- Munki is provided free of charge under the Open Source license. Although free, your mileage may vary, so test any solutions heavily before rolling them out as ‘live’.
Additional information can be found on the Munki site.
Guide
You have your Mac Server installed and configured with 10.8.4 and Server app 2.2.1. This has both forward and reverse lookups configured and working fine. I will also assume that you have already followed all the steps in part 1 and part 2.
Catalogs Vs. Manifests
A Manifest is what each client Mac is pointed at to know what software it should install; offer as an Optional Install or to remove. For example, the manifest of “test_mac” would tell all Macs that talk to this manifest to install the application “Firefox”.
What if there is a new version of Firefox? A version that you need to roll out to test Macs but not all of them? That’s where Catalogs come in.
Catalogs are used to specify what version of an Application should be installed onto the specific Mac. By default, all newly imported installers go into the “testing” Catalog.
Importing your first installer
1.For this example I have downloaded the Java Version 7 update 40 installer. Launch the Terminal application.
2.Type into the window “/usr/local/munki/munkiimport” followed by a space and the path to your installer.
For example:
/usr/local/munki/munkiimport /Volumes/Java\ 7\ Update\ 40/Java\ 7\ Update\ 40.pkg
3. This will start the import installer wizard. For any question, the wizard will try and offer the correct answer (the answer shown in square brackets). If this is correct, do not type anything and hit return to just accept the answer.
4. The first question is the name of the Item that will be saved. Type this in and press return.
5. The next question asks how you want the name to appear to the end user. Type this in and hit return. In the screenshot, I have accepted the suggested name by leaving my answer blank and pressing return.
6. The next question is what description you’d like shown to the end user. Type this out and press return.
7. The next question is the version of the application that will be installed. I will discuss the Java installer in a later blog post, but the Java update is always installed as v1.0. I have overridden this with 7.40. Enter the desired version number (if needed) and hit return.
8. The next question is what Catalog to put the installer into. If you have been following my previous instructions, this will default to “testing” but can be overridden at this stage. I have left the default and pressed return.
9. You will now be presented with a summary of you choices and asked to import the item. If incorrect, press “n” and return to rerun the wizard. If correct, press “y” and return.
10. You will be asked if you’d like to upload the installer into a folder within the munki_repo pkgs folder (“Upload Item to subdirectory path”). Feel free to type in a subdirectory path and hit return. You’ll be asked if it’s ok to create the folders if not already present. If you’re happy to dump the installer straight into the pkgs folder, just hit return. The installer file will now be uploaded.
11. Once the upload is complete, the pkginfo file will be opened in whatever the default Application was set in the last blog. In my case it’s TextEdit.app. This allows you to customise the pkginfo file with additional options and settings that aren’t part of the wizard.
More keys can be found here.
12. Once complete, you will be asked to “rebuild the Catalogs”. This will take all the information you have entered above, and use it to create a ‘pkgsinfo’ file for your installer. Press “y” and then return.
Please Note: Whenever asked, almost always rebuild catalogs. If no changes have been made, this will not cause any problems. If you have made changes but don’t rebuild the catalogs, this can show up as unexpected behaviour.
13. Once the Catalog is rebuilt, you will be returned to the command prompt. The installer is now added into Munki!
Adding your installer to a new Manifest
14. Feel free to quit and reopen Terminal (or use “cmd” + “k”) to clear the window out. 15. Enter the following command into Terminal and press return.
/usr/local/munki/manifestutil
16. This will launch an interactive session where you can type commands in. Enter the following command and press return:
new-manifest standard_manifest
This will create a new manifest called “standard_manifest”
17. Next we need to add our catalog above (“testing”) to this new manifest. Enter the following command and press return:
add-catalog testing --manifest standard_manifest
18. You should get a message to say that the ‘testing’ catalog has been added to the ‘standard_manifest’ manifest. 19. Next we need to add the installer into the manifest as an item to be installed. This needs to be the name of the installer from when we added it to the Munki system above. Enter the following command and press return:
add-pkg Java\ 7\ Update\ 40-7.40 --manifest standard_manifest
20. Once complete, you will be returned to a prompt (“>”). Type “exit” an press enter to quit out of the Manifest Utility.
21. You have now added the installer into the manifest. Once you have a client configured to use this manifest, it should try and install Java Version 7 Update 40, as long as this version or newer isn’t installed.
Summary
That’s it; you now have a rough and ready understanding of how to add installers into Munki, and into Munki manifests via the command line. Next time I’ll show you a cheating method with the use of the excellent MunkiAdmin.app, thereby making this whole post irrelevant! However, I’d suggest this is attempted at least once to understand how it’ll all work.
Any hints, tips or opinions? Let us know in the comments below and I’ll try to respond to 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. This feature has been tested using OS X v10.9.0 which was the latest Mac OS release at the time of writing.