mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-21 06:30:52 +10:00
sys_patch: Allow updating installed KDK to root
If installed Beta 8 KDK on Beta 9, can later root patch with Beta 9 KDK available onto root
This commit is contained in:
+14
-4
@@ -113,9 +113,6 @@ class PatchSysVolume:
|
|||||||
return
|
return
|
||||||
if self.constants.detected_os < os_data.os_data.ventura:
|
if self.constants.detected_os < os_data.os_data.ventura:
|
||||||
return
|
return
|
||||||
if (Path(self.mount_location) / Path("System/Library/Extensions/System.kext/PlugIns/Libkern.kext/Libkern")).exists():
|
|
||||||
# Assume KDK is already merged
|
|
||||||
return
|
|
||||||
|
|
||||||
downloaded_kdk = None
|
downloaded_kdk = None
|
||||||
kdk_path = sys_patch_helpers.sys_patch_helpers(self.constants).determine_kdk_present(match_closest=False)
|
kdk_path = sys_patch_helpers.sys_patch_helpers(self.constants).determine_kdk_present(match_closest=False)
|
||||||
@@ -125,8 +122,21 @@ class PatchSysVolume:
|
|||||||
if kdk_result is False:
|
if kdk_result is False:
|
||||||
raise Exception(f"Unable to download KDK: {error_msg}")
|
raise Exception(f"Unable to download KDK: {error_msg}")
|
||||||
sys_patch_helpers.sys_patch_helpers(self.constants).install_kdk()
|
sys_patch_helpers.sys_patch_helpers(self.constants).install_kdk()
|
||||||
|
else:
|
||||||
|
oclp_plist = Path(self.mount_location) / Path("/System/Library/CoreServices/OpenCore-Legacy-Patcher.plist")
|
||||||
|
if (Path(self.mount_location) / Path("System/Library/Extensions/System.kext/PlugIns/Libkern.kext/Libkern")).exists() and oclp_plist.exists():
|
||||||
|
# KDK was already merged, check if the KDK used is the same as the one we're using
|
||||||
|
# If not, we'll rsync over with the new KDK
|
||||||
|
try:
|
||||||
|
oclp_plist_data = plistlib.load(open(oclp_plist, "rb"))
|
||||||
|
if "Kernel Debug Kit Used" in oclp_plist_data:
|
||||||
|
if oclp_plist_data["Kernel Debug Kit Used"] == kdk_path:
|
||||||
|
print("- Matching KDK determined to already be merged, skipping")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
kdk_path = sys_patch_helpers.sys_patch_helpers(self.constants).determine_kdk_present(match_closest=False, override_build=downloaded_kdk)
|
kdk_path = sys_patch_helpers.sys_patch_helpers(self.constants).determine_kdk_present(match_closest=True, override_build=downloaded_kdk)
|
||||||
if kdk_path is None:
|
if kdk_path is None:
|
||||||
print(f"- Unable to find Kernel Debug Kit: {downloaded_kdk}")
|
print(f"- Unable to find Kernel Debug Kit: {downloaded_kdk}")
|
||||||
raise Exception("Unable to find Kernel Debug Kit")
|
raise Exception("Unable to find Kernel Debug Kit")
|
||||||
|
|||||||
Reference in New Issue
Block a user