sys_patch_dict.py: Add display names

This commit is contained in:
Mykola Grymalyuk
2022-05-07 17:52:27 -06:00
parent ea4f4c4173
commit 3a6d801d80
4 changed files with 29 additions and 27 deletions

View File

@@ -21,6 +21,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
sys_patch_dict = {
"Graphics": {
"Non-Metal Common": {
"Display Name": None,
"OS Support": {
"Minimum OS Support": {
"OS Major": non_metal_os_support[0],
@@ -84,6 +85,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
"Non-Metal IOAccelerator Common": {
# TeraScale 2 and Nvidia Web Drivers broke in Mojave due to mismatched structs in
# the IOAccelerator stack
"Display Name": None,
"OS Support": {
"Minimum OS Support": {
"OS Major": non_metal_os_support[0],
@@ -115,6 +117,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"Metal Common": {
"Display Name": None,
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.monterey,
@@ -138,6 +141,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"Legacy GVA": {
"Display Name": None,
"OS Support": {
"Minimum OS Support": {
"OS Major": non_metal_os_support[0],
@@ -157,6 +161,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"Nvidia Tesla": {
"Display Name": "Graphics: Nvidia Tesla",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.mojave,
@@ -181,6 +186,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"Nvidia Kepler": {
"Display Name": "Graphics: Nvidia Kepler",
"OS Support": {
"Minimum OS Support": {
# 12.0 beta 7 (XNU 21.1)
@@ -207,6 +213,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"Nvidia Web Drivers": {
"Display Name": "Graphics: Nvidia Web Drivers",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.mojave,
@@ -240,6 +247,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"AMD TeraScale Common": {
"Display Name": None,
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.mojave,
@@ -271,6 +279,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"AMD TeraScale 1": {
"Display Name": "Graphics: AMD TeraScale 1",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.mojave,
@@ -309,6 +318,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"AMD TeraScale 2": {
"Display Name": "Graphics: AMD TeraScale 2",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.mojave,
@@ -334,6 +344,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"Intel Ironlake": {
"Display Name": "Graphics: Intel Ironlake",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.mojave,
@@ -355,6 +366,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"Intel Sandy Bridge": {
"Display Name": "Graphics: Intel Sandy Bridge",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.mojave,
@@ -377,6 +389,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"Intel Ivy Bridge": {
"Display Name": "Graphics: Intel Ivy Bridge",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.monterey,
@@ -405,6 +418,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"Audio": {
"Legacy Realtek": {
"Display Name": "Audio: Legacy Realtek Audio",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.sierra,
@@ -434,6 +448,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
# For Mac Pros with non-UGA/GOP GPUs
"Legacy Non-GOP": {
"Display Name": "Audio: Legacy non-GOP Audio",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.mojave,
@@ -453,6 +468,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"Networking": {
"Legacy WiFi": {
"Display Name": "Networking: Legacy WiFi",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.monterey,
@@ -481,6 +497,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"Brightness": {
"Legacy Brightness": {
"Display Name": "Brightness: Legacy Brightness",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.high_sierra,
@@ -509,6 +526,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"Miscellaneous": {
"Legacy GMUX": {
"Display Name": "Miscellaneous: Legacy GMUX",
"OS Support": {
"Minimum OS Support": {
"OS Major": os_data.os_data.high_sierra,
@@ -535,6 +553,7 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
},
"Legacy Keyboard Backlight": {
"Display Name": "Miscellaneous: Legacy Keyboard Backlight",
"OS Support": {
"Minimum OS Support": {
"OS Major": non_metal_os_support[0],

View File

@@ -227,7 +227,7 @@ class PatchSysVolume:
if "Processes" in required_patches[patch]:
for process in required_patches[patch]["Processes"]:
# Some processes need sudo, however we cannot directly call sudo in some scenarios
# Instead, call elevated funtion and strip sudo from argument
# Instead, call elevated funtion is string's boolean is True
process_array = process.split(" ")
if required_patches[patch]["Processes"][process] is True:
utilities.process_status(utilities.elevated(process_array, stdout=subprocess.PIPE, stderr=subprocess.STDOUT))

View File

@@ -225,29 +225,23 @@ class detect_root_patch:
utilities.cls()
print("- The following patches will be applied:")
if hardware_details["Graphics: Intel Ironlake"] is True:
print(" - Graphics: Intel Ironlake")
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Intel Ironlake": all_hardware_patchset["Graphics"]["Intel Ironlake"]})
if hardware_details["Graphics: Intel Sandy Bridge"] is True:
print(" - Graphics: Intel Sandy Bridge")
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Legacy GVA": all_hardware_patchset["Graphics"]["Legacy GVA"]})
required_patches.update({"Intel Sandy Bridge": all_hardware_patchset["Graphics"]["Intel Sandy Bridge"]})
if hardware_details["Graphics: Intel Ivy Bridge"] is True:
print(" - Graphics: Intel Ivy Bridge")
required_patches.update({"Metal Common": all_hardware_patchset["Graphics"]["Metal Common"]})
required_patches.update({"Intel Ivy Bridge": all_hardware_patchset["Graphics"]["Intel Ivy Bridge"]})
if hardware_details["Graphics: Nvidia Tesla"] is True:
print(" - Graphics: Nvidia Tesla")
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Nvidia Tesla": all_hardware_patchset["Graphics"]["Nvidia Tesla"]})
required_patches.update({"Nvidia Web Drivers": all_hardware_patchset["Graphics"]["Nvidia Web Drivers"]})
if hardware_details["Graphics: Nvidia Kepler"] is True:
print(" - Graphics: Nvidia Kepler")
required_patches.update({"Metal Common": all_hardware_patchset["Graphics"]["Metal Common"]})
required_patches.update({"Nvidia Kepler": all_hardware_patchset["Graphics"]["Nvidia Kepler"]})
if hardware_details["Graphics: AMD TeraScale 1"] is True:
print(" - Graphics: AMD TeraScale 1")
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"AMD TeraScale Common": all_hardware_patchset["Graphics"]["AMD TeraScale Common"]})
required_patches.update({"AMD TeraScale 1": all_hardware_patchset["Graphics"]["AMD TeraScale 1"]})
@@ -259,42 +253,31 @@ class detect_root_patch:
if self.constants.allow_ts2_accel is False or self.constants.detected_os not in self.constants.legacy_accel_support:
# TeraScale 2 MacBooks with faulty GPUs are highly prone to crashing with AMDRadeonX3000 attached
# Additionally, AMDRadeonX3000 requires IOAccelerator downgrade which is not installed without 'Non-Metal IOAccelerator Common'
print(" - Graphics: AMD TeraScale 2 (framebuffer)")
del(required_patches["AMD TeraScale 2"]["Install"]["/System/Library/Extensions"]["AMDRadeonX3000.kext"])
else:
print(" - Graphics: AMD TeraScale 2")
if hardware_details["Brightness: Legacy Backlight Control"] is True:
print(" - Brightness: Legacy Brightness")
required_patches.update({"Legacy Brightness": all_hardware_patchset["Brightness"]["Legacy Brightness"]})
if hardware_details["Audio: Legacy Realtek"] is True:
if self.model in ["iMac7,1", "iMac8,1"]:
print(" - Audio: Legacy Realtek Audio")
required_patches.update({"Legacy Realtek": all_hardware_patchset["Audio"]["Legacy Realtek"]})
else:
print(" - Audio: Legacy non-GOP Audio")
required_patches.update({"Legacy Non-GOP": all_hardware_patchset["Audio"]["Legacy Non-GOP"]})
if hardware_details["Networking: Legacy Wireless"] is True:
print(" - Networking: Legacy WiFi")
required_patches.update({"Legacy WiFi": all_hardware_patchset["Networking"]["Legacy WiFi"]})
if hardware_details["Miscellaneous: Legacy GMUX"] is True:
print(" - Miscellaneous: Legacy GMUX")
required_patches.update({"Legacy GMUX": all_hardware_patchset["Miscellaneous"]["Legacy GMUX"]})
if hardware_details["Miscellaneous: Legacy Keyboard Backlight"]:
print(" - Miscellaneous: Legacy Keyboard Backlight")
required_patches.update({"Legacy Keyboard Backlight": all_hardware_patchset["Miscellaneous"]["Legacy Keyboard Backlight"]})
if required_patches:
host_os_float = float(f"{self.constants.detected_os}.{self.constants.detected_os_minor}")
for patch_name in list(required_patches):
if (
required_patches[patch_name]["OS Support"]["Minimum OS Support"]["OS Major"] > self.constants.detected_os or
required_patches[patch_name]["OS Support"]["Maximum OS Support"]["OS Major"] < self.constants.detected_os
):
del(required_patches[patch_name])
elif (
required_patches[patch_name]["OS Support"]["Minimum OS Support"]["OS Minor"] > self.constants.detected_os_minor or
required_patches[patch_name]["OS Support"]["Maximum OS Support"]["OS Minor"] < self.constants.detected_os_minor
):
patch_os_min_float = float(f'{required_patches[patch_name]["OS Support"]["Minimum OS Support"]["OS Major"]}.{required_patches[patch_name]["OS Support"]["Minimum OS Support"]["OS Minor"]}')
patch_os_max_float = float(f'{required_patches[patch_name]["OS Support"]["Maximum OS Support"]["OS Major"]}.{required_patches[patch_name]["OS Support"]["Maximum OS Support"]["OS Minor"]}')
if (host_os_float < patch_os_min_float or host_os_float > patch_os_max_float):
del(required_patches[patch_name])
else:
if required_patches[patch_name]["Display Name"]:
print(f" - {required_patches[patch_name]['Display Name']}")
else:
print(" - No patch sets found for booted model")

View File

@@ -18,14 +18,14 @@ class grab_patcher_support_pkg:
def download_files(self):
link = self.generate_pkg_link()
if Path(self.constants.payload_local_binaries_root_path).exists():
print("- Removing old Apple Binaries folder")
print("- Removing old Root Patcher Payload folder")
# Delete folder
shutil.rmtree(self.constants.payload_local_binaries_root_path)
download_result = None
local_zip = Path(self.constants.payload_path) / f"Universal-Binaries.zip"
if Path(local_zip).exists():
print(f"- Found local {local_zip} zip, skipping download")
print(f"- Found local Universal-Binaries.zip, skipping download")
download_result = True
else:
print(f"- No local version found, downloading...")