When adding or removing Optional Software from the list of current installs, suppress Apple Update checks.

This commit is contained in:
Greg Neagle
2013-02-14 16:23:06 -08:00
parent b8416c7162
commit d2eee5e268
3 changed files with 17 additions and 5 deletions

View File

@@ -317,7 +317,7 @@ class MSUAppDelegate(NSObject):
self.quitAlertDidEnd_returnCode_contextInfo_, objc.nil)
def checkForUpdates(self):
def checkForUpdates(self, suppress_apple_update_check=False):
# kick off an update check
# close main window
@@ -331,7 +331,7 @@ class MSUAppDelegate(NSObject):
self.optional_view_controller.setOptionallist_([])
# attempt to start the update check
result = munki.startUpdateCheck()
result = munki.startUpdateCheck(suppress_apple_update_check)
if result == 0:
self.managedsoftwareupdate_task = "manualcheck"
self.munkiStatusController.window.makeKeyAndOrderFront_(self)
@@ -514,7 +514,7 @@ class MSUAppDelegate(NSObject):
optional_install_choices['managed_uninstalls'].append(
row['itemname'])
munki.writeSelfServiceManifest(optional_install_choices)
self.checkForUpdates()
self.checkForUpdates(suppress_apple_update_check=True)
def buildUpdateTableData(self):

View File

@@ -269,11 +269,17 @@ def stringFromDate(nsdate):
return unicode(df.stringForObjectValue_(nsdate))
def startUpdateCheck():
def startUpdateCheck(suppress_apple_update_check=False):
'''Does launchd magic to run managedsoftwareupdate as root.'''
try:
if not os.path.exists(UPDATECHECKLAUNCHFILE):
open(UPDATECHECKLAUNCHFILE, 'w').close()
plist = {}
plist['SuppressAppleUpdateCheck'] = suppress_apple_update_check
try:
FoundationPlist.writePlist(plist, UPDATECHECKLAUNCHFILE)
except FoundationPlist.FoundationPlistException:
# problem creating the trigger file
return 1
return 0
except (OSError, IOError):
return 1

View File

@@ -534,6 +534,12 @@ def main():
launchdtriggerfile = \
'/private/tmp/.com.googlecode.munki.updatecheck.launchd'
if os.path.exists(launchdtriggerfile):
try:
launch_options = FoundationPlist.readPlist(launchdtriggerfile)
options.munkipkgsonly = launch_options.get(
'SuppressAppleUpdateCheck')
except FoundationPlist.FoundationPlistException:
pass
# remove it so we aren't automatically relaunched
os.unlink(launchdtriggerfile)
runtype = 'manualcheck'