Changes to use the new LaunchAgent mechanism to allow managedsoftwareupdate (running in the root context) to reliably launch Managed Software Update.app in the user's context.

git-svn-id: http://munki.googlecode.com/svn/trunk@437 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-02-04 18:56:48 +00:00
parent 1e5d939458
commit 47385bac22
3 changed files with 10 additions and 14 deletions

View File

@@ -211,9 +211,14 @@ def notifyUserOfUpdates(manualcheck=False):
'/Library/Preferences/ManagedInstalls',
'LastNotifiedDate', '-date', now.ctime()]
retcode = subprocess.call(cmd)
# notify user of available updates
result = munkicommon.osascript(
'tell application "Managed Software Update" to activate')
# notify user of available updates using LaunchAgent to start
# Managed Software Update.app in the user context
launchfile = "/var/run/com.googlecode.munki.ManagedSoftwareUpdate"
cmd = ['/usr/bin/touch', launchfile]
retcode = subprocess.call(cmd)
time.sleep(1)
if os.path.exists(launchfile):
os.unlink(launchfile)
def main():

View File

@@ -373,7 +373,7 @@ def pythonScriptRunning(scriptname):
def osascript(osastring):
'''Wrapper to run AppleScript commands'''
cmd = ['osascript', '-e', osastring]
cmd = ['/usr/bin/osascript', '-e', osastring]
p = subprocess.Popen(cmd, shell=False, bufsize=1, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(out, err) = p.communicate()

View File

@@ -41,18 +41,9 @@ def launchMunkiStatus():
launchfile = "/var/run/com.googlecode.munki.munkistatus"
cmd = ['/usr/bin/touch', launchfile]
retcode = subprocess.call(cmd)
time.sleep(1)
if os.path.exists(launchfile):
os.unlink(launchfile)
# OLD: let LaunchServices try
#retcode = subprocess.call(["/usr/bin/open", "-a", "MunkiStatus.app"])
#if retcode:
# # that failed; let's look for an exact path
# munkiStatusPath = \
# "/Library/Application Support/Managed Installs/MunkiStatus.app"
# if os.path.exists(munkiStatusPath):
# retcode = subprocess.call(["/usr/bin/open", "-a",
# munkiStatusPath])
def launchAndConnectToMunkiStatus():