diff --git a/opencore_legacy_patcher/support/validation.py b/opencore_legacy_patcher/support/validation.py index fc68969cb..be531bbf9 100644 --- a/opencore_legacy_patcher/support/validation.py +++ b/opencore_legacy_patcher/support/validation.py @@ -132,8 +132,11 @@ class PatcherValidation: if install_type in patchset[patch_subject][patch_core]: for install_directory in patchset[patch_subject][patch_core][install_type]: 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: - continue + try: + 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 if not Path(source_file).exists(): logging.info(f"File not found: {source_file}") diff --git a/opencore_legacy_patcher/sys_patch/sys_patch.py b/opencore_legacy_patcher/sys_patch/sys_patch.py index 60f352db2..b9a0b4aa0 100644 --- a/opencore_legacy_patcher/sys_patch/sys_patch.py +++ b/opencore_legacy_patcher/sys_patch/sys_patch.py @@ -85,6 +85,7 @@ class PatchSysVolume: self.patch_set_dictionary = {} self.needs_kmutil_exemptions = False # For '/Library/Extensions' rebuilds self.kdk_path = None + self.metallib_path = None # 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 @@ -320,7 +321,7 @@ class PatchSysVolume: destination_path = f"{self.mount_location}/System/Library/CoreServices" file_name = "OpenCore-Legacy-Patcher.plist" 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") if Path(destination_path_file).exists(): 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: # Already downloaded, return 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) metallib_download_obj.download(spawn_thread=False) @@ -495,8 +497,11 @@ class PatchSysVolume: continue for install_patch_directory in required_patches[patch][method_type]: 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: - required_patches[patch][method_type][install_patch_directory][install_file] = self._resolve_dynamic_patchset(required_patches[patch][method_type][install_patch_directory][install_file]) + try: + 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 diff --git a/opencore_legacy_patcher/sys_patch/sys_patch_helpers.py b/opencore_legacy_patcher/sys_patch/sys_patch_helpers.py index 7257ec2b3..073542e6c 100644 --- a/opencore_legacy_patcher/sys_patch/sys_patch_helpers.py +++ b/opencore_legacy_patcher/sys_patch/sys_patch_helpers.py @@ -77,7 +77,7 @@ class SysPatchHelpers: 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 @@ -98,12 +98,17 @@ class SysPatchHelpers: if kdk_used: kdk_string = kdk_used + metallib_used_string = "Not applicable" + if metallib_used: + metallib_used_string = metallib_used + data = { "OpenCore Legacy Patcher": f"v{self.constants.patcher_version}", "PatcherSupportPkg": f"v{self.constants.patcher_support_pkg_version}", "Time Patched": f"{datetime.now().strftime('%B %d, %Y @ %H:%M:%S')}", "Commit URL": f"{self.constants.commit_info[2]}", "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})", "Custom Signature": bool(Path(self.constants.payload_local_binaries_root_path / ".signed").exists()), }