Adding an item to your Munki repo

Now that you’ve set up your Munki repo and installed Munki tools, let’s get an item into the Munki repo.

Get an item to import

In the future, we’ll look at a way to automate downloading new software into your Munki repo, but for now, let’s just manually download something. Firefox is as good an item to start with as any. It’s a simple drag-and-drop .app bundle, and it’s free to download. So go ahead and download Firefox.

Import the item

There are command-line tools to do everything you want to manage your Munki repo. I actually prefer to use a point-and-click program (which we’ll install later) to manage my Munki repo, but even with that, I still use the command-line for importing items into Munki, because they ask a lot of questions, and because they can create a .dmg on the fly for an .app bundle that doesn’t already come in a .dmg.

Let’s go ahead and use munkiimport to import Firefox.
munkiimport Downloads/Firefox\ 64.0.2.dmg
I’m using a specific version of Firefox for this example, but obviously use whatever version you downloaded. Tab completion can be helpful here. Once you type Firefox, hit Tab, and the rest should fill in, as long as you don’t have multiple Firefox versions downloaded to the same folder.
Item name: Firefox
munkiimport may detect the item name. Please pay special attention to what you fill in here. You can go with whatever munkiimport suggests or put in your own preferred name, but names are how Munki refers to items. The display name and description below are things your users will see later, but the item name is what will change Munki functionality. If you have an item named Firefox that has a display name of Firefox and then another item named MozillaFirefox that has a display name of Firefox, your users may see them as the same, but Munki will see them as different, because they have different item names.
Display name: Mozilla Firefox
Description: Firefox web browser

For things that munkiimport doesn’t detect, go ahead and just fill in whatever you think is appropriate. You can also leave these blank, but I’d recommend filling in as much as you can.
Version: 64.0.2
Because this is an .app bundle, the version should be easily detectable (assuming the vendor packaged it properly), so you may find the version fills in automatically.
Category: Browsers
Developer: Mozilla

Once again, the more information you can give your users, the better. But you can leave these blank if you really want to.
Unattended install: True
Unattended uninstall: True

munkiimport will have these default to False, but in almost all cases (with some exceptions we’ll go into later), you’ll want to change these to True. If you even just type t, that’ll work, too. You don’t have to type out the entire word True.
Catalogs: testing
You almost always want to start with adding only to the testing catalog. Even if your testing is only to make sure the program installs successfully, and then launches up and doesn’t crash immediately afterwards, that’s still better than putting it immediately into production.
Import this item? [y/n] y
Type y to confirm you want to import the item.
Upload item to subdirectory path []:
Some Munki admins like to put items into various subfolders for their own organizational purposes. In terms of functionality and performance, your Munki clients won’t care whether the item is at the top level or in a subfolder. I usually just go with the top-level (so hit Return here), but if you feel strongly about using your own subfolders, go for it, and organize it however you want.
No existing product icon found.
Attempt to create a product icon? [y/n] y
Attempting to extract and upload icon...
Imported icons/Firefox.png.

It will look prettier and be easier to navigate for your users if you have icons for the items in your Munki repo, so it’s worth it to see if munkiimport can extract a missing icon.

Many times (as with Firefox), it will find an appropriate icon, and then all is good. Sometimes, it may find various icons and not know which one to use, in which case, you’ll get numbered icons (e.g., NAMEOFITEM_1.png, NAMEOFITEM_2.png, NAMEOFITEM_3.png)—it would then be your job to go into the icons folder and rename one to be NAMEOFITEM.png and then delete the extraneous ones.
Copying Firefox 64.0.2.dmg to repo...
Copied Firefox 64.0.2.dmg to pkgs/Firefox 64.0.2.dmg.
Edit pkginfo before upload? [y/n]: n

There may be sometimes you want to edit the pkginfo file for the item before you rebuild the catalogs, but in most cases, you’ll just want to proceed. Provided the vendor has packaged things properly munkiimport is fairly good at detecting the right settings for each item.
Saved pkginfo to pkgsinfo/Firefox-64.0.2.
Rebuild catalogs? [y/n] y
Rebuilding catalogs at file:///Users/Shared/munki_repo...
Created icons/_icon_hashes.plist...

Munki clients cannot see pkginfo files. They see catalogs. So if you change a pkginfo file and want your Munki clients to pick up on those changes, you need to rebuild the catalogs. Since munkiimport prompts you, you can just type y to confirm you want catalogs rebuilt. If you edit a pkginfo file manually yourself later (apart from munkiimport), you’ll want to run the
makecatalogs
command manually afterwards.

Also, if you’re importing several items manually with munkiimport, you may want to wait until after the last item is done before you decide to rebuild catalogs. You can rebuild after each one, too—it may just take a little longer than doing it only once at the end.

Taking a look at what happened after an item import

After you do this import, your Munki repo should look like this:
catalogs/all
catalogs/testing

The all catalog has all the catalog info, but since you have only a testing catalog, right now the two are identical. You can take a look at these two files just to see what they look like, but you should never manually edit a catalog file.
icons/_icon_hashes.plist
icons/Firefox.png

The icon hashes have hashes for each icon in the directory, and then you have the icons you extracted or manually copied to the icons directory. See? There’s your Firefox.png that munkiimport extracted from the .app in the .dmg.
manifests/
We don’t have any manifests yet. We’ll make one in the next tutorial.
pkgs/Firefox 64.0.2.dmg
When you import an item, whatever “installer” it has munkiimport will copy to the pkgs directory. That can be a .mobileconfig profile, a .pkg, or a .dmg.

Remember when you could have created a subdirectory? Well, if you had, your Firefox would be in pkgs/NAMEOFYOURSUBDIRECTORY/Firefox VERSIONNUMBER.dmg instead of pkgs/Firefox VERSIONNUMBER.dmg.
pkgsinfo/Firefox-64.0.2.pkginfo
munkiimport creates a pkginfo file for the Firefox item. This has all the information that will get put into the catalogs file(s) that your Munki clients will use to decide whether Firefox (or whatever item it is) is installed already, how to install it, how to remove it, which is the newest version, etc.

Leave a comment

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