mirror of
https://github.com/munki/munki.git
synced 2026-01-06 06:29:56 -06:00
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:
@@ -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():
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user