Hide optional installs in Managed Software Center using JavaScript


Munki 3 brings in something called “Featured items” to Managed Software Center. You can read some munki-dev mailing list discussion about the feature before its implementation.

The way it’s implemented, you add in this key

<key>featured</key>
<true/>
to the pkginfo of the optional installs item you want to have show up in the Software tab of Managed Software Center.

So, previously, the idea was that all optional installs would show up there. With Munki 3, only optional installs marked as “featured” will appear on the main page, though you can still find all optional items through a search or by browsing categories.

If you would like to have the hiding of optional install items per client (and not per item via the pkginfo key), you can use this JavaScript hack I threw together.

Just modify the array of items to omit, and then plop it into the footer_template.html of your client customization.

The script checks that your user is on the All items (Munki 2) or Featured items (Munki 3) page. If your user is on that page, it will hide all the items to omit. Otherwise, it will show all items (so items aren’t disappearing from the search results or from category browsing).

Acknowledgements: Hat tip to Erik Gomez for the idea.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.