Fix pathing

This commit is contained in:
Dhinak G
2021-01-24 15:12:55 -05:00
parent a7e043bf4f
commit 328527a663
4 changed files with 147 additions and 116 deletions

View File

@@ -3,7 +3,6 @@
from __future__ import print_function
import subprocess
from pathlib import Path
from Resources import build, ModelArray, Versions, utilities
@@ -12,27 +11,27 @@ PATCHER_VERSION = "0.0.9"
class OpenCoreLegacyPatcher():
def __init__(self):
self.versions = Versions.Versions()
self.custom_model: str = None
self.current_model: str = None
opencore_model: str = subprocess.run("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode()
if not opencore_model.startswith("nvram: Error getting variable"):
opencore_model = subprocess.run("nvram 4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:oem-product".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
opencore_model = [line.strip().split(":oem-product ", 1)[1] for line in opencore_model.stdout.decode().split("\n") if line.strip().startswith("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:")][0]
opencore_model = [line.strip().split(":oem-product ", 1)[1] for line in opencore_model.split("\n") if line.strip().startswith("4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102:")][0]
self.current_model = opencore_model
else:
self.current_model = subprocess.run("system_profiler SPHardwareDataType".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
self.current_model = [line.strip().split(": ", 1)[1] for line in self.current_model.stdout.decode().split("\n") if line.strip().startswith("Model Identifier")][0]
def build_opencore(self):
build.OpenCoreMenus().build_opencore_menu(self.custom_model or self.current_model)
build.OpenCoreMenus(self.versions).build_opencore_menu(self.custom_model or self.current_model)
def install_opencore(self):
utilities.cls()
utilities.header(["Installing OpenCore to Drive"])
if Path(Versions.opencore_path_done).exists():
if self.versions.opencore_path_done.exists():
print("\nFound OpenCore in Build Folder")
build.BuildOpenCore.copy_efi()
build.BuildOpenCore(self.custom_model or self.current_model, self.versions).copy_efi()
input("Press [Enter] to go back.")
else: