mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-22 11:00:16 +10:00
sys_patch.py: Save MetallibSupportPkg path to patchset file
This commit is contained in:
@@ -132,8 +132,11 @@ class PatcherValidation:
|
|||||||
if install_type in patchset[patch_subject][patch_core]:
|
if install_type in patchset[patch_subject][patch_core]:
|
||||||
for install_directory in patchset[patch_subject][patch_core][install_type]:
|
for install_directory in patchset[patch_subject][patch_core][install_type]:
|
||||||
for install_file in patchset[patch_subject][patch_core][install_type][install_directory]:
|
for install_file in patchset[patch_subject][patch_core][install_type][install_directory]:
|
||||||
if patchset[patch_subject][patch_core][install_type][install_directory][install_file] in sys_patch_dict.DynamicPatchset:
|
try:
|
||||||
continue
|
if patchset[patch_subject][patch_core][install_type][install_directory][install_file] in sys_patch_dict.DynamicPatchset:
|
||||||
|
continue
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
source_file = str(self.constants.payload_local_binaries_root_path) + "/" + patchset[patch_subject][patch_core][install_type][install_directory][install_file] + install_directory + "/" + install_file
|
source_file = str(self.constants.payload_local_binaries_root_path) + "/" + patchset[patch_subject][patch_core][install_type][install_directory][install_file] + install_directory + "/" + install_file
|
||||||
if not Path(source_file).exists():
|
if not Path(source_file).exists():
|
||||||
logging.info(f"File not found: {source_file}")
|
logging.info(f"File not found: {source_file}")
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class PatchSysVolume:
|
|||||||
self.patch_set_dictionary = {}
|
self.patch_set_dictionary = {}
|
||||||
self.needs_kmutil_exemptions = False # For '/Library/Extensions' rebuilds
|
self.needs_kmutil_exemptions = False # For '/Library/Extensions' rebuilds
|
||||||
self.kdk_path = None
|
self.kdk_path = None
|
||||||
|
self.metallib_path = None
|
||||||
|
|
||||||
# GUI will detect hardware patches before starting PatchSysVolume()
|
# GUI will detect hardware patches before starting PatchSysVolume()
|
||||||
# However the TUI will not, so allow for data to be passed in manually avoiding multiple calls
|
# However the TUI will not, so allow for data to be passed in manually avoiding multiple calls
|
||||||
@@ -320,7 +321,7 @@ class PatchSysVolume:
|
|||||||
destination_path = f"{self.mount_location}/System/Library/CoreServices"
|
destination_path = f"{self.mount_location}/System/Library/CoreServices"
|
||||||
file_name = "OpenCore-Legacy-Patcher.plist"
|
file_name = "OpenCore-Legacy-Patcher.plist"
|
||||||
destination_path_file = f"{destination_path}/{file_name}"
|
destination_path_file = f"{destination_path}/{file_name}"
|
||||||
if sys_patch_helpers.SysPatchHelpers(self.constants).generate_patchset_plist(patchset, file_name, self.kdk_path):
|
if sys_patch_helpers.SysPatchHelpers(self.constants).generate_patchset_plist(patchset, file_name, self.kdk_path, self.metallib_path):
|
||||||
logging.info("- Writing patchset information to Root Volume")
|
logging.info("- Writing patchset information to Root Volume")
|
||||||
if Path(destination_path_file).exists():
|
if Path(destination_path_file).exists():
|
||||||
subprocess_wrapper.run_as_root_and_verify(["/bin/rm", destination_path_file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
subprocess_wrapper.run_as_root_and_verify(["/bin/rm", destination_path_file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
@@ -447,6 +448,7 @@ class PatchSysVolume:
|
|||||||
if not metallib_download_obj:
|
if not metallib_download_obj:
|
||||||
# Already downloaded, return path
|
# Already downloaded, return path
|
||||||
logging.info(f"Using MetalLibSupportPkg: {metallib_obj.metallib_installed_path}")
|
logging.info(f"Using MetalLibSupportPkg: {metallib_obj.metallib_installed_path}")
|
||||||
|
self.metallib_path = metallib_obj.metallib_installed_path
|
||||||
return str(metallib_obj.metallib_installed_path)
|
return str(metallib_obj.metallib_installed_path)
|
||||||
|
|
||||||
metallib_download_obj.download(spawn_thread=False)
|
metallib_download_obj.download(spawn_thread=False)
|
||||||
@@ -495,8 +497,11 @@ class PatchSysVolume:
|
|||||||
continue
|
continue
|
||||||
for install_patch_directory in required_patches[patch][method_type]:
|
for install_patch_directory in required_patches[patch][method_type]:
|
||||||
for install_file in required_patches[patch][method_type][install_patch_directory]:
|
for install_file in required_patches[patch][method_type][install_patch_directory]:
|
||||||
if required_patches[patch][method_type][install_patch_directory][install_file] in sys_patch_dict.DynamicPatchset:
|
try:
|
||||||
required_patches[patch][method_type][install_patch_directory][install_file] = self._resolve_dynamic_patchset(required_patches[patch][method_type][install_patch_directory][install_file])
|
if required_patches[patch][method_type][install_patch_directory][install_file] in sys_patch_dict.DynamicPatchset:
|
||||||
|
required_patches[patch][method_type][install_patch_directory][install_file] = self._resolve_dynamic_patchset(required_patches[patch][method_type][install_patch_directory][install_file])
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
source_file = required_patches[patch][method_type][install_patch_directory][install_file] + install_patch_directory + "/" + install_file
|
source_file = required_patches[patch][method_type][install_patch_directory][install_file] + install_patch_directory + "/" + install_file
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class SysPatchHelpers:
|
|||||||
f.write(data)
|
f.write(data)
|
||||||
|
|
||||||
|
|
||||||
def generate_patchset_plist(self, patchset: dict, file_name: str, kdk_used: Path):
|
def generate_patchset_plist(self, patchset: dict, file_name: str, kdk_used: Path, metallib_used: Path):
|
||||||
"""
|
"""
|
||||||
Generate patchset file for user reference
|
Generate patchset file for user reference
|
||||||
|
|
||||||
@@ -98,12 +98,17 @@ class SysPatchHelpers:
|
|||||||
if kdk_used:
|
if kdk_used:
|
||||||
kdk_string = kdk_used
|
kdk_string = kdk_used
|
||||||
|
|
||||||
|
metallib_used_string = "Not applicable"
|
||||||
|
if metallib_used:
|
||||||
|
metallib_used_string = metallib_used
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"OpenCore Legacy Patcher": f"v{self.constants.patcher_version}",
|
"OpenCore Legacy Patcher": f"v{self.constants.patcher_version}",
|
||||||
"PatcherSupportPkg": f"v{self.constants.patcher_support_pkg_version}",
|
"PatcherSupportPkg": f"v{self.constants.patcher_support_pkg_version}",
|
||||||
"Time Patched": f"{datetime.now().strftime('%B %d, %Y @ %H:%M:%S')}",
|
"Time Patched": f"{datetime.now().strftime('%B %d, %Y @ %H:%M:%S')}",
|
||||||
"Commit URL": f"{self.constants.commit_info[2]}",
|
"Commit URL": f"{self.constants.commit_info[2]}",
|
||||||
"Kernel Debug Kit Used": f"{kdk_string}",
|
"Kernel Debug Kit Used": f"{kdk_string}",
|
||||||
|
"Metal Library Used": f"{metallib_used_string}",
|
||||||
"OS Version": f"{self.constants.detected_os}.{self.constants.detected_os_minor} ({self.constants.detected_os_build})",
|
"OS Version": f"{self.constants.detected_os}.{self.constants.detected_os_minor} ({self.constants.detected_os_build})",
|
||||||
"Custom Signature": bool(Path(self.constants.payload_local_binaries_root_path / ".signed").exists()),
|
"Custom Signature": bool(Path(self.constants.payload_local_binaries_root_path / ".signed").exists()),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user