Merge branch 'main' into ventura-alpha

This commit is contained in:
Mykola Grymalyuk
2022-07-16 15:08:29 -06:00
committed by GitHub
24 changed files with 156 additions and 104 deletions

View File

@@ -1075,7 +1075,7 @@ class BuildOpenCore:
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -revasset"
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
# Ensure this is done at the end so all previous RestrictEvents patches are applied
# RestrictEvents and EFICheckDisabler will confilict if both are injected
# RestrictEvents and EFICheckDisabler will conflict if both are injected
self.enable_kext("EFICheckDisabler.kext", self.constants.restrictevents_version, self.constants.efi_disabler_path)
if self.constants.set_vmm_cpuid is True:
# Should be unneeded with our sysctl VMM patch, however for reference purposes we'll leave it here
@@ -1217,8 +1217,8 @@ class BuildOpenCore:
minimal_serial_patch(self)
else:
# Update DataHub to resolve Lilu Race Condition
# macOS Monterey will somtimes not present the boardIdentifier in the DeviceTree on UEFI 1.2 or older Mac,
# Thus resulting in an infitinte loop as Lilu tries to request the Board ID
# macOS Monterey will sometimes not present the boardIdentifier in the DeviceTree on UEFI 1.2 or older Mac,
# Thus resulting in an infinite loop as Lilu tries to request the Board ID
# To resolve this, set PlatformInfo -> DataHub -> BoardProduct and enable UpdateDataHub
# Note 1: Only apply if system is UEFI 1.2, this is generally Ivy Bridge and older, excluding MacPro6,1
@@ -1386,7 +1386,7 @@ class BuildOpenCore:
def sign_files(self):
if self.constants.vault is True:
if utilities.check_command_line_tools() is True:
# sign.command checks for the existance of '/usr/bin/strings' however does not verify whether it's executable
# sign.command checks for the existence of '/usr/bin/strings' however does not verify whether it's executable
# sign.command will continue to run and create an unbootable OpenCore.efi due to the missing strings binary
# macOS has dummy binaries that just reroute to the actual binaries after you install Xcode's Command Line Tools
print("- Vaulting EFI")

View File

