mirror of
https://github.com/munki/munki.git
synced 2025-12-16 20:14:48 -06:00
Fix issues in munki.py when writing trigger files; edits to launchdaemons so managedsoftwareupdate-loginwindow runs only when a trigger file is present
This commit is contained in:
@@ -256,8 +256,9 @@ def stringFromDate(nsdate):
|
||||
def startUpdateCheck():
|
||||
'''Does launchd magic to run managedsoftwareupdate as root.'''
|
||||
try:
|
||||
f = open(UPDATECHECKLAUNCHFILE, 'w')
|
||||
f.close()
|
||||
if not os.path.exists(UPDATECHECKLAUNCHFILE):
|
||||
open(UPDATECHECKLAUNCHFILE, 'w').close()
|
||||
return 0
|
||||
except (OSError, IOError):
|
||||
return 1
|
||||
|
||||
@@ -353,8 +354,7 @@ def logoutAndUpdate():
|
||||
|
||||
try:
|
||||
if not os.path.exists(INSTALLATLOGOUTFILE):
|
||||
f = open(INSTALLATLOGOUTFILE, 'w')
|
||||
f.close()
|
||||
open(INSTALLATLOGOUTFILE, 'w').close()
|
||||
logoutNow()
|
||||
except (OSError, IOError):
|
||||
return 1
|
||||
@@ -376,11 +376,10 @@ def justUpdate():
|
||||
We touch a file that launchd is is watching
|
||||
launchd, in turn,
|
||||
launches managedsoftwareupdate --installwithnologout as root'''
|
||||
cmd = ["/usr/bin/touch", INSTALLWITHOUTLOGOUTFILE]
|
||||
return call(cmd)
|
||||
try:
|
||||
f = open(INSTALLWITHOUTLOGOUTFILE, 'w')
|
||||
f.close()
|
||||
if not os.path.exists(INSTALLWITHOUTLOGOUTFILE):
|
||||
open(INSTALLWITHOUTLOGOUTFILE, 'w').close()
|
||||
return 0
|
||||
except (OSError, IOError):
|
||||
return 1
|
||||
|
||||
|
||||
@@ -426,6 +426,7 @@ def main():
|
||||
# delete triggerfile if _not_ checkandinstallatstartup
|
||||
os.unlink(filename)
|
||||
if not user_triggered:
|
||||
# no trigger file was found -- how'd we get launched?
|
||||
munkicommon.cleanUpTmpDir()
|
||||
exit(0)
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<dict>
|
||||
<key>/var/run/com.googlecode.munki.MunkiStatus</key>
|
||||
<true/>
|
||||
<key>/private/tmp/com.googlecode.munki.statusatlogout</key>
|
||||
<key>/private/tmp/com.googlecode.munki.installatlogout</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
@@ -18,7 +18,19 @@
|
||||
<string>--logoutinstall</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<false/>
|
||||
<key>KeepAlive</key>
|
||||
<dict>
|
||||
<key>PathState</key>
|
||||
<dict>
|
||||
<key>/private/tmp/com.googlecode.munki.installatlogout</key>
|
||||
<true/>
|
||||
<key>/Users/Shared/.com.googlecode.munki.checkandinstallatstartup</key>
|
||||
<true/>
|
||||
<key>/Users/Shared/.com.googlecode.munki.installatstartup</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user