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():

View File

@@ -6,7 +6,6 @@
<string>com.googlecode.munki.MunkiStatus</string>
<key>LimitLoadToSessionType</key>
<array>
<string>LoginWindow</string>
<string>Aqua</string>
</array>
<key>EnvironmentVariables</key>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.googlecode.munki.MunkiStatusLogin</string>
<key>LimitLoadToSessionType</key>
<array>
<string>LoginWindow</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>ManagedSoftwareUpdateMode</key>
<string>MunkiStatus</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/Applications/Utilities/Managed Software Update.app/Contents/MacOS/Managed Software Update</string>
</array>
<key>RunAtLoad</key>
<false/>
<key>KeepAlive</key>
<dict>
<key>PathState</key>
<dict>
<key>/var/run/com.googlecode.munki.MunkiStatus</key>
<true/>
<key>/private/tmp/com.googlecode.munki.statusatlogout</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>CFBundleShortVersionString</key>
<string>0.8.0</string>
<string>0.8.0.1</string>
</dict>
</plist>