diff --git a/code/Managed Software Update/MSUAppDelegate.py b/code/Managed Software Update/MSUAppDelegate.py index 100d7d3b..49a71bdb 100644 --- a/code/Managed Software Update/MSUAppDelegate.py +++ b/code/Managed Software Update/MSUAppDelegate.py @@ -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): diff --git a/code/Managed Software Update/munki.py b/code/Managed Software Update/munki.py index 683be2a5..45facfea 100644 --- a/code/Managed Software Update/munki.py +++ b/code/Managed Software Update/munki.py @@ -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 diff --git a/code/client/managedsoftwareupdate b/code/client/managedsoftwareupdate index b31dc7d5..c0571b9a 100755 --- a/code/client/managedsoftwareupdate +++ b/code/client/managedsoftwareupdate @@ -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'