sys_patch.py: Test rerouting patches to root

This commit is contained in:
Mykola Grymalyuk
2024-08-26 17:10:51 -06:00
parent 132f12c885
commit f931c3b6c2
6 changed files with 419 additions and 17 deletions

View File

@@ -719,7 +719,9 @@ class DetectRootPatch:
return True
if any([self.kepler_gpu, self.ivy_gpu, self.haswell_gpu]):
if Path("~/.dortania_developer").expanduser().exists():
return True
# Temporarily hard coded
if Path("/Library/Application Support/Dortania/MetallibSupportPkg/15.0-24A5327a").exists():
return True
return False
return True

View File

@@ -66,6 +66,7 @@ class GenerateRootPatchSets:
if self.hardware_details["Graphics: Intel Ivy Bridge"] is True:
required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]})
required_patches.update({"Metal 3802 Common Extended": all_hardware_patchset["Graphics"]["Metal 3802 Common Extended"]})
required_patches.update({"Metal 3802 .metallibs": all_hardware_patchset["Graphics"]["Metal 3802 .metallibs"]})
required_patches.update({"Catalina GVA": all_hardware_patchset["Graphics"]["Catalina GVA"]})
required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]})
required_patches.update({"Big Sur OpenCL": all_hardware_patchset["Graphics"]["Big Sur OpenCL"]})
@@ -75,6 +76,7 @@ class GenerateRootPatchSets:
if self.hardware_details["Graphics: Intel Haswell"] is True:
required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]})
required_patches.update({"Metal 3802 Common Extended": all_hardware_patchset["Graphics"]["Metal 3802 Common Extended"]})
required_patches.update({"Metal 3802 .metallibs": all_hardware_patchset["Graphics"]["Metal 3802 .metallibs"]})
required_patches.update({"Monterey GVA": all_hardware_patchset["Graphics"]["Monterey GVA"]})
required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]})
required_patches.update({"Intel Haswell": all_hardware_patchset["Graphics"]["Intel Haswell"]})
@@ -105,6 +107,7 @@ class GenerateRootPatchSets:
if self.hardware_details["Graphics: Nvidia Kepler"] is True:
required_patches.update({"Metal 3802 Common": all_hardware_patchset["Graphics"]["Metal 3802 Common"]})
required_patches.update({"Metal 3802 Common Extended": all_hardware_patchset["Graphics"]["Metal 3802 Common Extended"]})
required_patches.update({"Metal 3802 .metallibs": all_hardware_patchset["Graphics"]["Metal 3802 .metallibs"]})
required_patches.update({"Catalina GVA": all_hardware_patchset["Graphics"]["Catalina GVA"]})
required_patches.update({"Monterey OpenCL": all_hardware_patchset["Graphics"]["Monterey OpenCL"]})
required_patches.update({"Big Sur OpenCL": all_hardware_patchset["Graphics"]["Big Sur OpenCL"]})

View File

@@ -379,7 +379,11 @@ class PatchSysVolume:
for install_patch_directory in list(required_patches[patch][method_install]):
logging.info(f"- Handling Installs in: {install_patch_directory}")
for install_file in list(required_patches[patch][method_install][install_patch_directory]):
source_folder_path = source_files_path + "/" + required_patches[patch][method_install][install_patch_directory][install_file] + install_patch_directory
source_folder_path = required_patches[patch][method_install][install_patch_directory][install_file] + install_patch_directory
# Check whether to source from root
if not required_patches[patch][method_install][install_patch_directory][install_file].startswith("/"):
source_folder_path = source_files_path + "/" + source_folder_path
if method_install == "Install":
destination_folder_path = str(self.mount_location) + install_patch_directory
else:
@@ -436,10 +440,27 @@ class PatchSysVolume:
logging.info("- Running Preflight Checks before patching")
for patch in required_patches:
# Check if all files are present
for method_type in ["Install", "Install Non-Root"]:
if method_type not in required_patches[patch]:
continue
for install_patch_directory in required_patches[patch][method_type]:
for install_file in required_patches[patch][method_type][install_patch_directory]:
source_file = required_patches[patch][method_type][install_patch_directory][install_file] + install_patch_directory + "/" + install_file
# Check whether to source from root
if not required_patches[patch][method_type][install_patch_directory][install_file].startswith("/"):
source_file = source_files_path + "/" + source_file
if not Path(source_file).exists():
raise Exception(f"Failed to find {source_file}")
# 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 we clean old kexts in /L*/E* that are not in the patchset
kernelcache.KernelCacheSupport(
mount_location_data=self.mount_location_data,
@@ -451,17 +472,6 @@ class PatchSysVolume:
if "Intel Sandy Bridge" in required_patches:
sys_patch_helpers.SysPatchHelpers(self.constants).snb_board_id_patch(source_files_path)
for patch in required_patches:
# Check if all files are present
for method_type in ["Install", "Install Non-Root"]:
if method_type not in required_patches[patch]:
continue
for install_patch_directory in required_patches[patch][method_type]:
for install_file in required_patches[patch][method_type][install_patch_directory]:
source_file = source_files_path + "/" + required_patches[patch][method_type][install_patch_directory][install_file] + install_patch_directory + "/" + install_file
if not Path(source_file).exists():
raise Exception(f"Failed to find {source_file}")
# Ensure KDK is properly installed
self._merge_kdk_with_root(save_hid_cs=True if "Legacy USB 1.1" in required_patches else False)