Skip to content

Commit

Permalink
sys_patch.py: Clean-up non-Metal enforcement during preflight & unpatch
Browse files Browse the repository at this point in the history
  • Loading branch information
flagersgit committed May 28, 2022
1 parent 46549b6 commit db72c0c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions resources/sys_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def unpatch_root_vol(self):
print("- Failed to revert snapshot via Apple's 'bless' command")
else:
self.clean_skylight_plugins()
self.delete_nonmetal_enforcement()
self.constants.root_patcher_succeded = True
print("- Unpatching complete")
print("\nPlease reboot the machine for patches to take effect")
Expand Down Expand Up @@ -193,6 +194,14 @@ def clean_skylight_plugins(self):
else:
print("- Creating SkylightPlugins folder")
utilities.process_status(utilities.elevated(["mkdir", "-p", f"{self.mount_application_support}/SkyLightPlugins/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))

def delete_nonmetal_enforcement(self):
use_metal = subprocess.run(["defaults", "read", "/Library/Preferences/com.apple.CoreDisplay", "useMetal"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
use_iop = subprocess.run(["defaults", "read", "/Library/Preferences/com.apple.CoreDisplay", "useIOP"], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
if use_metal or use_iop in ["1", "true"]:
print("- Removing non-Metal Enforcement Preferences")
subprocess.run(["defaults", "delete", "/Library/Preferences/com.apple.CoreDisplay", "useMetal"])
subprocess.run(["defaults", "delete", "/Library/Preferences/com.apple.CoreDisplay", "useIOP"])

def write_patchset(self, patchset):
destination_path = f"{self.mount_location}/System/Library/CoreServices"
Expand Down Expand Up @@ -260,6 +269,8 @@ def preflight_checks(self, required_patches, source_files_path):

# Make sure old SkyLight plugins aren't being used
self.clean_skylight_plugins()
# Make sure non-Metal Enforcement preferences are not present
self.delete_nonmetal_enforcement()

# Make sure SNB kexts are compatible with the host
if "Intel Sandy Bridge" in required_patches:
Expand Down

0 comments on commit db72c0c

Please sign in to comment.