sys_patch.py: Add auth exemption for /L*/Extensions

This commit is contained in:
Mykola Grymalyuk
2022-05-20 15:59:23 -06:00
parent 88374c1b96
commit 88427d2c5d
4 changed files with 59 additions and 20 deletions

View File

@@ -30,6 +30,16 @@ cd ./OpenCore-Legacy-Patcher
pip3 install -r requirements.txt
```
If you have installation error, see following troubleshooting options:
* Use Python 3.9
* Currently our build server uses py3.9 for generating binaries used in releases
* Use .whl snapshots for installing additional dependancies
* [wxPython 4.1.1 wheel for py3.9](https://files.pythonhosted.org/packages/2c/a8/7027e8ca3ba20dc2ed2acd556e31941cb44097ab87d6f81d646a79de4eab/wxPython-4.1.1-cp39-cp39-macosx_10_10_x86_64.whl)
* [PyObjc 8.5 wheel for py3](https://files.pythonhosted.org/packages/69/3d/786f379dd669a078cf0c4a686e242c9b643071c23367bfbd3d9a7eb589ec/pyobjc-8.5-py3-none-any.whl)
* [Requests 2.27.1 for py2/py3](https://files.pythonhosted.org/packages/2d/61/08076519c80041bc0ffa1a8af0cbd3bf3e2b62af10435d269a9d0f40564d/requests-2.27.1-py2.py3-none-any.whl)
## Running OpenCore Legacy Patcher
To run the project from source, simply invoke via python3:

View File

@@ -257,23 +257,34 @@ def SystemPatchDictionary(os_major, os_minor, non_metal_os_support):
},
"Install": {
"/System/Library/Extensions": {
"NVDAStartupWeb.kext": "10.13.6",
"GeForceTeslaWeb.kext": "10.13.6",
"GeForceWeb.kext": "10.13.6",
"NVDAGF100HalWeb.kext": "10.13.6",
"NVDAGK100HalWeb.kext": "10.13.6",
"NVDAGM100HalWeb.kext": "10.13.6",
"NVDAGP100HalWeb.kext": "10.13.6",
"NVDANV50HalTeslaWeb.kext": "10.13.6",
"NVDAResmanTeslaWeb.kext": "10.13.6",
"NVDAResmanWeb.kext": "10.13.6",
"GeForceVADriverWeb.bundle": "10.13.6",
"GeForceAIRPluginWeb.bundle": "10.13.6",
"GeForceGLDriverWeb.bundle": "10.13.6",
"GeForceMTLDriverWeb.bundle": "10.13.6",
"GeForceTeslaGAWeb.bundle": "10.13.6",
"GeForceTeslaGLDriverWeb.bundle": "10.13.6",
"GeForceTeslaVADriverWeb.bundle": "10.13.6",
"GeForceAIRPluginWeb.bundle": "WebDriver-387.10.10.10.40.140",
"GeForceGLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140",
"GeForceMTLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140",
"GeForceVADriverWeb.bundle": "WebDriver-387.10.10.10.40.140",
# Tesla-only files
"GeForceTeslaGAWeb.bundle": "WebDriver-387.10.10.10.40.140",
"GeForceTeslaGLDriverWeb.bundle": "WebDriver-387.10.10.10.40.140",
"GeForceTeslaVADriverWeb.bundle": "WebDriver-387.10.10.10.40.140",
},
},
"Install Non-Root": {
"/Library/Extensions": {
"GeForceWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDAGF100HalWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDAGK100HalWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDAGM100HalWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDAGP100HalWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDAResmanWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDAStartupWeb.kext": "WebDriver-387.10.10.10.40.140",
# Tesla-only files
"GeForceTeslaWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDANV50HalTeslaWeb.kext": "WebDriver-387.10.10.10.40.140",
"NVDAResmanTeslaWeb.kext": "WebDriver-387.10.10.10.40.140",
},
"/Library/PreferencePanes": {
"NVIDIA Driver Manager.prefPane": "WebDriver-387.10.10.10.40.140",
},
},
},

View File

@@ -21,6 +21,9 @@
# - Generally within 2~ boots, the original snapshot is discarded
# - Monterey always preserves the original snapshot allowing for reliable rollbacks
# Alternative to mounting via 'mount', Apple's update system uses 'mount_apfs' directly
# '/sbin/mount_apfs -R /dev/disk5s5 /System/Volumes/Update/mnt1'
import shutil
import subprocess
@@ -39,6 +42,7 @@ class PatchSysVolume:
self.root_supports_snapshot = utilities.check_if_root_is_apfs_snapshot()
self.constants.root_patcher_succeded = False # Reset Variable each time we start
self.patch_set_dictionary = {}
self.needs_kmutil_exemptions = False # For '/Library/Extensions' rebuilds
# GUI will detect hardware patches before starting PatchSysVolume()
# However the TUI will not, so allow for data to be passed in manually avoiding multiple calls
@@ -109,7 +113,17 @@ class PatchSysVolume:
def rebuild_snapshot(self):
print("- Rebuilding Kernel Cache (This may take some time)")
result = utilities.elevated(["kmutil", "install", "--volume-root", self.mount_location, "--update-all"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
args = ["kmutil", "install", "--volume-root", self.mount_location, "--update-all"]
if self.needs_kmutil_exemptions is True:
# When installing to '/Library/Extensions', following args skip kext consent
# prompt in System Preferences when SIP's disabled
print("- Disabling auth checks in kmutil")
args.append("--no-authentication")
args.append("--no-authorization")
result = utilities.elevated(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# kextcache notes:
# - kextcache always returns 0, even if it fails
@@ -206,6 +220,8 @@ class PatchSysVolume:
if method_install == "Install":
destination_folder_path = str(self.mount_location) + install_patch_directory
else:
if install_patch_directory == "/Library/Extensions":
self.needs_kmutil_exemptions = True
destination_folder_path = str(self.mount_location_data) + install_patch_directory
self.install_new_file(source_folder_path, destination_folder_path, install_file)

View File

@@ -242,6 +242,10 @@ class detect_root_patch:
if hardware_details["Graphics: Nvidia Tesla"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Nvidia Tesla": all_hardware_patchset["Graphics"]["Nvidia Tesla"]})
if hardware_details["Graphics: Nvidia Web Drivers"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Non-Metal IOAccelerator Common": all_hardware_patchset["Graphics"]["Non-Metal IOAccelerator Common"]})
required_patches.update({"Nvidia Web Drivers": all_hardware_patchset["Graphics"]["Nvidia Web Drivers"]})
if hardware_details["Graphics: Nvidia Kepler"] is True:
required_patches.update({"Metal Common": all_hardware_patchset["Graphics"]["Metal Common"]})
required_patches.update({"Nvidia Kepler": all_hardware_patchset["Graphics"]["Nvidia Kepler"]})
@@ -249,8 +253,6 @@ class detect_root_patch:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"AMD TeraScale Common": all_hardware_patchset["Graphics"]["AMD TeraScale Common"]})
required_patches.update({"AMD TeraScale 1": all_hardware_patchset["Graphics"]["AMD TeraScale 1"]})
if hardware_details["Graphics: Nvidia Web Drivers"] is True:
required_patches.update({"Nvidia Web Drivers": all_hardware_patchset["Graphics"]["Nvidia Web Drivers"]})
if hardware_details["Graphics: AMD TeraScale 2"] is True:
required_patches.update({"Non-Metal Common": all_hardware_patchset["Graphics"]["Non-Metal Common"]})
required_patches.update({"Non-Metal IOAccelerator Common": all_hardware_patchset["Graphics"]["Non-Metal IOAccelerator Common"]})