arguments.py: Avoid overwritting vars in auto patcher

This commit is contained in:
Mykola Grymalyuk
2022-05-05 14:53:52 -06:00
parent ca35f11ad4
commit b39ff91251
+80 -79
View File
@@ -10,90 +10,91 @@ class arguments:
self.args = utilities.check_cli_args() self.args = utilities.check_cli_args()
def parse_arguments(self, settings): def parse_arguments(self, settings):
if self.args.model: if not self.args.auto_patch:
if self.args.model: if self.args.model:
print(f"- Using custom model: {self.args.model}") if self.args.model:
settings.custom_model = self.args.model print(f"- Using custom model: {self.args.model}")
defaults.generate_defaults.probe(settings.custom_model, False, settings) settings.custom_model = self.args.model
elif settings.computer.real_model not in model_array.SupportedSMBIOS and settings.allow_oc_everywhere is False: defaults.generate_defaults.probe(settings.custom_model, False, settings)
print( elif settings.computer.real_model not in model_array.SupportedSMBIOS and settings.allow_oc_everywhere is False:
"""Your model is not supported by this patcher for running unsupported OSes!" 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.""" If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
) )
sys.exit(1) sys.exit(1)
else:
print(f"- Using detected model: {settings.computer.real_model}")
defaults.generate_defaults.probe(settings.custom_model, True, settings)
if self.args.disk:
print(f"- Install Disk set: {self.args.disk}")
settings.disk = self.args.disk
if self.args.validate:
validation.validate(settings)
if self.args.verbose:
print("- Set verbose configuration")
settings.verbose_debug = True
else: else:
print(f"- Using detected model: {settings.computer.real_model}") settings.verbose_debug = False # Override Defaults detected
defaults.generate_defaults.probe(settings.custom_model, True, settings) if self.args.debug_oc:
print("- Set OpenCore DEBUG configuration")
if self.args.disk: settings.opencore_debug = True
print(f"- Install Disk set: {self.args.disk}") settings.opencore_build = "DEBUG"
settings.disk = self.args.disk if self.args.debug_kext:
if self.args.validate: print("- Set kext DEBUG configuration")
validation.validate(settings) settings.kext_debug = True
if self.args.verbose: if self.args.hide_picker:
print("- Set verbose configuration") print("- Set HidePicker configuration")
settings.verbose_debug = True settings.showpicker = False
else: if self.args.disable_sip:
settings.verbose_debug = False # Override Defaults detected print("- Set Disable SIP configuration")
if self.args.debug_oc: settings.sip_status = False
print("- Set OpenCore DEBUG configuration") else:
settings.opencore_debug = True settings.sip_status = True # Override Defaults detected
settings.opencore_build = "DEBUG" if self.args.disable_smb:
if self.args.debug_kext: print("- Set Disable SecureBootModel configuration")
print("- Set kext DEBUG configuration") settings.secure_status = False
settings.kext_debug = True else:
if self.args.hide_picker: settings.secure_status = True # Override Defaults detected
print("- Set HidePicker configuration") if self.args.vault:
settings.showpicker = False print("- Set Vault configuration")
if self.args.disable_sip: settings.vault = True
print("- Set Disable SIP configuration") if self.args.firewire:
settings.sip_status = False print("- Set FireWire Boot configuration")
else: settings.firewire_boot = True
settings.sip_status = True # Override Defaults detected if self.args.nvme:
if self.args.disable_smb: print("- Set NVMe Boot configuration")
print("- Set Disable SecureBootModel configuration") settings.nvme_boot = True
settings.secure_status = False # if self.args.disable_amfi:
else: # print("- Set Disable AMFI configuration")
settings.secure_status = True # Override Defaults detected # settings.amfi_status = False
if self.args.vault: if self.args.wlan:
print("- Set Vault configuration") print("- Set Wake on WLAN configuration")
settings.vault = True settings.enable_wake_on_wlan = True
if self.args.firewire: if self.args.disable_tb:
print("- Set FireWire Boot configuration") print("- Set Disable Thunderbolt configuration")
settings.firewire_boot = True settings.disable_tb = True
if self.args.nvme: if self.args.force_surplus:
print("- Set NVMe Boot configuration") print("- Forcing SurPlus override configuration")
settings.nvme_boot = True settings.force_surplus = True
# if self.args.disable_amfi: if self.args.moderate_smbios:
# print("- Set Disable AMFI configuration") print("- Set Moderate SMBIOS Patching configuration")
# settings.amfi_status = False
if self.args.wlan:
print("- Set Wake on WLAN configuration")
settings.enable_wake_on_wlan = True
if self.args.disable_tb:
print("- Set Disable Thunderbolt configuration")
settings.disable_tb = True
if self.args.force_surplus:
print("- Forcing SurPlus override configuration")
settings.force_surplus = True
if self.args.moderate_smbios:
print("- Set Moderate SMBIOS Patching configuration")
settings.serial_settings = "Moderate"
if self.args.smbios_spoof:
if self.args.smbios_spoof == "Minimal":
settings.serial_settings = "Minimal"
elif self.args.smbios_spoof == "Moderate":
settings.serial_settings = "Moderate" settings.serial_settings = "Moderate"
elif self.args.smbios_spoof == "Advanced": if self.args.smbios_spoof:
settings.serial_settings = "Advanced" if self.args.smbios_spoof == "Minimal":
else: settings.serial_settings = "Minimal"
print(f"- Unknown SMBIOS arg passed: {self.args.smbios_spoof}") elif self.args.smbios_spoof == "Moderate":
settings.serial_settings = "Moderate"
elif self.args.smbios_spoof == "Advanced":
settings.serial_settings = "Advanced"
else:
print(f"- Unknown SMBIOS arg passed: {self.args.smbios_spoof}")
if self.args.support_all: if self.args.support_all:
print("- Building for natively supported model") print("- Building for natively supported model")
settings.allow_oc_everywhere = True settings.allow_oc_everywhere = True
settings.serial_settings = "None" settings.serial_settings = "None"
# 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: