Dec 9, 2022, 1:44:17 PM12/9/22
to munki-dev, 'Gregory Neagle' via munki-discuss
I’m working on a new feature for Munki. I wanted an elegant way to define certain items that should be installed by default, but allow the user to manually “opt-out” and remove these items. We can call them “default optional installs” or just “default installs”.
It’s possible to do things along these lines by installing a pre-defined SelfServeManifest file at deploy time, or though somewhat complex scripting. The first approah doesn’t help with already-deployed machines, or if you change your mind later and need to add aditional default installs. The second relies on scripting skills and is hard to maintain. document, and understand.
I have a new branch in the git repo: “default_installs”, which contains the new code supporting this new feature. Changes are to the core Munki command line tools (managedsoftwareupdate) and Managed Software Center.app.
Here’s how it works:
In a manifest, you can define “default_installs”:
When managedsoftwareupdate runs, if it finds any default_installs, it checks to see if they have already been added to the local SelfServeManifest under the “default_installs” key. If they have not, they are added to the local SelfServeManifest, under the “default_installs” key _and also_ under the “managed_installs” key.
The SelfServiceManifest is processed as normal, and any items in managed_installs are ensured installed. But since this is the SelfServeManifest, the end-user can use Managed Software Center to cancel the installation of an item (before it is actually installed, or remove it (after it has been installed).
If they cancel or remove it, it will be removed from the SelfServiceManifest’s managed_installs. On a subsequent managedsoftwareupdate run, Munki will see the item was already added to “default_installs” in the SelfServeManifest, and so will not re-add it to the managed_installs of that same manifest.
Note the items in “default_installs” must also exist in “optional_installs” — they are simply a set of optional install items that will be installed by default. So in the above example, GoogleChrome, Firefox, MicrosoftWord, and MicrosoftExcel must also exist in optional_installs.
Feel free to play with the new feature in the “default_installs” branch, and raise any issues you may find.
Is “default_installs” a clear name for this new feature? Is there a better implementation I’m missing?