mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 22:20:53 +10:00
sys_patch.py: Add handling for System Preferences prompt
This commit is contained in:
+21
-1
@@ -1173,7 +1173,27 @@ class wx_python_gui:
|
|||||||
sys.stderr = self.stock_stderr
|
sys.stderr = self.stock_stderr
|
||||||
if self.constants.root_patcher_succeded is True:
|
if self.constants.root_patcher_succeded is True:
|
||||||
print("- Root Patcher finished successfully")
|
print("- Root Patcher finished successfully")
|
||||||
self.reboot_system(message="Root Patcher finished successfully\nWould you like to reboot now?")
|
if self.constants.needs_to_open_preferences is True:
|
||||||
|
# Create dialog box to open System Preferences -> Security and Privacy
|
||||||
|
self.popup = wx.MessageDialog(
|
||||||
|
self.frame_modal,
|
||||||
|
"We just finished installing the patches to your Root Volume!\n\nHowever, Apple requires users to manually approve the kernel extensions installed before they can be used next reboot.\n\nWould you like to open System Preferences?",
|
||||||
|
"Open System Preferences?",
|
||||||
|
wx.YES_NO | wx.ICON_INFORMATION
|
||||||
|
)
|
||||||
|
self.popup.SetYesNoLabels("Open System Preferences", "Ignore")
|
||||||
|
answer = self.popup.ShowModal()
|
||||||
|
if answer == wx.ID_YES:
|
||||||
|
subprocess.Popen(
|
||||||
|
[
|
||||||
|
"osascript", "-e",
|
||||||
|
'tell app "System Preferences" to reveal anchor "General" of pane id "com.apple.preference.security"'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
time.sleep(5)
|
||||||
|
self.OnCloseFrame(None)
|
||||||
|
else:
|
||||||
|
self.reboot_system(message="Root Patcher finished successfully\nWould you like to reboot now?")
|
||||||
self.return_to_main_menu.Enable()
|
self.return_to_main_menu.Enable()
|
||||||
|
|
||||||
wx.GetApp().Yield()
|
wx.GetApp().Yield()
|
||||||
|
|||||||
@@ -190,6 +190,7 @@ class Constants:
|
|||||||
self.booted_oc_disk = None # Determine current disk OCLP booted from
|
self.booted_oc_disk = None # Determine current disk OCLP booted from
|
||||||
self.start_build_install = False # Determine if build install should be started
|
self.start_build_install = False # Determine if build install should be started
|
||||||
self.host_is_non_metal = False # Determine if host is non-metal (ie. enable UI hacks)
|
self.host_is_non_metal = False # Determine if host is non-metal (ie. enable UI hacks)
|
||||||
|
self.needs_to_open_preferences = False # Determine if preferences need to be opened
|
||||||
|
|
||||||
self.legacy_accel_support = [
|
self.legacy_accel_support = [
|
||||||
os_data.os_data.big_sur,
|
os_data.os_data.big_sur,
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class PatchSysVolume:
|
|||||||
self.root_mount_path = None
|
self.root_mount_path = None
|
||||||
self.root_supports_snapshot = utilities.check_if_root_is_apfs_snapshot()
|
self.root_supports_snapshot = utilities.check_if_root_is_apfs_snapshot()
|
||||||
self.constants.root_patcher_succeded = False # Reset Variable each time we start
|
self.constants.root_patcher_succeded = False # Reset Variable each time we start
|
||||||
|
self.constants.needs_to_open_preferences = False
|
||||||
self.patch_set_dictionary = {}
|
self.patch_set_dictionary = {}
|
||||||
self.needs_kmutil_exemptions = False # For '/Library/Extensions' rebuilds
|
self.needs_kmutil_exemptions = False # For '/Library/Extensions' rebuilds
|
||||||
|
|
||||||
@@ -120,9 +121,10 @@ class PatchSysVolume:
|
|||||||
if self.needs_kmutil_exemptions is True:
|
if self.needs_kmutil_exemptions is True:
|
||||||
# When installing to '/Library/Extensions', following args skip kext consent
|
# When installing to '/Library/Extensions', following args skip kext consent
|
||||||
# prompt in System Preferences when SIP's disabled
|
# prompt in System Preferences when SIP's disabled
|
||||||
print("- Disabling auth checks in kmutil")
|
print(" (You will get a prompt by System Preferences, ignore for now)")
|
||||||
args.append("--no-authentication")
|
args.append("--no-authentication")
|
||||||
args.append("--no-authorization")
|
args.append("--no-authorization")
|
||||||
|
self.constants.needs_to_open_preferences = True # Notify in GUI to open System Preferences
|
||||||
else:
|
else:
|
||||||
args = ["kextcache", "-i", f"{self.mount_location}/"]
|
args = ["kextcache", "-i", f"{self.mount_location}/"]
|
||||||
|
|
||||||
@@ -163,6 +165,8 @@ class PatchSysVolume:
|
|||||||
self.unmount_drive()
|
self.unmount_drive()
|
||||||
print("- Patching complete")
|
print("- Patching complete")
|
||||||
print("\nPlease reboot the machine for patches to take effect")
|
print("\nPlease reboot the machine for patches to take effect")
|
||||||
|
if self.needs_kmutil_exemptions is True:
|
||||||
|
print("Note: Apple will require you to open System Preferences -> Security to\nallow the new kernel extensions to be loaded")
|
||||||
self.constants.root_patcher_succeded = True
|
self.constants.root_patcher_succeded = True
|
||||||
if self.constants.gui_mode is False:
|
if self.constants.gui_mode is False:
|
||||||
input("\nPress [ENTER] to continue")
|
input("\nPress [ENTER] to continue")
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ class detect_root_patch:
|
|||||||
# First check boot-args, then dedicated nvram variable
|
# First check boot-args, then dedicated nvram variable
|
||||||
nv_on = utilities.get_nvram("boot-args")
|
nv_on = utilities.get_nvram("boot-args")
|
||||||
if nv_on:
|
if nv_on:
|
||||||
if "nvda_drv_vrl" in nv_on:
|
if "nvda_drv_vrl=" in nv_on:
|
||||||
return True
|
return True
|
||||||
nv_on = utilities.get_nvram("nvda_drv")
|
nv_on = utilities.get_nvram("nvda_drv")
|
||||||
if nv_on:
|
if nv_on:
|
||||||
@@ -146,11 +146,11 @@ class detect_root_patch:
|
|||||||
# First check boot-args, then whether property exists on GPU
|
# First check boot-args, then whether property exists on GPU
|
||||||
nv_on = utilities.get_nvram("boot-args")
|
nv_on = utilities.get_nvram("boot-args")
|
||||||
if nv_on:
|
if nv_on:
|
||||||
if "ngfxgl" in nv_on:
|
if "ngfxgl=" in nv_on:
|
||||||
return True
|
return True
|
||||||
for gpu in self.constants.computer.gpus:
|
for gpu in self.constants.computer.gpus:
|
||||||
if isinstance(gpu, device_probe.NVIDIA):
|
if isinstance(gpu, device_probe.NVIDIA):
|
||||||
if gpu.disable_metal:
|
if gpu.disable_metal is True:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -158,11 +158,11 @@ class detect_root_patch:
|
|||||||
# Check for 'nv_web' in boot-args, then whether property exists on GPU
|
# Check for 'nv_web' in boot-args, then whether property exists on GPU
|
||||||
nv_on = utilities.get_nvram("boot-args")
|
nv_on = utilities.get_nvram("boot-args")
|
||||||
if nv_on:
|
if nv_on:
|
||||||
if "ngfxcompat" in nv_on:
|
if "ngfxcompat=" in nv_on:
|
||||||
return True
|
return True
|
||||||
for gpu in self.constants.computer.gpus:
|
for gpu in self.constants.computer.gpus:
|
||||||
if isinstance(gpu, device_probe.NVIDIA):
|
if isinstance(gpu, device_probe.NVIDIA):
|
||||||
if gpu.force_compatible:
|
if gpu.force_compatible is True:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user