Requiring a user to be logged in to install a Munki item

You may occasionally get an item you want installed for clients, but the item is oddly constructed so as to require a user to be logged in. (Relevant Munki-Discuss mailing list thread)

Even though there are supported pkginfo keys in Munki to require a logout or require a reboot, there is no official way to require a login.

So the workaround I prefer is to use a preinstall script. From the Munki wiki:

Failure of the preinstall_script will abort the installation attempt. Failure of the postinstall_script will log errors, but the install will be considered complete.

I’ve created a simple template for a preinstall script that will fail (exit 1) if the user isn’t logged in. Just make that the preinstall_script for your pkginfo, and you’re all set. Make sure to test it, though, obviously.

P.S. I had considered using a admin-provided conditions, but the preinstall_script is handy, because it’s tied to the item, so I don’t have to manually remember the condition each time I add the item to a manifest.


Posted

in

by

Tags:

Comments

Leave a Reply

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