From 237b086e17f29477a8c63593eaa69f70d0ad0e7b Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sat, 27 Aug 2022 12:57:45 -0600 Subject: [PATCH] sys_patch.py: Avoid prompts if kext has already been accepted --- resources/main.py | 4 +++- resources/sys_patch.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/resources/main.py b/resources/main.py index c22839115..7b140d060 100644 --- a/resources/main.py +++ b/resources/main.py @@ -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) diff --git a/resources/sys_patch.py b/resources/sys_patch.py index 5562d73e0..4138711d3 100644 --- a/resources/sys_patch.py +++ b/resources/sys_patch.py @@ -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 ' + 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