mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 06:10:00 +10:00
Add AMFIPass (#1051)
This commit is contained in:
+36
-17
@@ -1,21 +1,20 @@
|
||||
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
|
||||
|
||||
import argparse
|
||||
import atexit
|
||||
import binascii
|
||||
import logging
|
||||
import math
|
||||
import os
|
||||
import plistlib
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
import os
|
||||
import binascii
|
||||
import argparse
|
||||
import atexit
|
||||
import shutil
|
||||
import py_sip_xnu
|
||||
|
||||
import logging
|
||||
|
||||
from data import os_data, sip_data
|
||||
from resources import constants, ioreg
|
||||
from data import sip_data, os_data
|
||||
|
||||
|
||||
def hexswap(input_hex: str):
|
||||
@@ -173,15 +172,35 @@ def enable_sleep_after_running():
|
||||
sleep_process = None
|
||||
|
||||
|
||||
def check_kext_loaded(kext_name, os_version):
|
||||
if os_version > os_data.os_data.catalina:
|
||||
kext_loaded = subprocess.run(["kmutil", "showloaded", "--list-only", "--variant-suffix", "release"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
else:
|
||||
kext_loaded = subprocess.run(["kextstat", "-l"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
if kext_name in kext_loaded.stdout.decode():
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
def check_kext_loaded(bundle_id: str) -> str:
|
||||
"""
|
||||
Checks if a kext is loaded
|
||||
|
||||
Parameters:
|
||||
bundle_id (str): The bundle ID of the kext to check
|
||||
|
||||
Returns:
|
||||
str: The version of the kext if it is loaded, or "" if it is not loaded
|
||||
"""
|
||||
# Name (Version) UUID <Linked Against>
|
||||
# no UUID for kextstat
|
||||
pattern = re.compile(re.escape(bundle_id) + r"\s+\((?P<version>.+)\)")
|
||||
|
||||
args = ["kextstat", "-l", "-b", bundle_id]
|
||||
|
||||
if Path("/usr/bin/kmutil").exists():
|
||||
args = ["kmutil", "showloaded", "--list-only", "--variant-suffix", "release", "--optional-identifier", bundle_id]
|
||||
|
||||
kext_loaded = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
if kext_loaded.returncode != 0:
|
||||
return ""
|
||||
output = kext_loaded.stdout.decode()
|
||||
if not output.strip():
|
||||
return ""
|
||||
match = pattern.search(output)
|
||||
if match:
|
||||
return match.group("version")
|
||||
return ""
|
||||
|
||||
|
||||
def check_oclp_boot():
|
||||
|
||||
Reference in New Issue
Block a user