@@ -171,7 +171,7 @@ Note: For security reasons, OpenShell will be disabled when Vault is set.
utilities.cls()
utilities.header(["Set System Integrity protection"])
print(
f"""SIP is used to ensure proper secuirty measures are set,
f"""SIP is used to ensure proper security measures are set,
however to patch the root volume this must be lowered partially.
Only disable is absolutely necessary. SIP value = 0x802
@@ -553,7 +553,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 alleviate, 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.
else:
self.dGPU_switch_support()
def set_3rd_party_drices(self):
def set_3rd_party_drives(self):
utilities.cls()
utilities.header(["Set enhanced 3rd Party SSD Support"])
print(
@@ -671,7 +671,7 @@ TRIM is not ideal.
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
self.set_3rd_party_drices()
self.set_3rd_party_drives()
def set_software_demux(self):
utilities.cls()
@@ -795,7 +795,7 @@ 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:
- You are experincing wake failures from hibernation
- You are experiencing wake failures from hibernation
- You are only using 1 disk in your system for booting (ie. no RAID)
- OpenCore is installed on the same disk as the OS
- Your system has an Intel iGPU and Nvidia dGPU
@@ -857,7 +857,7 @@ Supported Options:
3. Disable FeatureUnlock
"""
)
change_menu = input("Set FeatreUnlock (ie. 1): ")
change_menu = input("Set FeatureUnlock (ie. 1): ")
if change_menu == "1":
self.constants.fu_status = True
self.constants.fu_arguments = None
@@ -1156,7 +1156,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"Disable Battery Throttling:\tCurrently {self.constants.disable_msr_power_ctl}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_battery_throttle],
[f"Disable XCPM:\t\tCurrently {self.constants.disable_xcpm}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_xcpm],
[f"Set Software Demux:\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux],
[f"Set 3rd Party SSD Support:\tCurrently {self.constants.allow_3rd_party_drives}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_3rd_party_drices],
[f"Set 3rd Party SSD Support:\tCurrently {self.constants.allow_3rd_party_drives}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_3rd_party_drives],
[f"Set FeatureUnlock: \tCurrently {self.constants.fu_status}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_fu_settings],
[f"Set NVRAM Write:\t\tCurrently {self.constants.nvram_write}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_nvram_write],
[f"Set Content Caching:\tCurrently {self.constants.set_content_caching}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_cc_support],

View File

@@ -190,7 +190,7 @@ class Constants:
self.set_content_caching = False # Set Content Caching
self.allow_nvme_fixing = True # Allow NVMe Kernel Space Patches
self.disable_xcpm = False # Disable XCPM (X86PlatformPlugin.kext)
self.root_patcher_succeded = False # Determine if root patcher succeeded
self.root_patcher_succeeded = False # Determine if root patcher succeeded
self.booted_oc_disk = None # Determine current disk OCLP booted from
self.start_build_install = False # Determine if build install should be started
self.host_is_non_metal = False # Determine if host is non-metal (ie. enable UI hacks)

View File

@@ -1,6 +1,6 @@
# Alternative to Apple's 'defaults' tool
# Store data in '/Users/Shared'
# This is to ensure compatibility when running wihout a user
# This is to ensure compatibility when running without a user
# ie. during automated patching
from pathlib import Path

View File

@@ -1,5 +1,5 @@
# Installation of OpenCore files to ESP
# Usage soley for TUI
# Usage solely for TUI
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
import plistlib

View File

@@ -207,6 +207,11 @@ def only_list_newest_installers(available_apps):
# Now remove all versions that are not the largest
for ia in list(available_apps):
if available_apps[ia]["Variant"] in ["DeveloperSeed", "PublicSeed"]:
# Remove Beta builds from default listing
available_apps.pop(ia)
continue
if available_apps[ia]["Version"].startswith(version):
remote_version = available_apps[ia]["Version"].split(".")
if remote_version[0] == "10":
@@ -340,7 +345,7 @@ def generate_installer_creation_script(tmp_location, installer_path, disk):
# Goals:
# - Format provided disk as HFS+ GPT
# - Run createinstallmedia on provided disk
# Implemnting this into a single installer.sh script allows us to only call
# Implementing this into a single installer.sh script allows us to only call
# OCLP-Helper once to avoid nagging the user about permissions
additional_args = ""
@@ -363,10 +368,17 @@ def generate_installer_creation_script(tmp_location, installer_path, disk):
subprocess.run(["rm", "-rf", str(file)])
# Copy installer to tmp (use CoW to avoid extra disk writes)
subprocess.run(["cp", "-cR", installer_path, ia_tmp])
args = ["cp", "-cR", installer_path, ia_tmp]
if utilities.check_filesystem_type() != "apfs":
# HFS+ disks do not support CoW
args[1] = "-R"
subprocess.run(args)
# Adjust installer_path to point to the copied installer
installer_path = Path(ia_tmp) / Path(Path(installer_path).name)
if not Path(installer_path).exists():
print(f"Failed to copy installer to {ia_tmp}")
return False
createinstallmedia_path = str(Path(installer_path) / Path("Contents/Resources/createinstallmedia"))
plist_path = str(Path(installer_path) / Path("Contents/Info.plist"))

View File

@@ -1,4 +1,4 @@
# Reoute binaries to tmp directory, and mount a disk image of the payloads
# Reroute binaries to tmp directory, and mount a disk image of the payloads
# Implements a shadowfile to avoid direct writes to the dmg
# Copyright (C) 2022, Mykola Grymalyuk
@@ -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 secession, 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)

View File

@@ -47,7 +47,7 @@ class PatchSysVolume:
self.computer = self.constants.computer
self.root_mount_path = None
self.root_supports_snapshot = utilities.check_if_root_is_apfs_snapshot()
self.constants.root_patcher_succeded = False # Reset Variable each time we start
self.constants.root_patcher_succeeded = False # Reset Variable each time we start
self.constants.needs_to_open_preferences = False
self.patch_set_dictionary = {}
self.needs_kmutil_exemptions = False # For '/Library/Extensions' rebuilds
@@ -144,7 +144,7 @@ class PatchSysVolume:
else:
self.clean_skylight_plugins()
self.delete_nonmetal_enforcement()
self.constants.root_patcher_succeded = True
self.constants.root_patcher_succeeded = True
print("- Unpatching complete")
print("\nPlease reboot the machine for patches to take effect")
@@ -370,7 +370,7 @@ class PatchSysVolume:
elif Path(source_folder + "/" + file_name_str).is_dir():
# Applicable for .kext, .app, .plugin, .bundle, all of which are directories
if Path(destination_folder + "/" + file_name).exists():
print(f" - Found existing {file_name}, overwritting...")
print(f" - Found existing {file_name}, overwriting...")
utilities.process_status(utilities.elevated(["rm", "-R", f"{destination_folder}/{file_name}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
else:
print(f" - Installing: {file_name}")
@@ -379,7 +379,7 @@ class PatchSysVolume:
else:
# Assume it's an individual file, replace as normal
if Path(destination_folder + "/" + file_name).exists():
print(f" - Found existing {file_name}, overwritting...")
print(f" - Found existing {file_name}, overwriting...")
utilities.process_status(utilities.elevated(["rm", f"{destination_folder}/{file_name}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
else:
print(f" - Installing: {file_name}")

View File

@@ -193,7 +193,7 @@ class AutomaticSysPatch:
utilities.process_status(utilities.elevated(["ditto", path, "/Library/Application Support/Dortania/OpenCore-Patcher.app"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
if not Path("/Library/Application Support/Dortania/OpenCore-Patcher.app").exists():
# Sometimes the binary the user launches maye have a suffix (ie. OpenCore-Patcher 3.app)
# Sometimes the binary the user launches may have a suffix (ie. OpenCore-Patcher 3.app)
# We'll want to rename it to OpenCore-Patcher.app
path = path.split("/")[-1]
print(f"- Renaming {path} to OpenCore-Patcher.app")

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymaluk
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
from resources import utilities
class TUIMenu:

View File

@@ -62,7 +62,7 @@ class check_binary_updates:
# print("- Network connection functional")
response = requests.get(self.binary_url)
data_set = response.json()
# print("- Retrived latest version data")
# print("- Retrieved latest version data")
self.remote_version = data_set["tag_name"]
# print(f"- Latest version: {self.remote_version}")
self.remote_version_array = self.remote_version.split(".")

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymaluk
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
import hashlib
import math
@@ -93,6 +93,10 @@ def check_seal():
else:
return False
def check_filesystem_type():
# Expected to return 'apfs' or 'hfs'
filesystem_type = plistlib.loads(subprocess.run(["diskutil", "info", "-plist", "/"], stdout=subprocess.PIPE).stdout.decode().strip().encode())
return filesystem_type["FilesystemType"]
def csr_dump():
# Based off sip_config.py
@@ -250,7 +254,7 @@ def check_secure_boot_level():
#
# 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))
# - T2 Macs will return based on their Startup Policy (Full(2), Medium(1), Disabled(0))
# Ref: https://support.apple.com/en-us/HT208198
if check_ap_security_policy() != 0:
return True
@@ -598,7 +602,7 @@ def check_boot_mode():
return sys_plist[0]["_items"][0]["boot_mode"]
def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
# When runnign through our GUI, we run as root, however we do not get uid 0
# When running through our GUI, we run as root, however we do not get uid 0
# Best to assume CLI is running as root
if os.getuid() == 0 or check_cli_args() is not None:
return subprocess.run(*args, **kwargs)