Convert additional files to snake naming scheme

This commit is contained in:
Mykola Grymalyuk
2021-10-03 13:54:12 -06:00
parent e33997320b
commit a70b18dd50
16 changed files with 50 additions and 53 deletions

View File

@@ -15,7 +15,7 @@ jobs:
- run: python3 create-offline-build.py
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: ./after_pyinstaller.sh
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: cd dist; zip -r ../OpenCore-Patcher-TUI-Offline.app.zip OpenCore-Patcher.app
- name: Upload App to Artifacts
uses: actions/upload-artifact@v2

View File

@@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
- run: ./after_pyinstaller.sh
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
- run: ./../sign-tui.sh
- name: Upload App to Artifacts

View File

@@ -22,9 +22,9 @@ jobs:
- name: Merge new GUI
run: cp OCLP-CLI OpenCore\ Patcher.app/Contents/Resources/
- run: python3 merge_gui.py
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/OCLP-CLI"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/oclpd"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements entitlements.plist -o runtime "OpenCore Patcher.app"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/OCLP-CLI"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app/Contents/Resources/oclpd"'
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "OpenCore Patcher.app"'
- run: ditto -c -k --sequesterRsrc --keepParent OpenCore\ Patcher.app OpenCore-Patcher-GUI.app.zip
- run: ./../sign-gui.sh
- name: Upload GUI to Artifacts

View File

@@ -7,8 +7,8 @@ import subprocess
import sys
from pathlib import Path
from resources import Build, cli_menu, Constants, ModelArray, sys_patch, Utilities, device_probe, os_probe, defaults, arguments
from data import smbios_data, cpu_data
from resources import Build, cli_menu, Constants, Utilities, device_probe, os_probe, defaults, arguments
from data import model_array
class OpenCoreLegacyPatcher:
def __init__(self):
@@ -37,12 +37,6 @@ class OpenCoreLegacyPatcher:
else:
print("- No arguments present, loading TUI")
def build_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
def install_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()
def main_menu(self):
response = None
while not (response and response == -1):
@@ -51,7 +45,7 @@ class OpenCoreLegacyPatcher:
f"Selected Model: {self.constants.custom_model or self.computer.real_model}",
]
if (self.constants.custom_model or self.computer.real_model) not in ModelArray.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:
if (self.constants.custom_model or self.computer.real_model) not in model_array.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:
in_between = [
"Your model is not supported by this patcher for running unsupported OSes!",
"",
@@ -73,11 +67,11 @@ class OpenCoreLegacyPatcher:
menu = Utilities.TUIMenu(title, "Please select an option: ", in_between=in_between, auto_number=True, top_level=True)
options = (
[["Build OpenCore", self.build_opencore]]
if ((self.constants.custom_model or self.computer.real_model) in ModelArray.SupportedSMBIOS) or self.constants.allow_oc_everywhere is True
[["Build OpenCore", Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()]]
if ((self.constants.custom_model or self.computer.real_model) in model_array.SupportedSMBIOS) or self.constants.allow_oc_everywhere is True
else []
) + [
["Install OpenCore to USB/internal drive", self.install_opencore],
["Install OpenCore to USB/internal drive", Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()],
["Post-Install Volume Patch", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).PatchVolume],
["Change Model", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).change_model],
["Patcher Settings", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).patcher_settings],

View File

