mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-22 19:10:15 +10:00
Remove unused code path
This commit is contained in:
@@ -59,53 +59,39 @@ class OpenCoreLegacyPatcher:
|
|||||||
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
|
||||||
print("- Rerouting payloads location")
|
print("- Rerouting payloads location")
|
||||||
self.constants.payload_path = sys._MEIPASS / Path("payloads")
|
self.constants.payload_path = sys._MEIPASS / Path("payloads")
|
||||||
|
print("- Waiting for payloads to unpack...")
|
||||||
|
while self.constants.unpack_thread.is_alive():
|
||||||
|
time.sleep(0.1)
|
||||||
arguments.arguments().parse_arguments(self.constants)
|
arguments.arguments().parse_arguments(self.constants)
|
||||||
else:
|
else:
|
||||||
print(f"- No arguments present, loading {'GUI' if self.constants.wxpython_variant is True else 'TUI'} mode")
|
print(f"- No arguments present, loading {'GUI' if self.constants.wxpython_variant is True else 'TUI'} mode")
|
||||||
|
|
||||||
def reroute_payloads(self):
|
def reroute_payloads(self):
|
||||||
# if self.constants.launcher_binary and self.constants.wxpython_variant is True and not self.constants.launcher_script:
|
if self.constants.launcher_binary and self.constants.wxpython_variant is True and not self.constants.launcher_script:
|
||||||
if True:
|
|
||||||
print("- Running in Binary GUI mode, switching to tmp directory")
|
print("- Running in Binary GUI mode, switching to tmp directory")
|
||||||
self.temp_dir = tempfile.TemporaryDirectory()
|
self.temp_dir = tempfile.TemporaryDirectory()
|
||||||
print(f"- New payloads location: {self.temp_dir.name}")
|
print(f"- New payloads location: {self.temp_dir.name}")
|
||||||
# hdiutil create ./tmp.dmg -megabytes 32000 -format UDZO -ov -volname "payloads" -fs HFS+ -srcfolder ./payloads -passphrase password -encryption
|
|
||||||
# hdiutil convert ./tmp.dmg -format UDZO -o payloads.dmg
|
|
||||||
|
|
||||||
# hdiutil attach ./payloads.dmg -mountpoint tmp -nobrowse
|
|
||||||
|
|
||||||
# create payloads directory
|
|
||||||
print("- Creating payloads directory")
|
print("- Creating payloads directory")
|
||||||
Path(self.temp_dir.name / Path("payloads")).mkdir(parents=True, exist_ok=True)
|
Path(self.temp_dir.name / Path("payloads")).mkdir(parents=True, exist_ok=True)
|
||||||
|
self.clean_up()
|
||||||
use_zip = False
|
output = subprocess.run(
|
||||||
# unzip payloads.zip to payloads directory
|
[
|
||||||
|
"hdiutil", "attach", "-noverify", f"{self.constants.payload_path}.dmg", "-mountpoint", Path(self.temp_dir.name / Path("payloads")),
|
||||||
if use_zip is True:
|
"-nobrowse", "-shadow", Path(self.temp_dir.name / Path("payloads_overlay")), "-passphrase", "password"
|
||||||
print("- Unzipping payloads.zip")
|
],
|
||||||
output = subprocess.run(["unzip", "-P", "password", "-o", "-q", "-d", self.temp_dir.name, f"{self.constants.payload_path}.zip"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||||
if output.returncode == 0:
|
)
|
||||||
print(f"- Unzipped payloads.zip successfully: {self.temp_dir.name}")
|
if output.returncode == 0:
|
||||||
self.constants.current_path = Path(self.temp_dir.name)
|
print("- Mounted payloads.dmg")
|
||||||
self.constants.payload_path = Path(self.temp_dir.name) / Path("payloads")
|
self.constants.current_path = Path(self.temp_dir.name)
|
||||||
else:
|
self.constants.payload_path = Path(self.temp_dir.name) / Path("payloads")
|
||||||
print("- Failed to unzip payloads.zip, skipping")
|
atexit.register(self.clean_up)
|
||||||
print(f"Output: {output.stdout.decode('utf-8')}")
|
|
||||||
print(f"Return code: {output.returncode}")
|
|
||||||
else:
|
else:
|
||||||
self.clean_up()
|
print("- Failed to mount payloads.dmg")
|
||||||
output = subprocess.run(["hdiutil", "attach", f"{self.constants.payload_path}.dmg", "-mountpoint", Path(self.temp_dir.name / Path("payloads")), "-nobrowse", "-shadow", Path(self.temp_dir.name / Path("payloads_overlay")), "-passphrase", "password"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
print(f"Output: {output.stdout.decode()}")
|
||||||
if output.returncode == 0:
|
print(f"Return Code: {output.returncode}")
|
||||||
print("- Mounted payloads.dmg")
|
print("- Exiting...")
|
||||||
self.constants.current_path = Path(self.temp_dir.name)
|
sys.exit(1)
|
||||||
self.constants.payload_path = Path(self.temp_dir.name) / Path("payloads")
|
|
||||||
atexit.register(self.clean_up)
|
|
||||||
else:
|
|
||||||
print("- Failed to mount payloads.dmg")
|
|
||||||
print(f"Output: {output.stdout.decode()}")
|
|
||||||
print(f"Return Code: {output.returncode}")
|
|
||||||
print("- Exiting...")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
def clean_up(self):
|
def clean_up(self):
|
||||||
# Grab info on all dmgs mounted
|
# Grab info on all dmgs mounted
|
||||||
|
|||||||
Reference in New Issue
Block a user