mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 14:10:51 +10:00
Add support for external repos
This commit is contained in:
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
OCLP-GUI.command
|
OCLP-GUI.command
|
||||||
/payloads/Apple/Frameworks
|
/payloads/Apple-Binaries-OCLP-main
|
||||||
/payloads/Apple/LaunchDaemons
|
/payloads/__MACOSX
|
||||||
/payloads/Apple/PrivateFrameworks
|
|
||||||
/App
|
/App
|
||||||
/Build-Folder
|
/Build-Folder
|
||||||
/build
|
/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 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 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 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:
|
for option in options:
|
||||||
|
|||||||
@@ -212,3 +212,28 @@ running, however this will enforce iMac Nvidia Build Patches.
|
|||||||
self.constants.imac_nvidia_build = False
|
self.constants.imac_nvidia_build = False
|
||||||
else:
|
else:
|
||||||
print("Invalid option")
|
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.catalina = 19
|
||||||
self.big_sur = 20
|
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
|
# Payload Location
|
||||||
# OpenCore
|
# OpenCore
|
||||||
@property
|
@property
|
||||||
@@ -192,7 +196,9 @@ class Constants:
|
|||||||
|
|
||||||
# Apple Paylods Paths
|
# Apple Paylods Paths
|
||||||
@property
|
@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
|
@property
|
||||||
def payload_apple_kexts_path(self): return self.payload_apple_root_path / Path("Extensions")
|
def payload_apple_kexts_path(self): return self.payload_apple_root_path / Path("Extensions")
|
||||||
@property
|
@property
|
||||||
@@ -204,22 +210,20 @@ class Constants:
|
|||||||
|
|
||||||
# Apple Extensions
|
# Apple Extensions
|
||||||
@property
|
@property
|
||||||
def applebcm_path(self): return self.payload_apple_kexts_path / Path("misc-kexts/AppleBCM5701Ethernet.kext")
|
def applehda_path(self): return self.payload_apple_kexts_path / Path("Audio/AppleHDA.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")
|
|
||||||
|
|
||||||
|
|
||||||
# GPU Kexts and Bundles
|
# GPU Kexts and Bundles
|
||||||
@property
|
@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
|
@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
|
@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
|
@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
|
# Apple Frameworks
|
||||||
@property
|
@property
|
||||||
|
|||||||
+37
-4
@@ -13,6 +13,8 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import uuid
|
import uuid
|
||||||
import zipfile
|
import zipfile
|
||||||
|
import os
|
||||||
|
import urllib.request
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
@@ -219,6 +221,35 @@ class PatchSysVolume:
|
|||||||
self.sip_patch_status = True
|
self.sip_patch_status = True
|
||||||
self.csr_decode(self.sip_status, False)
|
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):
|
def start_patch(self):
|
||||||
# Check SIP
|
# Check SIP
|
||||||
if self.constants.custom_model is not None:
|
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):
|
if (self.sip_patch_status is False) and (self.smb_status is False):
|
||||||
print("- Detected SIP and SecureBootModel are disabled, continuing")
|
print("- Detected SIP and SecureBootModel are disabled, continuing")
|
||||||
input("\nPress [ENTER] to continue")
|
input("\nPress [ENTER] to continue")
|
||||||
self.find_mount_root_vol(True)
|
self.check_files()
|
||||||
self.unmount_drive()
|
if self.constants.payload_apple_root_path.exists():
|
||||||
print("- Patching complete")
|
self.find_mount_root_vol(True)
|
||||||
print("\nPlease reboot the machine for patches to take effect")
|
self.unmount_drive()
|
||||||
|
print("- Patching complete")
|
||||||
|
print("\nPlease reboot the machine for patches to take effect")
|
||||||
if self.sip_patch_status is True:
|
if self.sip_patch_status is True:
|
||||||
print("SIP set incorrectly, cannot patch on this machine!")
|
print("SIP set incorrectly, cannot patch on this machine!")
|
||||||
print("Please disable SIP and SecureBootModel in Patcher Settings")
|
print("Please disable SIP and SecureBootModel in Patcher Settings")
|
||||||
|
|||||||
Reference in New Issue
Block a user