OCLP-CLI updates

This commit is contained in:
Dhinak G
2021-06-21 11:06:40 -04:00
parent db2721354c
commit 2b81e38ea8
6 changed files with 56 additions and 32 deletions
+2 -4
View File
@@ -13,10 +13,8 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
# - name: Install Python Dependencies - name: Install Python Dependencies
# run: | run: pip3 install --upgrade pyinstaller requests
# python3 -m pip install -U pip
# pip3 install pyinstaller
- run: pyinstaller OpenCore-Patcher.spec - run: pyinstaller OpenCore-Patcher.spec
- run: ./after_pyinstaller.sh - run: ./after_pyinstaller.sh
+3
View File
@@ -12,6 +12,9 @@ jobs:
runs-on: self-hosted runs-on: self-hosted
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install Python Dependencies
run: pip3 install --upgrade pyinstaller requests
- run: pyinstaller OCLP-CLI.spec - run: pyinstaller OCLP-CLI.spec
- run: cd dist; zip ../OCLP-CLI.zip OCLP-CLI - run: cd dist; zip ../OCLP-CLI.zip OCLP-CLI
- name: Upload Binary to Artifacts - name: Upload Binary to Artifacts
+32 -23
View File
@@ -12,9 +12,10 @@ from pathlib import Path
from Resources import Build, ModelArray, Constants, SysPatch, device_probe, Utilities from Resources import Build, ModelArray, Constants, SysPatch, device_probe, Utilities
class OpenCoreLegacyPatcher(): class OpenCoreLegacyPatcher:
def __init__(self): def __init__(self):
print("Loading...") print("Loading...")
Utilities.disable_cls()
self.constants = Constants.Constants() self.constants = Constants.Constants()
self.constants.computer = device_probe.Computer.probe() self.constants.computer = device_probe.Computer.probe()
self.computer = self.constants.computer self.computer = self.constants.computer
@@ -35,29 +36,29 @@ class OpenCoreLegacyPatcher():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
# Generic building args # Generic building args
parser.add_argument('--build', help='Build OpenCore', action='store_true', required=False) parser.add_argument("--build", help="Build OpenCore", action="store_true", required=False)
parser.add_argument('--verbose', help='Enable verbose boot', action='store_true', required=False) parser.add_argument("--verbose", help="Enable verbose boot", action="store_true", required=False)
parser.add_argument('--debug_oc', help='Enable OpenCore DEBUG', action='store_true', required=False) parser.add_argument("--debug_oc", help="Enable OpenCore DEBUG", action="store_true", required=False)
parser.add_argument('--debug_kext', help='Enable kext DEBUG', action='store_true', required=False) parser.add_argument("--debug_kext", help="Enable kext DEBUG", action="store_true", required=False)
parser.add_argument('--skip_wifi', help='Skip wifi patches', action='store_true', required=False) parser.add_argument("--skip_wifi", help="Skip wifi patches", action="store_true", required=False)
parser.add_argument('--hide_picker', help='Hide OpenCore picker', action='store_true', required=False) parser.add_argument("--hide_picker", help="Hide OpenCore picker", action="store_true", required=False)
parser.add_argument('--disable_sip', help='Disable SIP', action='store_true', required=False) parser.add_argument("--disable_sip", help="Disable SIP", action="store_true", required=False)
parser.add_argument('--disable_smb', help='Disable SecureBootModel', action='store_true', required=False) parser.add_argument("--disable_smb", help="Disable SecureBootModel", action="store_true", required=False)
parser.add_argument('--vault', help='Enable OpenCore Vaulting', action='store_true', required=False) parser.add_argument("--vault", help="Enable OpenCore Vaulting", action="store_true", required=False)
parser.add_argument('--support_all', help='Allow OpenCore on natively supported Models', action='store_true', required=False) parser.add_argument("--support_all", help="Allow OpenCore on natively supported Models", action="store_true", required=False)
parser.add_argument('--firewire', help='Enable FireWire Booting', action='store_true', required=False) parser.add_argument("--firewire", help="Enable FireWire Booting", action="store_true", required=False)
parser.add_argument('--nvme', help='Enable NVMe Booting', action='store_true', required=False) parser.add_argument("--nvme", help="Enable NVMe Booting", action="store_true", required=False)
parser.add_argument('--disable_amfi', help='Disable AMFI', action='store_true', required=False) parser.add_argument("--disable_amfi", help="Disable AMFI", action="store_true", required=False)
# Building args requiring value values # Building args requiring value values
parser.add_argument('--model', action='store', help='Set custom model', required=False) parser.add_argument("--model", action="store", help="Set custom model", required=False)
parser.add_argument('--metal_gpu', action='store', help='Set Metal GPU Vendor', required=False) parser.add_argument("--metal_gpu", action="store", help="Set Metal GPU Vendor", required=False)
parser.add_argument('--smbios_spoof', action='store', help='Set SMBIOS patching mode', required=False) parser.add_argument("--smbios_spoof", action="store", help="Set SMBIOS patching mode", required=False)
# SysPatch args # SysPatch args
parser.add_argument('--patch_sys_vol', help='Patches root volume', action='store_true', required=False) 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) parser.add_argument("--unpatch_sys_vol", help="Unpatches root volume, EXPERIMENTAL", action="store_true", required=False)
parser.add_argument('--terascale_2', help='Enable TeraScale 2 Acceleration', action='store_true', required=False) parser.add_argument("--terascale_2", help="Enable TeraScale 2 Acceleration", action="store_true", required=False)
args = parser.parse_args() args = parser.parse_args()
@@ -138,6 +139,13 @@ class OpenCoreLegacyPatcher():
self.constants.custom_model = args.model self.constants.custom_model = args.model
self.set_defaults(self.constants.custom_model, False) self.set_defaults(self.constants.custom_model, False)
self.build_opencore() self.build_opencore()
elif self.computer.real_model not in ModelArray.SupportedSMBIOS and self.constants.allow_oc_everywhere is False:
print(
"""Your model is not supported by this patcher for running unsupported OSes!"
If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
)
sys.exit(1)
else: else:
print(f"- Using detected model: {self.constants.computer.real_model}") print(f"- Using detected model: {self.constants.computer.real_model}")
self.build_opencore() self.build_opencore()
@@ -183,11 +191,11 @@ class OpenCoreLegacyPatcher():
# Some models have a supported dGPU, others don't # Some models have a supported dGPU, others don't
self.constants.sip_status = True self.constants.sip_status = True
# self.constants.secure_status = True # Monterey # self.constants.secure_status = True # Monterey
#self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently # self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently
else: else:
self.constants.sip_status = False # Unsigned kexts self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Modified root volume self.constants.secure_status = False # Modified root volume
#self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently # self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently
if model == "MacBook8,1": if model == "MacBook8,1":
# MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing # MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing
self.constants.serial_settings == "Moderate" self.constants.serial_settings == "Moderate"
@@ -204,7 +212,8 @@ class OpenCoreLegacyPatcher():
def install_opencore(self): def install_opencore(self):
Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi() Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()
OpenCoreLegacyPatcher() OpenCoreLegacyPatcher()
# Example arg for OCLP command line # Example arg for OCLP command line
# ./OCLP-CLI --build --verbose --debug_oc --debug_kext --model iMac11,2 # ./OCLP-CLI --build --verbose --debug_oc --debug_kext --model iMac11,2
+1 -1
View File
@@ -23,7 +23,7 @@ exe = EXE(pyz,
a.binaries, a.binaries,
a.zipfiles, a.zipfiles,
a.datas, a.datas,
[], [('u', None, 'OPTION')],
name='OCLP-CLI', name='OCLP-CLI',
debug=False, debug=False,
bootloader_ignore_signals=False, bootloader_ignore_signals=False,
+3 -4
View File
@@ -7,8 +7,7 @@ import platform
import subprocess import subprocess
import sys import sys
from Resources import (Build, CliMenu, Constants, ModelArray, SysPatch, from Resources import Build, CliMenu, Constants, ModelArray, SysPatch, Utilities, device_probe
Utilities, device_probe)
class OpenCoreLegacyPatcher: class OpenCoreLegacyPatcher:
@@ -64,11 +63,11 @@ class OpenCoreLegacyPatcher:
# Some models have a supported dGPU, others don't # Some models have a supported dGPU, others don't
self.constants.sip_status = True self.constants.sip_status = True
# self.constants.secure_status = True # Monterey # self.constants.secure_status = True # Monterey
#self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently # self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently
else: else:
self.constants.sip_status = False # Unsigned kexts self.constants.sip_status = False # Unsigned kexts
self.constants.secure_status = False # Modified root volume self.constants.secure_status = False # Modified root volume
#self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently # self.constants.disable_amfi = False # Signed bundles, Don't need to explicitly set currently
if model == "MacBook8,1": if model == "MacBook8,1":
# MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing # MacBook8,1 has an odd bug where it cannot install Monterey with Minimal spoofing
self.constants.serial_settings == "Moderate" self.constants.serial_settings == "Moderate"
+15
View File
@@ -66,9 +66,11 @@ def csr_decode(csr_active_config):
else: else:
return True return True
def friendly_hex(integer: int): def friendly_hex(integer: int):
return "{:02X}".format(integer) return "{:02X}".format(integer)
def patching_status(): def patching_status():
# Detection for Root Patching # Detection for Root Patching
sip_enabled = True # System Integrity Protection sip_enabled = True # System Integrity Protection
@@ -94,7 +96,18 @@ def patching_status():
return sip_enabled, sbm_enabled, amfi_enabled, fv_enabled return sip_enabled, sbm_enabled, amfi_enabled, fv_enabled
clear = True
def disable_cls():
global clear
clear = False
def cls(): def cls():
global clear
if not clear:
return
if not check_recovery(): if not check_recovery():
os.system("cls" if os.name == "nt" else "clear") os.system("cls" if os.name == "nt" else "clear")
else: else:
@@ -117,6 +130,7 @@ def get_nvram(variable: str, uuid: str = None, *, decode: bool = False):
value = value.strip(b"\0").decode() value = value.strip(b"\0").decode()
return value return value
def download_file(link, location): def download_file(link, location):
print("- Attempting download from following link:") print("- Attempting download from following link:")
print(link) print(link)
@@ -140,6 +154,7 @@ def download_file(link, location):
chunk = file.read(1024 * 1024 * 16) chunk = file.read(1024 * 1024 * 16)
print(f"- Checksum: {checksum.hexdigest()}") print(f"- Checksum: {checksum.hexdigest()}")
# def menu(title, prompt, menu_options, add_quit=True, auto_number=False, in_between=[], top_level=False): # def menu(title, prompt, menu_options, add_quit=True, auto_number=False, in_between=[], top_level=False):
# return_option = ["Q", "Quit", None] if top_level else ["B", "Back", None] # return_option = ["Q", "Quit", None] if top_level else ["B", "Back", None]
# if add_quit: menu_options.append(return_option) # if add_quit: menu_options.append(return_option)