Default optional installs

113 views
Skip to first unread message

Gregory Neagle

unread,
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”:

<key>default_installs</key>
<array>
<string>GoogleChrome</string>
<string>Firefox</string>
<string>MicrosoftWord</string>
<string>MicrosoftExcel</string>
</array>

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?

-Greg


MiqViq

unread,
Dec 9, 2022, 2:08:55 PM12/9/22
to munk...@googlegroups.com
Hi Greg,


sounds like a very useful feature!

I would vote for naming the key as default_optional_install, it is maybe more self-explanatory (although a bit longish).


- MiqViq
> --
> Find related discussion groups here:
> https://github.com/munki/munki/wiki/Discussion-Group
> ---
> You received this message because you are subscribed to the Google Groups "munki-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/munki-dev/2BE906B1-8A7E-4B78-8B78-0DA68D952F78%40mac.com.

Per Olofsson

unread,
Dec 13, 2022, 6:42:41 AM12/13/22
to munk...@googlegroups.com
9 dec. 2022 kl. 19:44 skrev 'Gregory Neagle' via munki-dev <munk...@googlegroups.com>:

Is “default_installs” a clear name for this new feature? Is there a better implementation I’m missing?

The name seems clear to me. I've played with this workflow by using an initial manifest with managed_installs, and then switching to a manifest with optional_installs, but it's great to see an official implementation. I can see us adopting it for a few packages.

--
Per Olofsson, IT-service, University of Gothenburg

Reply all
Reply to author
Forward
0 new messages