Skip to content

Instantly share code, notes, and snippets.

@poundbangbash
Created August 20, 2015 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poundbangbash/416f6679a9c110163c40 to your computer and use it in GitHub Desktop.
Save poundbangbash/416f6679a9c110163c40 to your computer and use it in GitHub Desktop.
munki OnDemand example pkginfo
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>OnDemand</key>
<true/>
<key>_metadata</key>
<dict>
<key>created_by</key>
<string>root</string>
<key>creation_date</key>
<date>2015-04-16T16:42:14Z</date>
<key>munki_version</key>
<string>2.2.4.2462</string>
<key>os_version</key>
<string>10.10.3</string>
</dict>
<key>autoremove</key>
<false/>
<key>catalogs</key>
<array>
<string>on-demand-test</string>
</array>
<key>category</key>
<string>SelfService</string>
<key>description</key>
<string>Attempts to sync time, if that fails attempts to sync against Apple's NTP.</string>
<key>developer</key>
<string>Me</string>
<key>display_name</key>
<string>Sync Time</string>
<key>installer_type</key>
<string>nopkg</string>
<key>minimum_os_version</key>
<string>10.4.0</string>
<key>name</key>
<string>SyncTime</string>
<key>postinstall_script</key>
<string>#!/bin/bash
echo ""
echo "======INTERNAL ATTEMPT======"
echo "Attempting to set time from ntp.internal.domain.com"
ntpdate -u ntp.internal.domain.com 2&gt;&amp;1
if [ $? -eq 0 ];
then
echo "======INTERAL SUCCESS======"
echo ""
exit 0
else
echo "======INTERAL FAILED - EXTERNAL ATTEMPT======"
echo "Attempting to set time from time.apple.com"
ntpdate -u time.apple.com 2&gt;&amp;1
if [ $? -eq 0 ];
then
echo "======EXTERNAL SUCCESS======"
echo ""
exit 0
else
echo "======EXTERNAL FAILED======"
echo "Time not changed"
echo ""
fi
fi
</string>
<key>unattended_install</key>
<true/>
<key>version</key>
<string>1.0</string>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment