Speed launch of MSU.app status mode to cover the login window following logout install actions.

This commit is contained in:
Rob Middleton
2011-09-07 21:23:48 +10:00
parent e334b9eb13
commit cb5e0076d0
6 changed files with 55 additions and 2 deletions

View File

@@ -64,6 +64,9 @@ 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()

View File

@@ -35,6 +35,7 @@ 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"
MSULOGDIR = \
@@ -350,11 +351,25 @@ 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
def clearLaunchTrigger():
'''Clear the trigger file that fast-launches us at loginwindow.
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)
except (OSError, IOError):
return 1
def justUpdate():
'''Trigger managedinstaller via launchd KeepAlive path trigger
We touch a file that launchd is is watching

View File

@@ -102,6 +102,9 @@ def alertUserOfForcedLogout(info=None):
# make sure flag is in place to cause munki to install at logout
f = open('/private/tmp/com.googlecode.munki.installatlogout', 'w')
f.close()
# drop flag for speedier launch of status window covering loginwindow
f = open('/private/tmp/com.googlecode.munki.statusatlogout', 'w')
f.close()
def main():