Implement SkyLightShims List.txt generation

This commit is contained in:
Mykola Grymalyuk
2021-12-12 20:50:07 -07:00
parent 2b6d318cfd
commit e0284bffe6
5 changed files with 75 additions and 14 deletions
+2 -1
View File
@@ -19,4 +19,5 @@ __pycache__/
/docs/.vuepress/.config.js.swp
/docs/yarn.lock
/docs/yarn-error.log
/docs/node_modules/
/docs/node_modules/
/payloads/List.txt
+1 -1
View File
@@ -11,7 +11,7 @@
- OpenCore 0.7.5 - release
- BrcmPatchRAM 2.6.1 - release
- WhateverGreen 1.5.5 - release
- PatcherSupportPkg 0.2.7 - release
- PatcherSupportPkg 0.2.8 - release
- FeatureUnlock 1.0.5 - rolling (9cf1e81)
- Fix AirPlay to Mac on macOS 12.1
- Add macOS InstallAssistant downloader to TUI
+14
View File
@@ -0,0 +1,14 @@
# Data for SkyLightShim Plugin systems
class shim_list:
shim_pathing = {
"CoreWLAN.dylib": "/Systen/Library/CoreServices/WiFiAgent.app/Contents/MacOS/WiFiAgent",
"BacklightFixup.dylib": "/System/Library/CoreServices/loginwindow.app/Contents/Mac0S/loginwindow",
}
shim_legacy_accel = [
"CoreWLAN.dylib",
]
shim_legacy_accel_keyboard = [
"BacklightFixup.dylib",
]
+7 -3
View File
@@ -15,7 +15,7 @@ class Constants:
def __init__(self):
# Patcher Versioning
self.patcher_version = "0.3.2" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version = "0.2.7" # PatcherSupportPkg
self.patcher_support_pkg_version = "0.2.8" # PatcherSupportPkg
self.url_patcher_support_pkg = "https://github.com/dortania/PatcherSupportPkg/releases/download/"
self.nightly_url_patcher_support_pkg = "https://nightly.link/dortania/PatcherSupportPkg/workflows/build/master/"
@@ -218,6 +218,10 @@ class Constants:
@property
def diags_launcher_path(self):
return self.payload_path / Path("Drivers/diags.efi")
@property
def list_txt_path(self):
return self.payload_path / Path("List.txt")
# Kexts
@property
@@ -651,8 +655,8 @@ class Constants:
return self.payload_apple_etc_path / Path("Legacy-Wifi")
@property
def legacy_keyboard_backlight_lauchd(self):
return self.payload_apple_lauchd_path / Path("Keyboard-Backlight")
def legacy_keyboard_backlight_etc(self):
return self.payload_apple_etc_path / Path("Keyboard-Backlight")
sbm_values = [
"j137ap", # iMacPro1,1
+51 -9
View File
@@ -13,7 +13,7 @@ from pathlib import Path
import sys
from resources import constants, device_probe, utilities, generate_smbios
from data import sip_data, sys_patch_data, model_array, os_data, smbios_data, cpu_data
from data import sip_data, sys_patch_data, model_array, os_data, smbios_data, cpu_data, dylib_data
class PatchSysVolume:
@@ -215,8 +215,26 @@ class PatchSysVolume:
self.manual_root_patch_revert()
def rebuild_snapshot(self):
# if self.constants.gui_mode is False:
# input("Press [ENTER] to continue with cache rebuild: ")
# Grab List.txt if appropriate
dylib_list = self.build_skylight_plugin_list()
if dylib_list is not None:
print("- Updating SkyLightPlugins List.txt")
if (Path(self.mount_private_etc) / Path("SkyLightPlugins/List.txt")).exists():
print("- Removing existing List.txt")
utilities.process_status(
utilities.elevated(
["rm", "-f", f"{self.mount_private_etc}/SkyLightPlugins/List.txt"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
)
utilities.process_status(
utilities.elevated(
["cp", dylib_list, f"{self.mount_private_etc}/SkyLightPlugins/"],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
)
print("- Rebuilding Kernel Cache (This may take some time)")
if self.constants.detected_os > os_data.os_data.catalina:
result = utilities.elevated(["kmutil", "install", "--volume-root", self.mount_location, "--update-all"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
@@ -299,6 +317,34 @@ set million colour before rebooting"""
utilities.process_status(utilities.elevated(["chmod", "-Rf", "755", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
utilities.process_status(utilities.elevated(["chown", "-Rf", "root:wheel", f"{self.mount_extensions}/{add_current_kext}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
def build_skylight_plugin_list(self):
# ASentientBot's Skylight system support injecting additional dylibs into macOS
# To do so, it parses the List.txt file in '/private/etc/SkyLightPlugins/'
# The format of this file is:
# <plugin path> : <plugin name>
# Parse all dylibs in /private/etc/SkyLightPlugins/, generate an appropriate List.txt
skylight_plugins = []
if self.constants.list_txt_path.exists():
self.constants.list_txt_path.unlink()
if (Path(self.mount_private_etc) / Path("SkyLightPlugins")).exists():
for file in (Path(self.mount_private_etc) / Path("SkyLightPlugins")).glob("*.dylib"):
skylight_plugins.append(file.name)
if len(skylight_plugins) > 0:
with open(self.constants.list_txt_path, "w") as f:
for plugin in skylight_plugins:
try:
path = dylib_data.shim_list.shim_pathing[plugin]
print(f"- Adding {plugin} to list.txt")
f.write(f"{path} : {plugin}\n")
except KeyError:
print(f"- Skipping {plugin}, unknown pathing")
continue
return self.constants.list_txt_path
return None
def add_brightness_patch(self):
self.delete_old_binaries(sys_patch_data.DeleteBrightness)
self.add_new_binaries(sys_patch_data.AddBrightness, self.constants.legacy_brightness)
@@ -337,12 +383,8 @@ set million colour before rebooting"""
)
def add_legacy_keyboard_backlight_patch(self):
print("- Adding Backlight-Fixup.plist")
utilities.process_status(
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_keyboard_backlight_lauchd}/", self.mount_lauchd], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
)
utilities.process_status(utilities.elevated(["chmod", "755", f"{self.mount_lauchd}/Backlight-Fixup.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
utilities.process_status(utilities.elevated(["chown", "root:wheel", f"{self.mount_lauchd}/Backlight-Fixup.plist"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT))
print("- Merging Backlight private/etc")
utilities.elevated(["rsync", "-r", "-i", "-a", f"{self.constants.legacy_keyboard_backlight_etc}/", self.mount_private_etc], stdout=subprocess.PIPE)
def gpu_accel_legacy(self):
if self.constants.detected_os == os_data.os_data.mojave: