Remove trailing whitespaces

This commit is contained in:
Mykola Grymalyuk
2022-05-30 22:51:00 -06:00
parent d09d8f4c5e
commit 39f110a6ac
29 changed files with 473 additions and 474 deletions

View File

@@ -102,7 +102,7 @@ class arguments:
if "Library/InstallerSandboxes/" in str(settings.payload_path):
print("- Running from Installer Sandbox")
thread = threading.Thread(target=sys_patch.PatchSysVolume(settings.custom_model or settings.computer.real_model, settings, None).start_patch)
thread.start()
thread.start()
while thread.is_alive():
utilities.block_os_updaters()
time.sleep(1)

View File

@@ -53,7 +53,7 @@ class BuildOpenCore:
else:
print("- Adding Internal Drive icon")
shutil.copy(self.constants.icon_path_internal, self.constants.opencore_release_folder)
def chainload_diags(self):
Path(self.constants.opencore_release_folder / Path("System/Library/CoreServices/.diagnostics/Drivers/HardwareDrivers")).mkdir(parents=True, exist_ok=True)
if self.constants.boot_efi is True:
@@ -147,7 +147,7 @@ class BuildOpenCore:
# Credit to Parrotgeek1 for boot.efi and hv_vmm_present patch sets
# print("- Enabling Board ID exemption patch")
# self.get_item_by_kv(self.config["Booter"]["Patch"], "Comment", "Skip Board ID check")["Enabled"] = True
print("- Enabling VMM exemption patch")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (1)")["Enabled"] = True
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "Reroute kern.hv_vmm_present patch (2)")["Enabled"] = True
@@ -166,14 +166,14 @@ class BuildOpenCore:
if self.get_kext_by_bundle_path("Lilu.kext")["Enabled"] is True:
# Required for Lilu in 11.0+
self.config["Kernel"]["Quirks"]["DisableLinkeditJettison"] = True
if self.constants.fu_status is True:
# Enable FeatureUnlock.kext
self.enable_kext("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path)
if self.constants.fu_arguments is not None:
print(f"- Adding additional FeatureUnlock args: {self.constants.fu_arguments}")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += self.constants.fu_arguments
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value or self.constants.disable_xcpm is True:
# With macOS 12.3 Beta 1, Apple dropped the 'plugin-type' check within X86PlatformPlugin
# Because of this, X86PP will match onto the CPU instead of ACPI_SMC_PlatformPlugin
@@ -240,7 +240,7 @@ class BuildOpenCore:
# In macOS 12.4 and 12.5 Beta 1, Apple added AVX1.0 usage in AppleFSCompressionTypeZlib
# Pre-Sandy Bridge CPUs don't support AVX1.0, thus we'll downgrade the kext to 12.3.1's
# Currently a (hopefully) temporary workaround for the issue, proper fix needs to be investigated
# Ref:
# Ref:
# https://forums.macrumors.com/threads/macos-12-monterey-on-unsupported-macs-thread.2299557/post-31120235
# https://forums.macrumors.com/threads/monterand-probably-the-start-of-an-ongoing-saga.2320479/post-31123553
@@ -398,7 +398,7 @@ class BuildOpenCore:
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value:
print("- Adding IOHIDFamily patch")
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.iokit.IOHIDFamily")["Enabled"] = True
# Legacy iSight patches
try:
if smbios_data.smbios_dictionary[self.model]["Legacy iSight"] is True:
@@ -467,7 +467,7 @@ class BuildOpenCore:
Path(self.constants.agdp_contents_folder).mkdir()
shutil.copy(agdp_map_path, self.constants.agdp_contents_folder)
self.get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True
if self.constants.serial_settings != "None":
# AGPM Patch
if self.model in model_array.DualGPUPatch:
@@ -534,7 +534,7 @@ class BuildOpenCore:
self.enable_kext("IOFireWireSBP2.kext", self.constants.fw_kext, self.constants.fw_sbp2_path)
self.enable_kext("IOFireWireSerialBusProtocolTransport.kext", self.constants.fw_kext, self.constants.fw_bus_path)
self.get_kext_by_bundle_path("IOFireWireFamily.kext/Contents/PlugIns/AppleFWOHCI.kext")["Enabled"] = True
def backlight_path_detection(self):
if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path:
@@ -863,7 +863,7 @@ class BuildOpenCore:
print("- Adding SATA Hibernation Patch")
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
break
# Apple RAID Card check
if not self.constants.custom_model:
if self.computer.storage:
@@ -1124,7 +1124,7 @@ class BuildOpenCore:
self.config["PlatformInfo"]["Generic"]["SystemUUID"] = str(uuid.uuid4()).upper()
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Spoofed-SN"] = sn
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Spoofed-MLB"] = mlb
if self.constants.serial_settings == "Moderate":
print("- Using Moderate SMBIOS patching")
@@ -1148,7 +1148,7 @@ class BuildOpenCore:
print("- Detected UEFI 1.2 or older Mac, updating BoardProduct")
self.config["PlatformInfo"]["DataHub"]["BoardProduct"] = self.spoofed_board
self.config["PlatformInfo"]["UpdateDataHub"] = True
if self.constants.custom_serial_number != "" and self.constants.custom_board_serial_number != "":
print("- Adding custom serial numbers")
self.config["PlatformInfo"]["Automatic"] = True

View File

@@ -67,7 +67,7 @@ Valid Options:
1. None (stock GPU)
2. Nvidia Kepler
3. AMD Polaris
4. AMD Legacy GCN
4. AMD Legacy GCN
Q. Return to previous menu
Note: Patcher will detect whether hardware has been upgraded regardless, this
@@ -466,7 +466,7 @@ OpenCore will enable NVMe support in it's picker
print("Returning to previous menu")
else:
self.allow_nvme()
def allow_nvme_pwr_mgmt(self):
utilities.cls()
utilities.header(["Allow NVMe Power Management Adjustments"])
@@ -479,7 +479,7 @@ within macOS.
Note that some NVMe drives don't support macOS's
power management settings, and can result in boot
issues. Disable this option if you experience
IONVMeFamily kernel panics. Mainly applicable for
IONVMeFamily kernel panics. Mainly applicable for
Skylake and newer Macs.
"""
)
@@ -493,7 +493,7 @@ Skylake and newer Macs.
print("Returning to previous menu")
else:
self.allow_nvme()
def allow_xhci(self):
utilities.cls()
utilities.header(["Allow NVMe UEFI Support"])
@@ -554,7 +554,7 @@ be prepared if enabling.
Some 2013-14 MacBook Pro's have issues with the built-in thunderbolt,
resulting in kernel panics and random shutdowns.
To alliviate, you can disable the thunderbolt controller on MacBookPro11,x
To alliviate, you can disable the thunderbolt controller on MacBookPro11,x
machines with this option.
Note: This option only works on MacBookPro11,x, file an issue if you know of
@@ -650,7 +650,7 @@ for Windows may prefer to only work with the dGPU and eGPU active.
print("Returning to previous menu")
else:
self.dGPU_switch_support()
def set_3rd_party_drices(self):
utilities.cls()
utilities.header(["Set enhanced 3rd Party SSD Support"])
@@ -673,7 +673,7 @@ TRIM is not ideal.
print("Returning to previous menu")
else:
self.set_3rd_party_drices()
def set_software_demux(self):
utilities.cls()
utilities.header(["Set Software Demux"])
@@ -701,7 +701,7 @@ https://dortania.github.io/OpenCore-Legacy-Patcher/ACCEL.html#unable-to-switch-g
print("Returning to previous menu")
else:
self.set_software_demux()
def set_battery_throttle(self):
utilities.cls()
utilities.header(["Disable Firmware Throttling"])
@@ -714,7 +714,7 @@ low power mode.
Enabling this option will patch 'MSR_POWER_CTL' to be unset allowing
proper CPU behaviour as if hardware is present. Note that this can cause
instability in situations where the CPU is being taxed and pulls more
instability in situations where the CPU is being taxed and pulls more
power than the laptop's PSU can supply.
Note: Only supported on Nehalem and newer Macs (2010+)
@@ -766,7 +766,7 @@ By default OCLP will only allow SurPlus to be used on Big Sur and Monterey.
This is for safety reasons in the event newer OSes may break compatibility
and result in boot loops.
Enabling this option will allow SurPlus to have no MaxKernel set, and
Enabling this option will allow SurPlus to have no MaxKernel set, and
therefore allow it to run on anything newer than 11.2.3. However if you
do toggle this setting, ensure you have a known-good OS to return to in
the event there's issues.
@@ -782,17 +782,17 @@ the event there's issues.
print("Returning to previous menu")
else:
self.set_surplus()
def set_hibernation_workaround(self):
utilities.cls()
utilities.header(["Set Hibernation Workaround"])
print(
"""
For users with Hibernation issues, you can flip this option to disable certain
OpenCore settings that may affect the stability of Hibernation. Namely
OpenCore settings that may affect the stability of Hibernation. Namely
OpenCore's ConnectDrivers option.
Flipping this setting will disable automatic loading of additional drives in
Flipping this setting will disable automatic loading of additional drives in
OpenCore's boot menu other than what was booted.
Note: This option should only be flipped under the following circumstances:
@@ -813,7 +813,7 @@ Note: This option should only be flipped under the following circumstances:
print("Returning to previous menu")
else:
self.set_hibernation_workaround()
def set_custom_sip_value(self):
utilities.cls()
utilities.header(["Set Custom SIP Value"])
@@ -835,7 +835,7 @@ To disable SIP outright, set it to 0xFEF
except ValueError:
print("Invalid input, returning to previous menu")
self.set_custom_sip_value()
def set_fu_settings(self):
utilities.cls()
utilities.header(["Set FeatureUnlock Settings"])
@@ -871,7 +871,7 @@ Supported Options:
else:
print("Invalid input, returning to previous menu")
self.set_fu_settings()
def set_allow_native_spoofs(self):
utilities.cls()
utilities.header(["Allow Native Spoofs"])
@@ -895,7 +895,7 @@ available however not officially supported.
print("Returning to previous menu")
else:
self.set_allow_native_spoofs()
def set_nvram_write(self):
utilities.cls()
utilities.header(["Set NVRAM Write"])
@@ -919,7 +919,7 @@ Supported Options:
else:
print("Invalid input, returning to previous menu")
self.set_nvram_write()
def set_cc_support(self):
utilities.cls()
utilities.header(["Set Content Caching Support"])
@@ -1187,7 +1187,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def download_macOS(self):
utilities.cls()
utilities.header(["Create macOS installer"])
@@ -1221,7 +1221,7 @@ B. Exit
print("Failed to start download")
input("Press any key to continue...")
def download_macOS_installer(self):
response = None
while not (response and response == -1):
@@ -1241,7 +1241,7 @@ B. Exit
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def find_local_installer(self):
response = None
while not (response and response == -1):
@@ -1255,7 +1255,7 @@ B. Exit
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def list_disks(self, installer_path):
disk = installer.select_disk_to_format()
if disk != None:

View File

@@ -179,7 +179,7 @@ class Constants:
self.force_latest_psp = False # Force latest PatcherSupportPkg
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
self.software_demux = False # Enable Software Demux patch set
self.force_vmm = False # Force VMM patch
self.force_vmm = False # Force VMM patch
self.custom_sip_value = None # Set custom SIP value
self.walkthrough = False # Enable Walkthrough
self.disable_connectdrivers = False # Disable ConnectDrivers (hibernation)
@@ -208,7 +208,7 @@ class Constants:
@property
def plist_template(self):
return self.payload_path / Path("Config/config.plist")
# Launch Agent
@property
def auto_patch_launch_agent_path(self):
@@ -222,7 +222,7 @@ class Constants:
@property
def windows_ssdt_path(self):
return self.payload_path / Path("ACPI/SSDT-PCI.aml")
@property
def demux_ssdt_path(self):
return self.payload_path / Path("ACPI/SSDT-DGPU.aml")
@@ -239,7 +239,7 @@ class Constants:
@property
def xhci_driver_path(self):
return self.payload_path / Path("Drivers/XhciDxe.efi")
@property
def usb_bus_driver_path(self):
return self.payload_path / Path("Drivers/UsbBusDxe.efi")
@@ -247,11 +247,11 @@ class Constants:
@property
def diags_launcher_path(self):
return self.payload_path / Path("Drivers/diags.efi")
@property
def list_txt_path(self):
return self.payload_path / Path("List.txt")
@property
def installer_sh_path(self):
return self.payload_path / Path("Installer.sh")
@@ -304,11 +304,11 @@ class Constants:
@property
def mce_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleMCEReporterDisabler-v{self.mce_version}.zip")
@property
def bigsursdxc_path(self):
return self.payload_kexts_path / Path(f"Misc/BigSurSDXC-v{self.bigsursdxc_version}.zip")
@property
def apfs_zlib_path(self):
return self.payload_kexts_path / Path(f"Misc/NoAVXFSCompressionTypeZlib-v{self.apfs_zlib_version}.zip")
@@ -352,7 +352,7 @@ class Constants:
@property
def btspoof_path(self):
return self.payload_kexts_path / Path(f"Misc/Bluetooth-Spoof-v{self.btspoof_version}.zip")
@property
def aspp_override_path(self):
return self.payload_kexts_path / Path(f"Misc/ASPP-Override-v{self.aspp_override_version}.zip")
@@ -376,7 +376,7 @@ class Constants:
@property
def cslvfixup_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/CSLVFixup-v{self.cslvfixup_version}.zip")
@property
def autopkg_path(self):
return self.payload_kexts_path / Path(f"Acidanthera/AutoPkgInstaller-v{self.autopkg_version}-{self.kext_variant}.zip")
@@ -384,11 +384,11 @@ class Constants:
@property
def innie_path(self):
return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}.zip")
@property
def simplemsr_path(self):
return self.payload_kexts_path / Path(f"Misc/SimpleMSR-v{self.simplemsr_version}.zip")
@property
def gpu_wake_path(self):
return self.payload_kexts_path / Path(f"Misc/AMDGPUWakeHandler-v{self.gpu_wake_version}.zip")
@@ -396,11 +396,11 @@ class Constants:
@property
def apple_trackpad_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleUSBTrackpad-v{self.apple_trackpad}.zip")
@property
def apple_isight_path(self):
return self.payload_kexts_path / Path(f"Misc/LegacyUSBVideoSupport-v{self.apple_isight_version}.zip")
@property
def apple_raid_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleRAIDCard-v{self.apple_raid_version}.zip")
@@ -518,7 +518,7 @@ class Constants:
@property
def ocvalidate_path(self):
return self.payload_path / Path(f"Tools/ocvalidate-{self.opencore_version}")
@property
def oclp_helper_path(self):
return self.payload_path / Path("Tools/OCLP-Helper")
@@ -551,7 +551,7 @@ class Constants:
@property
def installer_pkg_path(self):
return self.payload_path / Path("AutoPkg-Assets.pkg")
@property
def installer_pkg_zip_path(self):
return self.payload_path / Path("AutoPkg-Assets.pkg.zip")
@@ -560,7 +560,7 @@ class Constants:
@property
def payload_local_binaries_root_path(self):
return self.payload_path / Path("Universal-Binaries")
@property
def payload_local_binaries_root_path_zip(self):
return self.payload_path / Path("Universal-Binaries.zip")

