mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-14 03:16:28 +10:00
Add support for external repos
This commit is contained in:
+2
-3
@@ -1,8 +1,7 @@
|
||||
.DS_Store
|
||||
OCLP-GUI.command
|
||||
/payloads/Apple/Frameworks
|
||||
/payloads/Apple/LaunchDaemons
|
||||
/payloads/Apple/PrivateFrameworks
|
||||
/payloads/Apple-Binaries-OCLP-main
|
||||
/payloads/__MACOSX
|
||||
/App
|
||||
/Build-Folder
|
||||
/build
|
||||
|
||||
@@ -73,6 +73,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
[f"Set Vault Mode:\t\t\tCurrently {self.constants.vault}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_vault],
|
||||
[f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_sip],
|
||||
[f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_serial],
|
||||
[f"Set Custom Patch Repo", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_repo],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
|
||||
@@ -210,5 +210,30 @@ running, however this will enforce iMac Nvidia Build Patches.
|
||||
self.constants.imac_nvidia_build = True
|
||||
elif change_menu in {"n", "N", "no", "No"}:
|
||||
self.constants.imac_nvidia_build = False
|
||||
else:
|
||||
print("Invalid option")
|
||||
|
||||
def custom_repo(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Swet custom patch repo"])
|
||||
print(f"""For users participating in OpenCore Patcher betas, this is
|
||||
where you can add custom repos such as Google Drive links.
|
||||
|
||||
Valid options:
|
||||
|
||||
1. Set custom location
|
||||
2. Reset repo location
|
||||
3. Exit
|
||||
|
||||
Current repo:
|
||||
{self.constants.url_apple_binaries}
|
||||
""")
|
||||
change_menu = input("Set custom location?: ")
|
||||
if change_menu == "1":
|
||||
self.constants.url_backup = self.constants.url_apple_binaries
|
||||
self.constants.url_apple_binaries = input("Enter new URL: ")
|
||||
elif change_menu == "2":
|
||||
if self.constants.url_backup != "":
|
||||
self.constants.url_apple_binaries = self.constants.url_backup
|
||||
else:
|
||||
print("Invalid option")
|
||||
+14
-10
@@ -74,6 +74,10 @@ class Constants:
|
||||
self.catalina = 19
|
||||
self.big_sur = 20
|
||||
|
||||
# External Files
|
||||
self.url_backup = ""
|
||||
self.url_apple_binaries = "https://github.com/dortania/Apple-Binaries-OCLP/archive/refs/heads/main.zip"
|
||||
|
||||
# Payload Location
|
||||
# OpenCore
|
||||
@property
|
||||
@@ -192,7 +196,9 @@ class Constants:
|
||||
|
||||
# Apple Paylods Paths
|
||||
@property
|
||||
def payload_apple_root_path(self): return self.payload_path / Path("Apple")
|
||||
def payload_apple_root_path(self): return self.payload_path / Path("Apple-Binaries-OCLP-main")
|
||||
@property
|
||||
def payload_apple_root_path_zip(self): return self.payload_path / Path("Apple.zip")
|
||||
@property
|
||||
def payload_apple_kexts_path(self): return self.payload_apple_root_path / Path("Extensions")
|
||||
@property
|
||||
@@ -204,22 +210,20 @@ class Constants:
|
||||
|
||||
# Apple Extensions
|
||||
@property
|
||||
def applebcm_path(self): return self.payload_apple_kexts_path / Path("misc-kexts/AppleBCM5701Ethernet.kext")
|
||||
@property
|
||||
def applehda_path(self): return self.payload_apple_kexts_path / Path("misc-kexts/AppleHDA.kext")
|
||||
@property
|
||||
def iosurface_path(self): return self.payload_apple_kexts_path / Path("misc-kexts/IOSurface.kext")
|
||||
def applehda_path(self): return self.payload_apple_kexts_path / Path("Audio/AppleHDA.kext")
|
||||
|
||||
|
||||
# GPU Kexts and Bundles
|
||||
@property
|
||||
def legacy_nvidia_path(self): return self.payload_apple_kexts_path / Path("legacy-nvidia")
|
||||
def legacy_graphics(self): return self.payload_apple_kexts_path / Path("Graphics-Acceleration")
|
||||
@property
|
||||
def legacy_amd_path(self): return self.payload_apple_kexts_path / Path("legacy-amd")
|
||||
def legacy_nvidia_path(self): return self.legacy_graphics / Path("Nvidia-Tesla-Fermi")
|
||||
@property
|
||||
def legacy_intel_gen1_path(self): return self.payload_apple_kexts_path / Path("intel-gen1")
|
||||
def legacy_amd_path(self): return self.legacy_graphics / Path("AMD-ATI")
|
||||
@property
|
||||
def legacy_intel_gen2_path(self): return self.payload_apple_kexts_path / Path("intel-gen2")
|
||||
def legacy_intel_gen1_path(self): return self.legacy_graphics / Path("Intel-Gen5-Iconlake")
|
||||
@property
|
||||
def legacy_intel_gen2_path(self): return self.legacy_graphics / Path("Intel-Gen6-SandyBridge")
|
||||
|
||||
# Apple Frameworks
|
||||
@property
|
||||
|
||||
+37
-4
@@ -13,6 +13,8 @@ import shutil
|
||||
import subprocess
|
||||
import uuid
|
||||
import zipfile
|
||||
import os
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
from datetime import date
|
||||
|
||||
@@ -219,6 +221,35 @@ class PatchSysVolume:
|
||||
self.sip_patch_status = True
|
||||
self.csr_decode(self.sip_status, False)
|
||||
|
||||
def check_files(self):
|
||||
if Path(self.constants.payload_apple_root_path).exists():
|
||||
print("- Found Apple Binaries")
|
||||
patch_input = input("Would you like to redownload?(y/n): ")
|
||||
if patch_input in {"y", "Y", "yes", "Yes"}:
|
||||
shutil.rmtree(Path(self.constants.payload_apple_root_path))
|
||||
self.download_files()
|
||||
else:
|
||||
print("- Apple binaries missing")
|
||||
self.download_files()
|
||||
|
||||
def download_files(self):
|
||||
print("- Downloading Apple binaries")
|
||||
try:
|
||||
urllib.request.urlretrieve(self.constants.url_apple_binaries, self.constants.payload_apple_root_path_zip)
|
||||
except urllib.error.HTTPError:
|
||||
print("- Link invalid")
|
||||
if self.constants.payload_apple_root_path_zip.exists():
|
||||
print("- Download completed")
|
||||
print("- Unzipping download...")
|
||||
try:
|
||||
zipfile.ZipFile(self.constants.payload_apple_root_path_zip).extractall(self.constants.payload_path)
|
||||
except zipfile.BadZipFile:
|
||||
print("- Couldn't unzip")
|
||||
os.remove(self.constants.payload_apple_root_path_zip)
|
||||
else:
|
||||
print("- Download failed, please verify the below link works:")
|
||||
print(self.constants.url_apple_binaries)
|
||||
|
||||
def start_patch(self):
|
||||
# Check SIP
|
||||
if self.constants.custom_model is not None:
|
||||
@@ -235,10 +266,12 @@ class PatchSysVolume:
|
||||
if (self.sip_patch_status is False) and (self.smb_status is False):
|
||||
print("- Detected SIP and SecureBootModel are disabled, continuing")
|
||||
input("\nPress [ENTER] to continue")
|
||||
self.find_mount_root_vol(True)
|
||||
self.unmount_drive()
|
||||
print("- Patching complete")
|
||||
print("\nPlease reboot the machine for patches to take effect")
|
||||
self.check_files()
|
||||
if self.constants.payload_apple_root_path.exists():
|
||||
self.find_mount_root_vol(True)
|
||||
self.unmount_drive()
|
||||
print("- Patching complete")
|
||||
print("\nPlease reboot the machine for patches to take effect")
|
||||
if self.sip_patch_status is True:
|
||||
print("SIP set incorrectly, cannot patch on this machine!")
|
||||
print("Please disable SIP and SecureBootModel in Patcher Settings")
|
||||
|
||||
Reference in New Issue
Block a user