Add AMFIPass (#1051)

This commit is contained in:
Dhinak G
2023-07-26 08:29:46 -04:00
committed by GitHub
parent aa1739c1d6
commit 43be00e9e7
17 changed files with 247 additions and 138 deletions

View File

@@ -67,7 +67,6 @@ class PatchSysVolume:
self.skip_root_kmutil_requirement = self.hardware_details["Settings: Supports Auxiliary Cache"]
def _init_pathing(self, custom_root_mount_path: Path = None, custom_data_mount_path: Path = None) -> None:
"""
Initializes the pathing for root volume patching
@@ -493,7 +492,7 @@ class PatchSysVolume:
oclp_plist_data = plistlib.load(Path(oclp_path).open("rb"))
for key in oclp_plist_data:
if isinstance(oclp_plist_data[key], (bool, int)):
continue
continue
if "Install" not in oclp_plist_data[key]:
continue
for location in oclp_plist_data[key]["Install"]:

View File

@@ -47,8 +47,7 @@ class AutomaticSysPatch:
dict = updates.CheckBinaryUpdates(self.constants).check_binary_updates()
if dict:
for key in dict:
version = dict[key]["Version"]
version = dict["Version"]
logging.info(f"- Found new version: {version}")
app = wx.App()
@@ -64,7 +63,7 @@ class AutomaticSysPatch:
if response == wx.ID_YES:
gui_entry.EntryPoint(self.constants).start(entry=gui_entry.SupportedEntryPoints.UPDATE_APP)
elif response == wx.ID_NO:
webbrowser.open(dict[key]["Github Link"])
webbrowser.open(dict["Github Link"])
return
if utilities.check_seal() is True:
@@ -149,17 +148,21 @@ class AutomaticSysPatch:
logging.info("- Versions match")
return True
if self.constants.special_build is True:
# Version doesn't match and we're on a special build
# Special builds don't have good ways to compare versions
logging.info("- Special build detected, assuming installed is older")
return False
# Check if installed version is newer than booted version
if updates.CheckBinaryUpdates(self.constants)._check_if_build_newer(
self.constants.computer.oclp_version.split("."), self.constants.patcher_version.split(".")
) is True:
if updates.CheckBinaryUpdates(self.constants).check_if_newer(self.constants.computer.oclp_version):
logging.info("- Installed version is newer than booted version")
return True
args = [
"osascript",
"-e",
f"""display dialog "OpenCore Legacy Patcher has detected that you are booting an outdated OpenCore build\n- Booted: {self.constants.computer.oclp_version}\n- Installed: {self.constants.patcher_version}\n\nWould you like to update the OpenCore bootloader?" """
f"""display dialog "OpenCore Legacy Patcher has detected that you are booting {'a different' if self.constants.special_build else 'an outdated'} OpenCore build\n- Booted: {self.constants.computer.oclp_version}\n- Installed: {self.constants.patcher_version}\n\nWould you like to update the OpenCore bootloader?" """
f'with icon POSIX file "{self.constants.app_icon_path}"',
]
output = subprocess.run(

View File

@@ -3,26 +3,16 @@
# Used when supplying data to sys_patch.py
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
import plistlib
import logging
import py_sip_xnu
import plistlib
from pathlib import Path
from resources import (
constants,
device_probe,
utilities,
amfi_detect,
network_handler,
kdk_handler
)
from data import (
model_array,
os_data,
sip_data,
smbios_data,
cpu_data
)
import packaging.version
import py_sip_xnu
from data import cpu_data, model_array, os_data, sip_data, smbios_data
from resources import (amfi_detect, constants, device_probe, kdk_handler,
network_handler, utilities)
class DetectRootPatch:
@@ -418,7 +408,7 @@ class DetectRootPatch:
bool: True if loaded, False otherwise
"""
return utilities.check_kext_loaded("WhateverGreen", self.constants.detected_os)
return utilities.check_kext_loaded("as.vit9696.WhateverGreen")
def _check_kdk(self):
@@ -521,7 +511,7 @@ class DetectRootPatch:
if self.constants.detected_os > os_data.os_data.catalina:
self.brightness_legacy = True
if self.model in ["iMac7,1", "iMac8,1"] or (self.model in model_array.LegacyAudio and utilities.check_kext_loaded("AppleALC", self.constants.detected_os) is False):
if self.model in ["iMac7,1", "iMac8,1"] or (self.model in model_array.LegacyAudio and utilities.check_kext_loaded("as.vit9696.AppleALC") is False):
# Special hack for systems with botched GOPs
# TL;DR: No Boot Screen breaks Lilu, therefore breaking audio
if self.constants.detected_os > os_data.os_data.catalina:
@@ -610,6 +600,12 @@ class DetectRootPatch:
if self.constants.detected_os < os_data.os_data.big_sur:
return amfi_detect.AmfiConfigDetectLevel.NO_CHECK
amfipass_version = utilities.check_kext_loaded("com.dhinakg.AMFIPass")
if amfipass_version:
if packaging.version.parse(amfipass_version) >= packaging.version.parse(self.constants.amfipass_compatibility_version):
# If AMFIPass is loaded, our binaries will work
return amfi_detect.AmfiConfigDetectLevel.NO_CHECK
if self.constants.detected_os >= os_data.os_data.ventura:
if self.amfi_shim_bins is True:
# Currently we require AMFI outright disabled