Merge branch 'main' into ventura-alpha

# Conflicts:
#	resources/os_probe.py
This commit is contained in:
Mykola Grymalyuk
2022-08-19 15:43:23 -06:00
7 changed files with 58 additions and 7 deletions
+10 -1
View File
@@ -112,7 +112,6 @@ class BuildOpenCore:
("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path, lambda: self.model in model_array.MacPro),
("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path, lambda: self.constants.allow_oc_everywhere is False and self.constants.serial_settings != "None"),
# CPU patches
("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path, lambda: (self.model.startswith("MacPro") or self.model.startswith("Xserve")) and self.constants.serial_settings != "None"),
("AAAMouSSE.kext", self.constants.mousse_version, self.constants.mousse_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.penryn.value),
(
"telemetrap.kext",
@@ -167,6 +166,16 @@ class BuildOpenCore:
# Required for Lilu in 11.0+
self.config["Kernel"]["Quirks"]["DisableLinkeditJettison"] = True
if self.constants.serial_settings != "None":
# AppleMCEReporter is very picky about which models attach to the kext
# Commonly it will kernel panic on multi-socket systems, however even on single-socket systems it may cause instability
# To avoid any issues, we'll disable it if the spoof is set to an affected SMBIOS
affected_smbios = ["MacPro6,1", "MacPro7,1", "iMacPro1,1"]
if self.model not in affected_smbios:
# If MacPro6,1 host spoofs, we can safely enable it
if self.constants.override_smbios in affected_smbios or generate_smbios.set_smbios_model_spoof(self.model) in affected_smbios:
self.enable_kext("AppleMCEReporterDisabler.kext", self.constants.mce_version, self.constants.mce_path)
if self.constants.fu_status is True:
# Enable FeatureUnlock.kext
self.enable_kext("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path)
+21 -1
View File
@@ -187,6 +187,7 @@ def only_list_newest_installers(available_apps):
for version in supported_versions:
remote_version_minor = 0
remote_version_security = 0
os_builds = []
# First determine the largest version
for ia in available_apps:
@@ -221,13 +222,25 @@ def only_list_newest_installers(available_apps):
remote_version.pop(0)
if int(remote_version[0]) < remote_version_minor:
available_apps.pop(ia)
elif int(remote_version[0]) == remote_version_minor:
continue
if int(remote_version[0]) == remote_version_minor:
if len(remote_version) > 1:
if int(remote_version[1]) < remote_version_security:
available_apps.pop(ia)
continue
else:
if remote_version_security > 0:
available_apps.pop(ia)
continue
# Remove duplicate builds
# ex. macOS 12.5.1 has 2 builds in the Software Update Catalog
# ref: https://twitter.com/classicii_mrmac/status/1560357471654379522
if available_apps[ia]["Build"] in os_builds:
available_apps.pop(ia)
continue
os_builds.append(available_apps[ia]["Build"])
return available_apps
@@ -372,6 +385,13 @@ def generate_installer_creation_script(tmp_location, installer_path, disk):
if utilities.check_filesystem_type() != "apfs":
# HFS+ disks do not support CoW
args[1] = "-R"
# Ensure we have enough space for the duplication
space_available = utilities.get_free_space()
space_needed = Path(ia_tmp).stat().st_size
if space_available < space_needed:
print("Not enough free space to create installer.sh")
print(f"{utilities.human_fmt(space_available)} available, {utilities.human_fmt(space_needed)} required")
return False
subprocess.run(args)
# Adjust installer_path to point to the copied installer
+1 -1
View File
@@ -19,4 +19,4 @@ def detect_kernel_minor():
def detect_kernel_build():
# Return OS build
# Example Output: 21A5522h (string)
return subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode().strip()
return subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode().split("\n")[0]
+6
View File
@@ -13,6 +13,7 @@ from ctypes import CDLL, c_uint, byref
import time
import atexit
import requests
import shutil
from resources import constants, ioreg
from data import sip_data, os_data
@@ -549,6 +550,11 @@ def find_disk_off_uuid(uuid):
pass
return None
def get_free_space(disk=None):
if disk is None:
disk = "/"
total, used, free = shutil.disk_usage("/")
return free
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())