Skip to content

Releases: eahrold/MunkiMenu

MunkiMenu v0.3.0

11 Apr 20:08
Compare
Choose a tag to compare

Status Bar item for configuring and running Managed Software Update.
For deploying with Munki See the install page for details

Improvements

  • New Icon
  • Now you can install optional installs from munki menu
  • Other bug fixes

Please create new issues as you find them. Thanks.

MunkiMenu 0.2.6

07 Apr 20:48
Compare
Choose a tag to compare
MunkiMenu 0.2.6 Pre-release
Pre-release

Status Bar item for configuring and running Managed Software Update.
For deploying with Munki See the MunkiMenu repo for details

Major Fix

in v0.2.5 if the --postinstall argument was passed to the MunkiMenu binary at the loginwindow
ManagedSoftwareUpdate would hang. Now MunkiMenu does a better job checking for valid
arguments and exits quietly if there's an error letting installs continue.

Version 0.2.4

25 Feb 18:54
Compare
Choose a tag to compare
Version 0.2.4 Pre-release
Pre-release

Status Bar item for configuring and running Managed Software Update.

For deploying with Munki See the MunkiMenu repo for details

Initial Release MunkiMenu

20 Feb 22:52
Compare
Choose a tag to compare
Pre-release

Simple Status Bar item for launching Managed Software Update.

There are two downloads available, the first is an installer package dmg that will handle the installation of the helper app, launched file on it's own. This is a good choice for unmanaged distribution.

However if distributing with Munki (which would make sense) you should choose the MunkiMenu-App.dmg which just a file-copy distribution and include the following code as a post-install script in the Munki pkginfo.

#!/usr/bin/python

import os
import subprocess
import shutil
import plistlib

from SystemConfiguration import SCDynamicStoreCopyConsoleUser
from AppKit import NSWorkspace

app_name    = 'MunkiMenu'
install_dir = 'Applications'

def writeLaunchAgent(launch_agent,app_path):
    #write out the LaunchDaemon Plist
    launchd_file = os.path.join('/Library','LaunchAgents',launch_agent+'.plist')

    prog_args = os.path.join(app_path,'Contents','MacOS',app_name
    )

    launchd_job = {'Label':launch_agent,
                    'Program':prog_args,
                    'RunAtLoad':True,
                    }

    plistlib.writePlist(launchd_job,launchd_file )

    #fix the permissions 
    subprocess.call(['/usr/sbin/chown','root:wheel',launchd_file])
    subprocess.call(['/bin/chmod','0644',launchd_file])

def writeHelperLaunchD(helper_id):
    #write out the LaunchDaemon Plist
    launchd_file = os.path.join('/Library','LaunchDaemons',helper_id+'.plist')

    prog_args = [os.path.join('/Library','PrivilegedHelperTools',helper_id)]

    launchd_plist = {'Label':helper_id,
                     'MachServices':{helper_id:True},
                     'ProgramArguments':prog_args}

    plistlib.writePlist(launchd_plist,launchd_file)

    #fix the permissions 
    subprocess.call(['/usr/sbin/chown','root:wheel',launchd_file])
    subprocess.call(['/bin/chmod','0644',launchd_file])

    #load the launchD job
    subprocess.call(['/bin/launchctl','load',launchd_file])

def copyHelper(helper_id,app_path):
    src = os.path.join(app_path,'Contents','Library','LaunchServices',helper_id)

    dst = os.path.join('/Library/PrivilegedHelperTools/',helper_id)
    shutil.copyfile(src, dst)

    subprocess.call(['/usr/sbin/chown','root:wheel',dst])
    subprocess.call(['/bin/chmod','544',dst])

def launchApp(app_path):
    #if there is a logged in user launch MunkiMenu
    cfuser = SCDynamicStoreCopyConsoleUser( None, None, None )
    if cfuser[0]:
        wksp = NSWorkspace.sharedWorkspace()
        wksp.launchApplication_(app_path)

def getBundleID(app_path):
    info_plist = os.path.join(app_path,'Contents','Info.plist')
    p = plistlib.readPlist(info_plist)
    bundle_id = p['CFBundleIdentifier']
    return bundle_id

def main():
    app_path = os.path.join('/',install_dir,app_name+'.app')

    bundle_id = getBundleID(app_path)
    helper_id = bundle_id+'.helper'
    launch_agent = bundle_id+'launcher'

    copyHelper(helper_id,app_path)
    writeHelperLaunchD(helper_id)
    writeLaunchAgent(launch_agent,app_path)
    launchApp(app_path)

if __name__ == "__main__":
    main()