Removed new MSU launch trigger file; combining with existing trigger

This commit is contained in:
Greg Neagle
2011-09-14 10:39:31 -07:00
parent f82da7a1f8
commit 765bf5094f
2 changed files with 19 additions and 14 deletions

View File

@@ -64,9 +64,6 @@ class MSUAppDelegate(NSObject):
self.runmode = runmode
NSLog("Runmode: %s" % runmode)
# Clear our fast-launch trigger file if present.
munki.clearLaunchTrigger()
# Prevent automatic relaunching at login on Lion
if NSApp.respondsToSelector_('disableRelaunchOnLogin'):
NSApp.disableRelaunchOnLogin()
@@ -146,6 +143,9 @@ class MSUAppDelegate(NSObject):
or consoleuser == u"loginwindow"):
# Status Window only, so we should just quit
munki.log("MSU", "exit_munkistatus")
# clear launch trigger file so we aren't immediately
# relaunched by launchd
munki.clearLaunchTrigger()
NSApp.terminate_(self)
# The managedsoftwareupdate run will have changed state preferences

View File

@@ -35,9 +35,10 @@ from Foundation import CFPreferencesAppSynchronize
INSTALLATLOGOUTFILE = "/private/tmp/com.googlecode.munki.installatlogout"
STATUSATLOGOUTFILE = "/private/tmp/com.googlecode.munki.statusatlogout"
UPDATECHECKLAUNCHFILE = \
"/private/tmp/.com.googlecode.munki.updatecheck.launchd"
INSTALLWITHOUTLOGOUTFILE = \
"/private/tmp/.com.googlecode.munki.managedinstall.launchd"
MSULOGDIR = \
"/Users/Shared/.com.googlecode.munki.ManagedSoftwareUpdate.logs"
MSULOGFILE = "%s.log"
@@ -254,8 +255,11 @@ def stringFromDate(nsdate):
def startUpdateCheck():
'''Does launchd magic to run managedsoftwareupdate as root.'''
result = call(["/usr/bin/touch", UPDATECHECKLAUNCHFILE])
return result
try:
f = open(UPDATECHECKLAUNCHFILE, 'w')
f.close()
except (OSError, IOError):
return 1
def getAppleUpdates():
@@ -351,9 +355,6 @@ def logoutAndUpdate():
if not os.path.exists(INSTALLATLOGOUTFILE):
f = open(INSTALLATLOGOUTFILE, 'w')
f.close()
if not os.path.exists(STATUSATLOGOUTFILE):
f = open(STATUSATLOGOUTFILE, 'w')
f.close()
logoutNow()
except (OSError, IOError):
return 1
@@ -364,8 +365,8 @@ def clearLaunchTrigger():
typically because we have been launched in statusmode at the
loginwindow to perform a logout-install.'''
try:
if os.path.exists(STATUSATLOGOUTFILE):
os.unlink(STATUSATLOGOUTFILE)
if os.path.exists(INSTALLATLOGOUTFILE):
os.unlink(INSTALLATLOGOUTFILE)
except (OSError, IOError):
return 1
@@ -375,10 +376,14 @@ def justUpdate():
We touch a file that launchd is is watching
launchd, in turn,
launches managedsoftwareupdate --installwithnologout as root'''
cmd = ["/usr/bin/touch",
"/private/tmp/.com.googlecode.munki.managedinstall.launchd"]
cmd = ["/usr/bin/touch", INSTALLWITHOUTLOGOUTFILE]
return call(cmd)
try:
f = open(INSTALLWITHOUTLOGOUTFILE, 'w')
f.close()
except (OSError, IOError):
return 1
def getRunningProcesses():
"""Returns a list of paths of running processes"""