View File

@@ -21,7 +21,7 @@ class generate_defaults:
# If either variables are missing, we assume something is wrong with the spoofed variables and reset
settings.custom_serial_number = ""
settings.custom_board_serial_number = ""
if settings.computer.usb_controllers:
try:
if smbios_data.smbios_dictionary[model]["CPU Generation"] < cpu_data.cpu_data.ivy_bridge.value:
@@ -48,7 +48,7 @@ class generate_defaults:
if arg_result not in ["true", "1", "false", "0"]:
subprocess.run(["defaults", "write", "-g", arg, "-bool", "TRUE"])
if settings.computer.gpus:
if settings.computer.gpus:
for gpu in settings.computer.gpus:
if gpu.arch == device_probe.NVIDIA.Archs.Kepler:
# 12.0 (B7+): Kepler are now unsupported
@@ -67,7 +67,7 @@ class generate_defaults:
settings.sip_status = False
settings.allow_fv_root = True # Allow FileVault on broken seal
if settings.computer.gpus:
if settings.computer.gpus:
for gpu in settings.computer.gpus:
if gpu.arch in [
device_probe.AMD.Archs.Legacy_GCN_7000,
@@ -110,7 +110,7 @@ class generate_defaults:
settings.secure_status = False # Modified root volume
settings.allow_fv_root = True # Allow FileVault on broken seal
# settings.amfi_status = True # Signed bundles, Don't need to explicitly set currently
if "Book" in model:
settings.set_content_caching = False
else:
@@ -147,7 +147,7 @@ class generate_defaults:
settings.fu_arguments = None
if smbios_data.smbios_dictionary[model]["CPU Generation"] >= cpu_data.cpu_data.skylake.value:
# On 2016-2017 MacBook Pros, 15" devices used a stock Samsung SSD with IONVMeController
# Technically this should be patched based on NVMeFix.kext logic,
# Technically this should be patched based on NVMeFix.kext logic,
# however Apple deemed the SSD unsupported for enhanced performance
# In addition, some upgraded NVMe drives still have issues with enhanced power management
# Safest to disable by default, allow user to configure afterwards

View File

@@ -223,7 +223,7 @@ class NVIDIAEthernet(EthernetController):
class Chipsets(enum.Enum):
nForceEthernet = "nForceEthernet"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
@@ -331,7 +331,7 @@ class IntelEthernet(EthernetController):
AppleIntelI210Ethernet = "AppleIntelI210Ethernet Supported"
Intel82574L = "Intel82574L Supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
@@ -380,7 +380,7 @@ class BroadcomEthernet(EthernetController):
class Chipsets(enum.Enum):
AppleBCM5701Ethernet = "AppleBCM5701Ethernet supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
@@ -416,7 +416,7 @@ class Aquantia(EthernetController):
# pylint: disable=invalid-name
AppleEthernetAquantiaAqtion = "AppleEthernetAquantiaAqtion supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
@@ -432,7 +432,7 @@ class Marvell(EthernetController):
class Chipsets(enum.Enum):
MarvelYukonEthernet = "MarvelYukonEthernet supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
@@ -448,7 +448,7 @@ class SysKonnect(EthernetController):
class Chipsets(enum.Enum):
MarvelYukonEthernet = "MarvelYukonEthernet supported"
Unknown = "Unknown"
chipset: Chipsets = field(init=False)
def detect_chipset(self):
@@ -556,13 +556,13 @@ class Computer:
self.wifi = vendor.from_ioregistry(device, anti_spoof=True) # type: ignore
break
ioreg.IOObjectRelease(device)
def ambient_light_sensor_probe(self):
device = next(ioreg.ioiterator_to_list(ioreg.IOServiceGetMatchingServices(ioreg.kIOMasterPortDefault, ioreg.IOServiceNameMatching("ALS0".encode()), None)[1]), None)
if device:
self.ambient_light_sensor = True
ioreg.IOObjectRelease(device)
def sdxc_controller_probe(self):
sdxc_controllers = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
@@ -618,7 +618,7 @@ class Computer:
for device in uhci_controllers:
self.usb_controllers.append(UHCIController.from_ioregistry(device))
ioreg.IOObjectRelease(device)
def ethernet_probe(self):
ethernet_controllers = ioreg.ioiterator_to_list(
ioreg.IOServiceGetMatchingServices(
@@ -627,7 +627,7 @@ class Computer:
None,
)[1]
)
for device in ethernet_controllers:
vendor: Type[EthernetController] = PCIDevice.from_ioregistry(device).vendor_detect(inherits=EthernetController) # type: ignore
if vendor:
@@ -658,7 +658,7 @@ class Computer:
for device in sata_controllers:
self.storage.append(SATAController.from_ioregistry(device))
ioreg.IOObjectRelease(device)
for device in sas_controllers:
self.storage.append(SASController.from_ioregistry(device))
ioreg.IOObjectRelease(device)
@@ -730,7 +730,7 @@ class Computer:
self.bluetooth_chipset = "BRCM2046 Hub"
elif "Bluetooth" in usb_data:
self.bluetooth_chipset = "Generic"
def sata_disk_probe(self):
# Get all SATA Controllers/Disks from 'system_profiler SPSerialATADataType'
# Determine whether SATA SSD is present and Apple-made
@@ -748,11 +748,11 @@ class Computer:
# Bail out of loop as we only need to know if there are any third-party SSDs present
break
except KeyError:
# Notes:
# Notes:
# - SATA Optical Disk Drives don't report 'spsata_medium_type'
# - 'spsata_physical_interconnect' was not introduced till 10.9
continue
def oclp_sys_patch_probe(self):
path = Path("/System/Library/CoreServices/OpenCore-Legacy-Patcher.plist")
if path.exists():

View File

@@ -14,7 +14,7 @@ class global_settings:
self.global_settings_plist = f"{self.global_settings_folder}/{self.file_name}"
self.generate_settings_file()
self.convert_defaults_to_global_settings()
def generate_settings_file(self):
if Path(self.global_settings_plist).exists():
return
@@ -25,7 +25,7 @@ class global_settings:
if property_name in plist:
return plist[property_name]
return None
def write_property(self, property_name, property_value):
plist = plistlib.load(Path(self.global_settings_plist).open("rb"))
plist[property_name] = property_value

View File

@@ -60,7 +60,7 @@ class tui_disk_installation:
selected_disk = supported_disks[disk_identifier]
supported_partitions = {}
for partition in selected_disk["partitions"]:
if selected_disk["partitions"][partition]["fs"] not in ("msdos", "EFI"):
continue
@@ -130,7 +130,7 @@ Please build OpenCore first!"""
response = menu.start()
if response == -1:
return
return
self.install_opencore(f"{disk_identifier}s{response}")
def install_opencore(self, full_disk_identifier):
@@ -147,7 +147,7 @@ Please build OpenCore first!"""
):
return True
return False
# TODO: Apple Script fails in Yosemite(?) and older
args = [
"osascript",
@@ -241,7 +241,7 @@ Please build OpenCore first!"""
else:
print("- Adding Internal Drive icon")
shutil.copy(self.constants.icon_path_internal, mount_path)
print("- Cleaning install location")
if not self.constants.recovery_status:
print("- Unmounting EFI partition")

View File

@@ -115,7 +115,7 @@ def list_downloadable_macOS_installers(download_path, catalog):
link = "https://swscan.apple.com/content/catalogs/others/index-12beta-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
else:
link = "https://swscan.apple.com/content/catalogs/others/index-12customerseed-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog"
if utilities.verify_network_connection(link) is True:
try:
catalog_plist = plistlib.loads(requests.get(link).content)
@@ -287,7 +287,7 @@ def select_disk_to_format():
if response == -1:
return None
return response

View File

@@ -25,10 +25,10 @@ class reroute_payloads:
self.unmount_active_dmgs()
output = subprocess.run(
[
"hdiutil", "attach", "-noverify", f"{self.constants.payload_path}.dmg",
"-mountpoint", Path(self.temp_dir.name / Path("payloads")),
"-nobrowse",
"-shadow", Path(self.temp_dir.name / Path("payloads_overlay")),
"hdiutil", "attach", "-noverify", f"{self.constants.payload_path}.dmg",
"-mountpoint", Path(self.temp_dir.name / Path("payloads")),
"-nobrowse",
"-shadow", Path(self.temp_dir.name / Path("payloads_overlay")),
"-passphrase", "password"
],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
@@ -46,7 +46,7 @@ class reroute_payloads:
def unmount_active_dmgs(self, unmount_all_active=True):
# Find all DMGs that are mounted, and forcefully unmount them
# If our disk image was previously mounted, we need to unmount it to use again
# This can happen if we crash during a previous scession, however 'atexit' class should hopefully avoid this
# This can happen if we crash during a previous scession, however 'atexit' class should hopefully avoid this
dmg_info = subprocess.run(["hdiutil", "info", "-plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
dmg_info = plistlib.loads(dmg_info.stdout)
@@ -58,12 +58,12 @@ class reroute_payloads:
if self.temp_dir.name in image["shadow-path"]:
print("- Unmounting personal payloads.dmg")
subprocess.run(
["hdiutil", "detach", image["system-entities"][0]["dev-entry"], "-force"],
["hdiutil", "detach", image["system-entities"][0]["dev-entry"], "-force"],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
else:
print(f"- Unmounting payloads.dmg at: {image['system-entities'][0]['dev-entry']}")
subprocess.run(
["hdiutil", "detach", image["system-entities"][0]["dev-entry"], "-force"],
["hdiutil", "detach", image["system-entities"][0]["dev-entry"], "-force"],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)

View File

@@ -113,7 +113,7 @@ class Run:
stderr = comm.get("stderr", False)
mess = comm.get("message", None)
show = comm.get("show", False)
if not mess == None:
print(mess)
@@ -129,7 +129,7 @@ class Run:
args.insert(0, out[0].replace("\n", "")) # add to start of list
elif type(args) is str:
args = out[0].replace("\n", "") + " " + args # add to start of string
if show:
print(" ".join(args))

View File

@@ -51,7 +51,7 @@ class PatchSysVolume:
hardware_details = sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).detect_patch_set()
self.hardware_details = hardware_details
self.init_pathing(custom_root_mount_path=None, custom_data_mount_path=None)
def __del__(self):
# Ensures that each time we're patching, we're using a clean repository
if Path(self.constants.payload_local_binaries_root_path).exists():
@@ -70,7 +70,7 @@ class PatchSysVolume:
self.mount_location_data = ""
self.mount_extensions = f"{self.mount_location}/System/Library/Extensions"
self.mount_application_support = f"{self.mount_location_data}/Library/Application Support"
def mount_root_vol(self):
# Returns boolean if Root Volume is available
@@ -120,7 +120,7 @@ class PatchSysVolume:
args = ["kmutil", "install", "--volume-root", self.mount_location, "--update-all"]
if self.needs_kmutil_exemptions is True:
# When installing to '/Library/Extensions', following args skip kext consent
# When installing to '/Library/Extensions', following args skip kext consent
# prompt in System Preferences when SIP's disabled
print(" (You will get a prompt by System Preferences, ignore for now)")
args.append("--no-authentication")
@@ -194,7 +194,7 @@ class PatchSysVolume:
else:
print("- Creating SkylightPlugins folder")
utilities.process_status(utilities.elevated(["mkdir", "-p", f"{self.mount_application_support}/SkyLightPlugins/"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def delete_nonmetal_enforcement(self):
for arg in ["useMetal", "useIOP"]:
result = subprocess.run(["defaults", "read", "/Library/Preferences/com.apple.CoreDisplay", arg], stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
@@ -211,7 +211,7 @@ class PatchSysVolume:
if Path(destination_path_file).exists():
utilities.process_status(utilities.elevated(["rm", destination_path_file], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
utilities.process_status(utilities.elevated(["cp", f"{self.constants.payload_path}/{file_name}", destination_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def patch_root_vol(self):
print(f"- Running patches for {self.model}")
if self.patch_set_dictionary != {}:
@@ -219,11 +219,11 @@ class PatchSysVolume:
else:
self.execute_patchset(sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).generate_patchset(self.hardware_details))
if self.constants.wxpython_variant is True and self.constants.detected_os >= os_data.os_data.big_sur:
if self.constants.wxpython_variant is True and self.constants.detected_os >= os_data.os_data.big_sur:
sys_patch_auto.AutomaticSysPatch.install_auto_patcher_launch_agent(self.constants)
self.rebuild_snapshot()
def execute_patchset(self, required_patches):
source_files_path = str(self.constants.payload_local_binaries_root_path)
self.preflight_checks(required_patches, source_files_path)
@@ -235,7 +235,7 @@ class PatchSysVolume:
for remove_patch_file in required_patches[patch]["Remove"][remove_patch_directory]:
destination_folder_path = str(self.mount_location) + remove_patch_directory
self.remove_file(destination_folder_path, remove_patch_file)
for method_install in ["Install", "Install Non-Root"]:
if method_install in required_patches[patch]:
@@ -270,12 +270,12 @@ class PatchSysVolume:
self.clean_skylight_plugins()
# Make sure non-Metal Enforcement preferences are not present
self.delete_nonmetal_enforcement()
# Make sure SNB kexts are compatible with the host
if "Intel Sandy Bridge" in required_patches:
sys_patch_helpers.sys_patch_helpers(self.constants).snb_board_id_patch(source_files_path)
for patch in required_patches:
for patch in required_patches:
# Check if all files are present
for method_type in ["Install", "Install Non-Root"]:
if method_type in required_patches[patch]:
@@ -380,7 +380,7 @@ class PatchSysVolume:
print("- Starting Patch Process")
print(f"- Determining Required Patch set for Darwin {self.constants.detected_os}")
self.patch_set_dictionary = sys_patch_detect.detect_root_patch(self.computer.real_model, self.constants).generate_patchset(self.hardware_details)
if self.patch_set_dictionary == {}:
change_menu = None
print("- No Root Patches required for your machine!")

View File

@@ -44,7 +44,7 @@ class AutomaticSysPatch:
warning_str = ""
if utilities.verify_network_connection("https://api.github.com/repos/dortania/OpenCore-Legacy-Patcher/releases/latest") is False:
warning_str = f"""\n\nWARNING: We're unable to verify whether there are any new releases of OpenCore Legacy Patcher on Github. Be aware that you may be using an outdated version for this OS. If you're unsure, verify on Github that OpenCore Legacy Patcher {settings.patcher_version} is the latest official release"""
args = [
"osascript",
"-e",
@@ -52,7 +52,7 @@ class AutomaticSysPatch:
f'with icon POSIX file "{settings.app_icon_path}"',
]
output = subprocess.run(
args,
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
@@ -66,7 +66,7 @@ class AutomaticSysPatch:
" without altering line endings"
]
subprocess.run(
args,
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
@@ -85,7 +85,7 @@ class AutomaticSysPatch:
f'with icon POSIX file "{settings.app_icon_path}"',
]
output = subprocess.run(
args,
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
@@ -101,10 +101,10 @@ class AutomaticSysPatch:
AutomaticSysPatch.determine_if_boot_matches(settings)
else:
print("- Auto Patch option is not supported on TUI, please use GUI")
def determine_if_boot_matches(settings):
# Goal of this function is to determine whether the user
# is using a USB drive to Boot OpenCore but macOS does not
# is using a USB drive to Boot OpenCore but macOS does not
# reside on the same drive as the USB.
# If we determine them to be mismatched, notify the user
@@ -121,7 +121,7 @@ class AutomaticSysPatch:
if settings.booted_oc_disk:
root_disk = settings.booted_oc_disk.strip("disk")
root_disk = "disk" + root_disk.split("s")[0]
print(f" - Boot Drive: {settings.booted_oc_disk} ({root_disk})")
macOS_disk = utilities.get_disk_path()
print(f" - macOS Drive: {macOS_disk}")
@@ -134,7 +134,7 @@ class AutomaticSysPatch:
print(f"- Boot drive matches macOS drive ({disk})")
disk_match = True
break
if disk_match is False:
# Check if OpenCore is on a USB drive
print("- Boot Drive does not match macOS drive, checking if OpenCore is on a USB drive")
@@ -151,7 +151,7 @@ class AutomaticSysPatch:
f'with icon POSIX file "{settings.app_icon_path}"',
]
output = subprocess.run(
args,
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
@@ -166,7 +166,7 @@ class AutomaticSysPatch:
else:
print("- Failed to find disk OpenCore launched from")
def install_auto_patcher_launch_agent(settings):
# Installs the following:
@@ -177,7 +177,7 @@ class AutomaticSysPatch:
# As we'd simply be duplicating ourselves
if not settings.launcher_binary.startswith("/Library/Application Support/Dortania/"):
print("- Installing Auto Patcher Launch Agent")
if not Path("Library/Application Support/Dortania").exists():
print("- Creating /Library/Application Support/Dortania/")
utilities.process_status(utilities.elevated(["mkdir", "-p", "/Library/Application Support/Dortania"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))

View File

@@ -32,7 +32,7 @@ class detect_root_patch:
# Patch Requirements
self.amfi_must_disable = False
self.supports_metal = False
self.needs_nv_web_checks = False
self.needs_nv_web_checks = False
# Validation Checks
self.sip_enabled = False
@@ -45,7 +45,7 @@ class detect_root_patch:
self.missing_nv_web_nvram = False
self.missing_nv_web_opengl = False
self.missing_nv_compat = False
def detect_gpus(self):
gpus = self.constants.computer.gpus
non_metal_os = os_data.os_data.catalina
@@ -71,7 +71,7 @@ class detect_root_patch:
device_probe.NVIDIA.Archs.Tesla,
device_probe.NVIDIA.Archs.Fermi,
device_probe.NVIDIA.Archs.Kepler,
device_probe.NVIDIA.Archs.Maxwell,
device_probe.NVIDIA.Archs.Maxwell,
device_probe.NVIDIA.Archs.Pascal,
]:
if self.constants.detected_os > os_data.os_data.mojave:
@@ -110,7 +110,7 @@ class detect_root_patch:
self.iron_gpu = False
self.sandy_gpu = False
self.legacy_keyboard_backlight = False
def check_dgpu_status(self):
dgpu = self.constants.computer.dgpu
if dgpu:
@@ -129,7 +129,7 @@ class detect_root_patch:
if igpu and not dgpu:
return True
return False
def check_legacy_keyboard_backlight(self):
# iMac12,x+ have an 'ACPI0008' device, but it's not a keyboard backlight
# Best to assume laptops will have a keyboard backlight
@@ -171,10 +171,10 @@ class detect_root_patch:
if gpu.force_compatible is True:
return True
return False
def check_whatevergreen(self):
return utilities.check_kext_loaded("WhateverGreen", self.constants.detected_os)
def check_sip(self):
if self.constants.detected_os > os_data.os_data.catalina:
if self.nvidia_web is True:
@@ -227,7 +227,7 @@ class detect_root_patch:
self.legacy_gmux = True
else:
self.legacy_gmux = True
self.root_patch_dict = {
"Graphics: Nvidia Tesla": self.nvidia_tesla,
"Graphics: Nvidia Kepler": self.kepler_gpu,
@@ -256,16 +256,16 @@ class detect_root_patch:
"Validation: nvda_drv(_vrl) variable missing": self.missing_nv_web_nvram if self.nvidia_web is True else False,
}
return self.root_patch_dict
def verify_patch_allowed(self, print_errors=False):
sip_dict = self.check_sip()
sip = sip_dict[0]
sip_value = sip_dict[1]
self.sip_enabled, self.sbm_enabled, self.amfi_enabled, self.fv_enabled, self.dosdude_patched = utilities.patching_status(sip, self.constants.detected_os)
if self.nvidia_web is True:
self.missing_nv_web_nvram = not self.check_nv_web_nvram()
self.missing_nv_web_opengl = not self.check_nv_web_opengl()
@@ -293,29 +293,29 @@ class detect_root_patch:
if self.amfi_enabled is True and self.amfi_must_disable is True:
print("\nCannot patch! Please disable AMFI.")
print("For Hackintoshes, please add amfi_get_out_of_my_way=1 to boot-args")
if self.dosdude_patched is True:
print("\nCannot patch! Detected machine has already been patched by another patcher")
print("Please ensure your install is either clean or patched with OpenCore Legacy Patcher")
if self.nvidia_web is True:
if self.missing_nv_web_opengl is True:
print("\nCannot patch! Force OpenGL property missing")
print("Please ensure ngfxgl=1 is set in boot-args")
if self.missing_nv_compat is True:
print("\nCannot patch! Force Nvidia compatibility property missing")
print("Please ensure ngfxcompat=1 is set in boot-args")
if self.missing_nv_web_nvram is True:
print("\nCannot patch! nvda_drv(_vrl) variable missing")
print("Please ensure nvda_drv_vrl=1 is set in boot-args")
if self.missing_whatever_green is True:
print("\nCannot patch! WhateverGreen.kext missing")
print("Please ensure WhateverGreen.kext is installed")
if any(
[
# General patch checks
@@ -334,7 +334,7 @@ class detect_root_patch:
return False
else:
return True
def generate_patchset(self, hardware_details):
all_hardware_patchset = sys_patch_dict.SystemPatchDictionary(self.constants.detected_os, self.constants.detected_os_minor, self.constants.legacy_accel_support)
required_patches = {}
@@ -406,5 +406,5 @@ class detect_root_patch:
print(f" - {required_patches[patch_name]['Display Name']}")
else:
print(" - No patch sets found for booted model")
return required_patches

View File

@@ -10,7 +10,7 @@ class grab_patcher_support_pkg:
def __init__(self, constants):
self.constants = constants
def generate_pkg_link(self):
link = f"{self.constants.url_patcher_support_pkg}{self.constants.patcher_support_pkg_version}/Universal-Binaries.zip"
return link

View File

@@ -12,7 +12,7 @@ class sys_patch_helpers:
def __init__(self, constants):
self.constants = constants
def snb_board_id_patch(self, source_files_path):
# AppleIntelSNBGraphicsFB hard codes the supported Board IDs for Sandy Bridge iGPUs
@@ -43,7 +43,7 @@ class sys_patch_helpers:
print(f"- Error: Could not find {path}")
raise Exception("Failed to find AppleIntelSNBGraphicsFB.kext, cannot patch!!!")
def generate_patchset_plist(self, patchset, file_name):
source_path = f"{self.constants.payload_path}"
source_path_file = f"{source_path}/{file_name}"

View File

@@ -198,13 +198,13 @@ def check_metal_support(device_probe, computer):
for gpu in computer.gpus:
if (
(gpu.arch in [
device_probe.NVIDIA.Archs.Tesla,
device_probe.NVIDIA.Archs.Fermi,
device_probe.NVIDIA.Archs.Tesla,
device_probe.NVIDIA.Archs.Fermi,
device_probe.NVIDIA.Archs.Maxwell,
device_probe.NVIDIA.Archs.Pascal,
device_probe.AMD.Archs.TeraScale_1,
device_probe.AMD.Archs.TeraScale_2,
device_probe.Intel.Archs.Iron_Lake,
device_probe.AMD.Archs.TeraScale_1,
device_probe.AMD.Archs.TeraScale_2,
device_probe.Intel.Archs.Iron_Lake,
device_probe.Intel.Archs.Sandy_Bridge
]
)
@@ -248,7 +248,7 @@ def check_secure_boot_level():
# - Either x86legacy or T2 without ApECID, returns 1
# - Disabled, returns 0
# Ref: https://github.com/acidanthera/OpenCorePkg/blob/f7c1a3d483fa2535b6a62c25a4f04017bfeee09a/Library/OcMainLib/OpenCoreUefi.c#L490-L502
#
#
# Genuine Mac logic:
# - On genuine non-T2 Macs, they always return 0
# - T2 Macs will return based on their Starup Policy (Full(2), Medium(1), Disabled(0))
@@ -446,7 +446,7 @@ def download_file(link, location, is_gui=None, verify_checksum=False):
if total_file_size > 1024:
total_downloaded_string = f" ({round(float(dl / total_file_size * 100), 2)}%)"
print(f"{round(count / 1024 / 1024, 2)}MB Downloaded{file_size_string}{total_downloaded_string}\nAverage Download Speed: {round(dl//(time.perf_counter() - start) / 100000 / 8, 2)} MB/s")
if verify_checksum is True:
# Verify checksum
# Note that this can be quite taxing on slower Macs
@@ -505,11 +505,11 @@ def find_apfs_physical_volume(device):
return physical_disks
def clean_device_path(device_path: str):
# ex:
# ex:
# 'PciRoot(0x0)/Pci(0xA,0x0)/Sata(0x0,0x0,0x0)/HD(1,GPT,C0778F23-3765-4C8E-9BFA-D60C839E7D2D,0x28,0x64000)/EFI\OC\OpenCore.efi'
# 'PciRoot(0x0)/Pci(0x1A,0x7)/USB(0x0,0x0)/USB(0x2,0x0)/HD(2,GPT,4E929909-2074-43BA-9773-61EBC110A670,0x64800,0x38E3000)/EFI\OC\OpenCore.efi'
# 'PciRoot(0x0)/Pci(0x1A,0x7)/USB(0x0,0x0)/USB(0x1,0x0)/\EFI\OC\OpenCore.efi'
# return:
# return:
# 'C0778F23-3765-4C8E-9BFA-D60C839E7D2D'
# '4E929909-2074-43BA-9773-61EBC110A670'
# 'None'
@@ -540,7 +540,7 @@ def find_disk_off_uuid(uuid):
except KeyError:
pass
return None
def grab_mount_point_from_disk(disk):
data = plistlib.loads(subprocess.run(f"diskutil info -plist {disk}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
@@ -567,7 +567,7 @@ def validate_link(link):
return False
def block_os_updaters():
# Disables any processes that would be likely to mess with
# Disables any processes that would be likely to mess with
# the root volume while we're working with it.
bad_processes = [
"softwareupdate",
@@ -578,7 +578,7 @@ def block_os_updaters():
output = subprocess.check_output(["ps", "-ax"])
lines = output.splitlines()
for line in lines:
entry = line.split()
entry = line.split()
pid = entry[0].decode()
current_process = entry[3].decode()
for bad_process in bad_processes:

View File

@@ -60,7 +60,7 @@ def validate(settings):
raise Exception(f"Validation failed for predefined model: {settings.computer.real_model}")
else:
print(f"Validation succeeded for predefined model: {settings.computer.real_model}")
def validate_root_patch_files(major_kernel, minor_kernel):
patchset = sys_patch_dict.SystemPatchDictionary(major_kernel, minor_kernel, settings.legacy_accel_support)
@@ -79,12 +79,12 @@ def validate(settings):
if not Path(source_file).exists():
print(f"File not found: {source_file}")
raise Exception(f"Failed to find {source_file}")
print(f"Validating Root Patch Dictionary integrity for Darwin {major_kernel}.{minor_kernel}")
if not sys_patch_helpers.sys_patch_helpers(settings).generate_patchset_plist(patchset, "OpenCore-Legacy-Patcher"):
raise Exception("Failed to generate patchset plist")
def validate_sys_patch():
if Path(settings.payload_local_binaries_root_path_zip).exists():
print("Validating Root Patch File integrity")