mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-13 20:28:21 +10:00
kdk_handler.py: Download KDKs from mirror
Reference: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1016
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
- Alleviates kernel panic when on prolonged idle
|
||||
- Automatically remove unsupported News Widgets on Ivy Bridge and Haswell iGPUs
|
||||
- Alleviates Notification Centre Crashing
|
||||
- Implement downloading from Kernel Debug Kit Backup Repository
|
||||
- Alleviates issues with Apple blocking KDK downloads from OCLP (Ref: [Issue #1016](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1016))
|
||||
- Work-around MacPro6,1 and Lilu race condition
|
||||
- Ensure Model and Board ID are set correctly before Lilu loads
|
||||
- Publish Application Version in UI header
|
||||
|
||||
@@ -180,18 +180,29 @@ class kernel_debug_kit_handler:
|
||||
return False, msg, ""
|
||||
elif result == 2:
|
||||
msg = "Could not contact Apple download servers"
|
||||
print(f"- {msg}")
|
||||
return False, msg, ""
|
||||
download_link = self.kdk_backup_site(closest_build)
|
||||
if download_link is None:
|
||||
msg += " and could not find a backup copy online"
|
||||
print(f"- {msg}")
|
||||
return False, msg, ""
|
||||
else:
|
||||
msg = "Unknown error"
|
||||
print(f"- {msg}")
|
||||
return False, msg, ""
|
||||
elif result == 2:
|
||||
msg = "Could not contact Apple download servers"
|
||||
print(f"- {msg}")
|
||||
return False, msg, ""
|
||||
download_link = self.kdk_backup_site(build)
|
||||
if download_link is None:
|
||||
msg += " and could not find a backup copy online"
|
||||
print(f"- {msg}")
|
||||
return False, msg, ""
|
||||
|
||||
if utilities.download_apple_developer_portal(download_link, self.constants.kdk_download_path):
|
||||
if "github" in download_link:
|
||||
result = utilities.download_file(download_link, self.constants.kdk_download_path)
|
||||
else:
|
||||
result = utilities.download_apple_developer_portal(download_link, self.constants.kdk_download_path)
|
||||
|
||||
if result:
|
||||
result = subprocess.run(["hdiutil", "verify", self.constants.kdk_download_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
if result.returncode != 0:
|
||||
print(f"Error: Kernel Debug Kit checksum verification failed!")
|
||||
@@ -247,4 +258,26 @@ class kernel_debug_kit_handler:
|
||||
if should_remove is False:
|
||||
continue
|
||||
print(f" - Removing {kdk_folder.name}")
|
||||
utilities.elevated(["rm", "-rf", kdk_folder], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
utilities.elevated(["rm", "-rf", kdk_folder], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
|
||||
def kdk_backup_site(self, build):
|
||||
KDK_MIRROR_REPOSITORY = "https://api.github.com/repos/khronokernel/KDK-Mirror/releases"
|
||||
|
||||
# Check if tag exists
|
||||
catalog = requests.get(KDK_MIRROR_REPOSITORY)
|
||||
if catalog.status_code != 200:
|
||||
print(f"- Could not contact KDK mirror repository")
|
||||
return None
|
||||
|
||||
catalog = catalog.json()
|
||||
|
||||
for release in catalog:
|
||||
if release["tag_name"] == build:
|
||||
print(f"- Found KDK mirror for build: {build}")
|
||||
for asset in release["assets"]:
|
||||
if asset["name"].endswith(".dmg"):
|
||||
return asset["browser_download_url"]
|
||||
|
||||
print(f"- Could not find KDK mirror for build {build}")
|
||||
return None
|
||||
Reference in New Issue
Block a user