sys_patch_detect: Ensure wifi patches are installed on subsequent runs

This commit is contained in:
Mykola Grymalyuk
2023-01-06 15:19:58 -07:00
parent 3e8963c372
commit a5d56147c0
+31 -6
View File
@@ -8,6 +8,8 @@ from resources.sys_patch import sys_patch_helpers
from data import model_array, os_data, sip_data, sys_patch_dict from data import model_array, os_data, sip_data, sys_patch_dict
import py_sip_xnu import py_sip_xnu
from pathlib import Path
import plistlib
class detect_root_patch: class detect_root_patch:
def __init__(self, model, versions): def __init__(self, model, versions):
@@ -217,12 +219,35 @@ class detect_root_patch:
if self.requires_root_kc is True: if self.requires_root_kc is True:
self.missing_kdk = not self.check_kdk() self.missing_kdk = not self.check_kdk()
if (self.legacy_wifi is True and \ self.check_networking_support()
self.requires_root_kc is True and \
self.missing_kdk is True and \
self.constants.detected_os >= os_data.os_data.ventura def check_networking_support(self):
): # On macOS Ventura, networking support is required to download KDKs.
if self.has_network is False: # However for machines such as BCM94322, BCM94328 and Atheros chipsets,
# users may only have wifi as their only supported network interface.
# Thus we'll allow for KDK-less installs for these machines on first run.
# On subsequent runs, we'll require networking to be enabled.
if self.constants.detected_os < os_data.os_data.ventura:
return
if self.legacy_wifi is False:
return
if self.requires_root_kc is False:
return
if self.missing_kdk is False:
return
if self.has_network is True:
return
# Verify whether OCLP already installed network patches to the root volume
# If so, require networking to be enabled (user just needs to connect to wifi)
oclp_patch_path = "/System/Library/CoreServices/OpenCore-Legacy-Patcher.plist"
if Path(oclp_patch_path).exists():
oclp_plist = plistlib.load(open(oclp_patch_path, "rb"))
if "Legacy Wireless" in oclp_plist:
return
# Due to the reliance of KDKs for most older patches, we'll allow KDK-less # Due to the reliance of KDKs for most older patches, we'll allow KDK-less
# installs for Legacy Wifi patches and remove others # installs for Legacy Wifi patches and remove others
self.missing_kdk = False self.missing_kdk = False