Skip to content

Commit

Permalink
sys_patch.py: Avoid prompts if kext has already been accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
khronokernel committed Aug 27, 2022
1 parent b105a73 commit 237b086
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion resources/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def generate_base_data(self):

# 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)

Expand Down
18 changes: 18 additions & 0 deletions resources/sys_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,24 @@ def add_auxkc_support(self, install_file, source_folder_path, install_patch_dire
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
Expand Down

0 comments on commit 237b086

Please sign in to comment.