@@ -35,7 +35,7 @@ exe = EXE(pyz,
console=True )
app = BUNDLE(exe,
name='OpenCore-Patcher.app',
icon="OC-Patcher.icns",
icon="payloads/OC-Patcher.icns",
bundle_identifier=None,
info_plist={
"CFBundleShortVersionString": Constants.Constants().patcher_version,

View File

@@ -1,2 +1,2 @@
#!/bin/sh
cp launcher.sh dist/OpenCore-Patcher.app/Contents/MacOS/Launcher
cp paylods/launcher.sh dist/OpenCore-Patcher.app/Contents/MacOS/Launcher

View File

@@ -14,8 +14,8 @@ import ast
from pathlib import Path
from datetime import date
from resources import Constants, ModelArray, Utilities, device_probe, generate_smbios
from data import smbios_data, bluetooth_data, cpu_data, os_data
from resources import Constants, Utilities, device_probe, generate_smbios
from data import smbios_data, bluetooth_data, cpu_data, os_data, model_array
def rmtree_handler(func, path, exc_info):
@@ -99,7 +99,7 @@ class BuildOpenCore:
# Essential kexts
("Lilu.kext", self.constants.lilu_version, self.constants.lilu_path, lambda: True),
("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path, lambda: self.constants.allow_oc_everywhere is False),
("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path, lambda: self.model in ModelArray.MacPro),
("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path, lambda: self.model in model_array.MacPro),
# Modded RestrictEvents with displaypolicyd blocked to fix dGPU switching
("RestrictEvents.kext", self.constants.restrictevents_mbp_version, self.constants.restrictevents_mbp_path, lambda: self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1"]),
("SMC-Spoof.kext", self.constants.smcspoof_version, self.constants.smcspoof_path, lambda: self.constants.allow_oc_everywhere is False),
@@ -117,9 +117,9 @@ class BuildOpenCore:
("nForceEthernet.kext", self.constants.nforce_version, self.constants.nforce_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Nvidia"),
("MarvelYukonEthernet.kext", self.constants.marvel_version, self.constants.marvel_path, lambda: smbios_data.smbios_dictionary[self.model]["Ethernet Chipset"] == "Marvell"),
# Legacy audio
("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path, lambda: (self.model in ModelArray.LegacyAudio or self.model in ModelArray.MacPro) and self.constants.set_alc_usage is True),
("AppleALC.kext", self.constants.applealc_version, self.constants.applealc_path, lambda: (self.model in model_array.LegacyAudio or self.model in model_array.MacPro) and self.constants.set_alc_usage is True),
# IDE patch
("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: self.model in ModelArray.IDEPatch),
("AppleIntelPIIXATA.kext", self.constants.piixata_version, self.constants.piixata_path, lambda: self.model in model_array.IDEPatch),
# Misc
("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path, lambda: smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.kaby_lake.value),
("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path, lambda: self.constants.kext_debug is True),
@@ -157,7 +157,7 @@ class BuildOpenCore:
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 1 of 2 - Patch read_erandom (inlined in _early_random)")["MaxKernel"] = ""
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Comment", "SurPlus v1 - PART 2 of 2 - Patch register_and_init_prng")["MaxKernel"] = ""
if not self.constants.custom_model and (self.constants.allow_oc_everywhere is True or self.model in ModelArray.MacPro):
if not self.constants.custom_model and (self.constants.allow_oc_everywhere is True or self.model in model_array.MacPro):
# Use Innie's same logic:
# https://github.com/cdf/Innie/blob/v1.3.0/Innie/Innie.cpp#L90-L97
for i, controller in enumerate(self.computer.storage):
@@ -327,7 +327,7 @@ class BuildOpenCore:
usb_map_path.exists()
and self.constants.allow_oc_everywhere is False
and self.model not in ["Xserve2,1", "Dortania1,1"]
and (self.model in ModelArray.Missing_USB_Map or self.constants.serial_settings in ["Moderate", "Advanced"])
and (self.model in model_array.Missing_USB_Map or self.constants.serial_settings in ["Moderate", "Advanced"])
):
print("- Adding USB-Map.kext")
Path(self.constants.map_kext_folder).mkdir()
@@ -347,7 +347,7 @@ class BuildOpenCore:
elif self.model == "MacBookPro10,1":
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"agdpmod": "vit9696"}
if self.model not in ModelArray.NoAGPMSupport:
if self.model not in model_array.NoAGPMSupport:
print("- Adding AppleGraphicsPowerManagement Override")
agpm_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsPowerManagement/Info.plist")
Path(self.constants.agpm_kext_folder).mkdir()
@@ -355,7 +355,7 @@ class BuildOpenCore:
shutil.copy(agpm_map_path, self.constants.agpm_contents_folder)
self.get_kext_by_bundle_path("AGPM-Override.kext")["Enabled"] = True
if self.model in ModelArray.AGDPSupport:
if self.model in model_array.AGDPSupport:
print("- Adding AppleGraphicsDevicePolicy Override")
agdp_map_path = Path(self.constants.plist_folder_path) / Path("AppleGraphicsDevicePolicy/Info.plist")
Path(self.constants.agdp_kext_folder).mkdir()
@@ -364,7 +364,7 @@ class BuildOpenCore:
self.get_kext_by_bundle_path("AGDP-Override.kext")["Enabled"] = True
# AGPM Patch
if self.model in ModelArray.DualGPUPatch:
if self.model in model_array.DualGPUPatch:
print("- Adding dual GPU patch")
if not self.constants.custom_model and self.computer.dgpu and self.computer.dgpu.pci_path:
self.gfx0_path = self.computer.dgpu.pci_path
@@ -374,7 +374,7 @@ class BuildOpenCore:
print("- Failed to find GFX0 Device path, falling back on known logic")
self.gfx0_path = "PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"
if self.model in ModelArray.IntelNvidiaDRM and self.constants.drm_support is True:
if self.model in model_array.IntelNvidiaDRM and self.constants.drm_support is True:
print("- Prioritizing DRM support over Intel QuickSync")
self.config["DeviceProperties"]["Add"][self.gfx0_path] = {"agdpmod": "vit9696", "shikigva": 256}
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x2,0x0)"] = {
@@ -518,7 +518,7 @@ class BuildOpenCore:
nvidia_patch(self, self.gfx0_path)
else:
print("- Failed to find vendor")
elif not self.constants.custom_model and self.model in ModelArray.LegacyGPU and self.computer.dgpu:
elif not self.constants.custom_model and self.model in model_array.LegacyGPU and self.computer.dgpu:
print(f"- Detected dGPU: {Utilities.friendly_hex(self.computer.dgpu.vendor_id)}:{Utilities.friendly_hex(self.computer.dgpu.device_id)}")
if self.computer.dgpu.arch in [
device_probe.AMD.Archs.Legacy_GCN,
@@ -531,7 +531,7 @@ class BuildOpenCore:
elif self.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
backlight_path_detection(self)
nvidia_patch(self, self.gfx0_path)
if self.model in ModelArray.MacPro:
if self.model in model_array.MacPro:
if not self.constants.custom_model:
for i, device in enumerate(self.computer.gpus):
print(f"- Found dGPU ({i + 1}): {Utilities.friendly_hex(device.vendor_id)}:{Utilities.friendly_hex(device.device_id)}")
@@ -627,7 +627,7 @@ class BuildOpenCore:
pass
# ThirdPartDrives Check
if self.model in ModelArray.SATAPatch and self.constants.allow_oc_everywhere is False:
if self.model in model_array.SATAPatch and self.constants.allow_oc_everywhere is False:
print("- Adding SATA Hibernation Patch")
self.config["Kernel"]["Quirks"]["ThirdPartyDrives"] = True
@@ -811,7 +811,7 @@ class BuildOpenCore:
if (
self.constants.allow_oc_everywhere is False
and self.model not in ["Xserve2,1", "Dortania1,1"]
and (self.model in ModelArray.Missing_USB_Map or self.constants.serial_settings in ["Moderate", "Advanced"])
and (self.model in model_array.Missing_USB_Map or self.constants.serial_settings in ["Moderate", "Advanced"])
):
new_map_ls = Path(self.constants.map_contents_folder) / Path("Info.plist")
map_config = plistlib.load(Path(new_map_ls).open("rb"))
@@ -851,7 +851,7 @@ class BuildOpenCore:
if not entry.startswith(self.spoofed_board):
amc_config["IOKitPersonalities"]["AppleMuxControl"]["ConfigMap"].pop(entry)
plistlib.dump(amc_config, Path(new_amc_ls).open("wb"), sort_keys=True)
if self.model not in ModelArray.NoAGPMSupport:
if self.model not in model_array.NoAGPMSupport:
new_agpm_ls = Path(self.constants.agpm_contents_folder) / Path("Info.plist")
agpm_config = plistlib.load(Path(new_agpm_ls).open("rb"))
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"][self.spoofed_board] = agpm_config["IOKitPersonalities"]["AGPM"]["Machines"].pop(self.model)
@@ -868,7 +868,7 @@ class BuildOpenCore:
agpm_config["IOKitPersonalities"]["AGPM"]["Machines"].pop(entry)
plistlib.dump(agpm_config, Path(new_agpm_ls).open("wb"), sort_keys=True)
if self.model in ModelArray.AGDPSupport:
if self.model in model_array.AGDPSupport:
new_agdp_ls = Path(self.constants.agdp_contents_folder) / Path("Info.plist")
agdp_config = plistlib.load(Path(new_agdp_ls).open("rb"))
agdp_config["IOKitPersonalities"]["AppleGraphicsDevicePolicy"]["ConfigMap"][self.spoofed_board] = agdp_config["IOKitPersonalities"]["AppleGraphicsDevicePolicy"]["ConfigMap"].pop(

View File

@@ -474,7 +474,7 @@ class Constants:
# Icons
@property
def app_icon_path(self):
return self.current_path / Path("OC-Patcher.icns")
return self.payload_path / Path("OC-Patcher.icns")
@property
def icon_path_external(self):

View File

@@ -1,8 +1,8 @@
import argparse
import sys
import subprocess
from resources import ModelArray, defaults, Build
from data import example_data
from resources import defaults, Build
from data import example_data, model_array
# Generic building args
class arguments:
@@ -34,6 +34,8 @@ class arguments:
# sys_patch args
parser.add_argument("--patch_sys_vol", help="Patches root volume", action="store_true", required=False)
parser.add_argument("--unpatch_sys_vol", help="Unpatches root volume, EXPERIMENTAL", action="store_true", required=False)
# validation args
parser.add_argument("--validate", help="Runs Validation Tests for CI", action="store_true", required=False)
self.args = parser.parse_args()
@@ -53,7 +55,7 @@ class arguments:
print(f"- Using custom model: {self.args.model}")
settings.custom_model = self.args.model
defaults.generate_defaults.probe(settings.custom_model, False, settings)
elif settings.computer.real_model not in ModelArray.SupportedSMBIOS and settings.allow_oc_everywhere is False:
elif settings.computer.real_model not in model_array.SupportedSMBIOS and settings.allow_oc_everywhere is False:
print(
"""Your model is not supported by this patcher for running unsupported OSes!"
@@ -166,7 +168,7 @@ If you plan to create the USB for another machine, please select the "Change Mod
]
settings.validate = True
def build_prebuilt():
for model in ModelArray.SupportedSMBIOS:
for model in model_array.SupportedSMBIOS:
print(f"Validating predefined model: {model}")
settings.custom_model = model
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()

View File

@@ -3,8 +3,8 @@
from __future__ import print_function
import subprocess
from resources import Constants, Utilities, defaults, ModelArray, sys_patch
from data import cpu_data, smbios_data
from resources import Constants, Utilities, defaults, sys_patch
from data import cpu_data, smbios_data, model_array
class MenuOptions:
@@ -732,7 +732,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
"""
)
self.constants.custom_model = input("Please enter the model identifier of the target machine: ").strip()
if self.constants.custom_model not in ModelArray.SupportedSMBIOS:
if self.constants.custom_model not in model_array.SupportedSMBIOS:
print(
f"""
{self.constants.custom_model} is not a valid SMBIOS Identifier for macOS {self.constants.os_support}!
@@ -740,7 +740,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
)
print_models = input(f"Print list of valid options for macOS {self.constants.os_support}? (y/n)")
if print_models.lower() in {"y", "yes"}:
print("\n".join(ModelArray.SupportedSMBIOS))
print("\n".join(model_array.SupportedSMBIOS))
input("\nPress [ENTER] to continue")
else:
defaults.generate_defaults.probe(self.constants.custom_model, False, self.constants)

View File

@@ -1,5 +1,6 @@
# Generate Default Data
from resources import Utilities, device_probe, ModelArray
from resources import Utilities, device_probe
from data import model_array
class generate_defaults():
def probe(model, host_is_target, settings):
@@ -22,10 +23,10 @@ class generate_defaults():
) or (isinstance(settings.computer.wifi, device_probe.Atheros) and settings.computer.wifi.chipset == device_probe.Atheros.Chipsets.AirPortAtheros40):
settings.sip_status = False
settings.allow_fv_root = True # Allow FileVault on broken seal
elif model in ModelArray.LegacyGPU:
elif model in model_array.LegacyGPU:
settings.disable_cs_lv = True
if model in ModelArray.LegacyGPU:
if model in model_array.LegacyGPU:
if host_is_target and Utilities.check_metal_support(device_probe, settings.computer) is True:
# Building on device and we have a native, supported GPU
if settings.computer.dgpu and settings.computer.dgpu.arch == device_probe.NVIDIA.Archs.Kepler:
@@ -41,7 +42,7 @@ class generate_defaults():
settings.secure_status = False # Root volume modified
settings.amfi_status = False # Unsigned binaries
settings.allow_fv_root = True # Allow FileVault on broken seal
if model in ModelArray.ModernGPU:
if model in model_array.ModernGPU:
# Systems with Ivy or Kepler GPUs, Monterey requires root patching for accel
settings.sip_status = False # Unsigned kexts
settings.secure_status = False # Modified root volume

View File

@@ -11,8 +11,8 @@ import subprocess
import zipfile
from pathlib import Path
from resources import Constants, device_probe, ModelArray, Utilities
from data import sip_data, sys_patch_data
from resources import Constants, device_probe, Utilities
from data import sip_data, sys_patch_data, model_array
class PatchSysVolume:
@@ -689,11 +689,11 @@ set million colour before rebooting"""
def detect_patch_set(self):
self.detect_gpus()
if self.model in ModelArray.LegacyBrightness:
if self.model in model_array.LegacyBrightness:
if self.constants.detected_os > self.constants.catalina:
self.brightness_legacy = True
if self.model in ["iMac7,1", "iMac8,1"] or (self.model in ModelArray.LegacyAudio and Utilities.check_kext_loaded("AppleALC", self.constants.detected_os) is False):
if self.model in ["iMac7,1", "iMac8,1"] or (self.model in model_array.LegacyAudio and Utilities.check_kext_loaded("AppleALC", self.constants.detected_os) is False):
# Special hack for systems with botched GOPs
# TL;DR: No Boot Screen breaks Lilu, therefore breaking audio
if self.constants.detected_os > self.constants.catalina: