sys_patch.py: Avoid prompts if kext has already been accepted

This commit is contained in:
Mykola Grymalyuk
2022-08-27 12:57:45 -06:00
parent b105a73a10
commit 237b086e17
2 changed files with 21 additions and 1 deletions
+3 -1
View File
@@ -49,7 +49,9 @@ class OpenCoreLegacyPatcher:
# Now that we have commit info, update nightly link
if self.constants.commit_info[0] != "Running from source":
self.constants.installer_pkg_url_nightly = self.constants.installer_pkg_url_nightly.replace("main", self.constants.commit_info[0])
branch = self.constants.commit_info[0]
branch = branch.replace("refs/heads/", "")
self.constants.installer_pkg_url_nightly = self.constants.installer_pkg_url_nightly.replace("main", branch)
defaults.generate_defaults.probe(self.computer.real_model, True, self.constants)
+18
View File
@@ -327,6 +327,24 @@ class PatchSysVolume:
plist_data["OSBundleRequired"] = "Auxiliary"
plistlib.dump(plist_data, plist_path.open("wb"))
# Verify whether the user needs to authenticate in System Preferences
# Specifically under 'private/var/db/KernelManagement/AuxKC/CurrentAuxKC/com.apple.kcgen.instructions.plist'
# ["kextsToBuild"][i]:
# ["bundlePathMainOS"] = /Library/Extensions/Test.kext
# ["cdHash"] = Bundle's CDHash (random on ad-hoc signed, static on dev signed)
# ["teamID"] = Team ID (blank on ad-hoc signed)
# To grab the CDHash of a kext, run 'codesign -dvvv <kext_path>'
try:
aux_cache_path = Path(self.mount_location_data) / Path("private/var/db/KernelManagement/AuxKC/CurrentAuxKC/com.apple.kcgen.instructions.plist")
if Path(aux_cache_path).exists():
aux_cache_data = plistlib.load((aux_cache_path).open("rb"))
for kext in aux_cache_data["kextsToBuild"]:
if "bundlePathMainOS" in kext:
if kext["bundlePathMainOS"] == f"/Library/Extensions/{install_file}":
return updated_install_location
except PermissionError:
pass
self.constants.needs_to_open_preferences = True
return updated_install_location