mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-21 22:50:51 +10:00
Adjust build to py scheme
This commit is contained in:
@@ -7,7 +7,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from resources import Build, cli_menu, constants, utilities, device_probe, os_probe, defaults, arguments
|
from resources import build, cli_menu, constants, utilities, device_probe, os_probe, defaults, arguments
|
||||||
from data import model_array
|
from data import model_array
|
||||||
|
|
||||||
class OpenCoreLegacyPatcher:
|
class OpenCoreLegacyPatcher:
|
||||||
@@ -67,11 +67,11 @@ class OpenCoreLegacyPatcher:
|
|||||||
menu = utilities.TUIMenu(title, "Please select an option: ", in_between=in_between, auto_number=True, top_level=True)
|
menu = utilities.TUIMenu(title, "Please select an option: ", in_between=in_between, auto_number=True, top_level=True)
|
||||||
|
|
||||||
options = (
|
options = (
|
||||||
[["Build OpenCore", Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()]]
|
[["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
|
if ((self.constants.custom_model or self.computer.real_model) in model_array.SupportedSMBIOS) or self.constants.allow_oc_everywhere is True
|
||||||
else []
|
else []
|
||||||
) + [
|
) + [
|
||||||
["Install OpenCore to USB/internal drive", Build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).copy_efi()],
|
["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],
|
["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],
|
["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],
|
["Patcher Settings", cli_menu.MenuOptions(self.constants.custom_model or self.computer.real_model, self.constants).patcher_settings],
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
from resources import defaults, Build
|
from resources import defaults, build
|
||||||
from data import example_data, model_array
|
from data import example_data, model_array
|
||||||
|
|
||||||
# Generic building args
|
# Generic building args
|
||||||
@@ -137,7 +137,7 @@ If you plan to create the USB for another machine, please select the "Change Mod
|
|||||||
|
|
||||||
# Avoid running the root patcher if we're just building
|
# Avoid running the root patcher if we're just building
|
||||||
if self.args.build:
|
if self.args.build:
|
||||||
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
||||||
elif self.args.patch_sys_vol:
|
elif self.args.patch_sys_vol:
|
||||||
if self.args.moj_cat_accel:
|
if self.args.moj_cat_accel:
|
||||||
print("- Set Mojave/Catalina root patch configuration")
|
print("- Set Mojave/Catalina root patch configuration")
|
||||||
@@ -171,7 +171,7 @@ If you plan to create the USB for another machine, please select the "Change Mod
|
|||||||
for model in model_array.SupportedSMBIOS:
|
for model in model_array.SupportedSMBIOS:
|
||||||
print(f"Validating predefined model: {model}")
|
print(f"Validating predefined model: {model}")
|
||||||
settings.custom_model = model
|
settings.custom_model = model
|
||||||
Build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
build.BuildOpenCore(settings.custom_model, settings).build_opencore()
|
||||||
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
print("Error on build!")
|
print("Error on build!")
|
||||||
@@ -185,7 +185,7 @@ If you plan to create the USB for another machine, please select the "Change Mod
|
|||||||
settings.computer = model
|
settings.computer = model
|
||||||
settings.custom_model = ""
|
settings.custom_model = ""
|
||||||
print(f"Validating dumped model: {settings.computer.real_model}")
|
print(f"Validating dumped model: {settings.computer.real_model}")
|
||||||
Build.BuildOpenCore(settings.computer.real_model, settings).build_opencore()
|
build.BuildOpenCore(settings.computer.real_model, settings).build_opencore()
|
||||||
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
result = subprocess.run([settings.ocvalidate_path, f"{settings.opencore_release_folder}/EFI/OC/config.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
print("Error on build!")
|
print("Error on build!")
|
||||||
|
|||||||
Reference in New Issue
Block a user