mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-24 20:10:14 +10:00
sys_patch.py: Move AuxKC auth check to dedicated function
This commit is contained in:
@@ -206,7 +206,6 @@ class PatchSysVolume:
|
|||||||
print(" (You will get a prompt by System Preferences, ignore for now)")
|
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}/"]
|
||||||
|
|
||||||
@@ -354,6 +353,11 @@ class PatchSysVolume:
|
|||||||
plist_data["OSBundleRequired"] = "Auxiliary"
|
plist_data["OSBundleRequired"] = "Auxiliary"
|
||||||
plistlib.dump(plist_data, plist_path.open("wb"))
|
plistlib.dump(plist_data, plist_path.open("wb"))
|
||||||
|
|
||||||
|
self.check_kexts_needs_authentication(install_file)
|
||||||
|
|
||||||
|
return updated_install_location
|
||||||
|
|
||||||
|
def check_kexts_needs_authentication(self, kext_name):
|
||||||
# Verify whether the user needs to authenticate in System Preferences
|
# Verify whether the user needs to authenticate in System Preferences
|
||||||
# Specifically under 'private/var/db/KernelManagement/AuxKC/CurrentAuxKC/com.apple.kcgen.instructions.plist'
|
# Specifically under 'private/var/db/KernelManagement/AuxKC/CurrentAuxKC/com.apple.kcgen.instructions.plist'
|
||||||
# ["kextsToBuild"][i]:
|
# ["kextsToBuild"][i]:
|
||||||
@@ -363,19 +367,17 @@ class PatchSysVolume:
|
|||||||
# To grab the CDHash of a kext, run 'codesign -dvvv <kext_path>'
|
# To grab the CDHash of a kext, run 'codesign -dvvv <kext_path>'
|
||||||
try:
|
try:
|
||||||
aux_cache_path = Path(self.mount_location_data) / Path("/private/var/db/KernelExtensionManagement/AuxKC/CurrentAuxKC/com.apple.kcgen.instructions.plist")
|
aux_cache_path = Path(self.mount_location_data) / Path("/private/var/db/KernelExtensionManagement/AuxKC/CurrentAuxKC/com.apple.kcgen.instructions.plist")
|
||||||
if aux_cache_path.exists():
|
if not aux_cache_path.exists():
|
||||||
|
return
|
||||||
aux_cache_data = plistlib.load((aux_cache_path).open("rb"))
|
aux_cache_data = plistlib.load((aux_cache_path).open("rb"))
|
||||||
for kext in aux_cache_data["kextsToBuild"]:
|
for kext in aux_cache_data["kextsToBuild"]:
|
||||||
if "bundlePathMainOS" in aux_cache_data["kextsToBuild"][kext]:
|
if "bundlePathMainOS" in aux_cache_data["kextsToBuild"][kext]:
|
||||||
if aux_cache_data["kextsToBuild"][kext]["bundlePathMainOS"] == f"/Library/Extensions/{install_file}":
|
if aux_cache_data["kextsToBuild"][kext]["bundlePathMainOS"] == f"/Library/Extensions/{kext_name}":
|
||||||
return updated_install_location
|
self.constants.needs_to_open_preferences = True # Notify in GUI to open System Preferences
|
||||||
|
return
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.constants.needs_to_open_preferences = True
|
|
||||||
|
|
||||||
return updated_install_location
|
|
||||||
|
|
||||||
def patch_root_vol(self):
|
def patch_root_vol(self):
|
||||||
print(f"- Running patches for {self.model}")
|
print(f"- Running patches for {self.model}")
|
||||||
if self.patch_set_dictionary != {}:
|
if self.patch_set_dictionary != {}:
|
||||||
@@ -412,6 +414,7 @@ class PatchSysVolume:
|
|||||||
else:
|
else:
|
||||||
if install_patch_directory == "/Library/Extensions":
|
if install_patch_directory == "/Library/Extensions":
|
||||||
self.needs_kmutil_exemptions = True
|
self.needs_kmutil_exemptions = True
|
||||||
|
self.check_kexts_needs_authentication(install_file)
|
||||||
destination_folder_path = str(self.mount_location_data) + install_patch_directory
|
destination_folder_path = str(self.mount_location_data) + install_patch_directory
|
||||||
|
|
||||||
updated_destination_folder_path = self.add_auxkc_support(install_file, source_folder_path, install_patch_directory, destination_folder_path)
|
updated_destination_folder_path = self.add_auxkc_support(install_file, source_folder_path, install_patch_directory, destination_folder_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user