Add launcher type detection

This commit is contained in:
Mykola Grymalyuk
2021-12-22 10:56:16 -07:00
parent 118853cd46
commit 7c21628ea2
3 changed files with 10 additions and 0 deletions

1
.gitignore vendored
View File

@@ -21,3 +21,4 @@ __pycache__/
/docs/yarn-error.log
/docs/node_modules/
/payloads/List.txt
/payloads/Installer.sh

View File

@@ -26,6 +26,13 @@ class OpenCoreLegacyPatcher:
self.constants.computer = device_probe.Computer.probe()
self.constants.recovery_status = utilities.check_recovery()
self.computer = self.constants.computer
launcher_script = None
launcher_binary = sys.executable
if "python" in launcher_binary:
# We're running from source
launcher_script = __file__
self.constants.launcher_binary = launcher_binary
self.constants.launcher_script = launcher_script
defaults.generate_defaults.probe(self.computer.real_model, True, self.constants)
if utilities.check_cli_args() is not None:
print("- Detected arguments, switching to CLI mode")

View File

@@ -96,6 +96,8 @@ class Constants:
self.patch_disk = "" # Set Root Volume to patch
self.validate = False # Enable validation testing for CI
self.recovery_status = False # Detect if booted into RecoveryOS
self.launcher_binary = None # Determine launch binary (ie. Python vs PyInstaller)
self.launcher_script = None # Determine launch file (if run via Python)
## Hardware
self.computer: device_probe.Computer = None # type: ignore