Merge branch 'main' into sonoma-development

# Conflicts:
#	payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-DEBUG.zip
#	payloads/Kexts/Acidanthera/RestrictEvents-v1.1.2-RELEASE.zip
#	payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-DEBUG.zip
#	payloads/Kexts/Acidanthera/WhateverGreen-v1.6.5-Navi-RELEASE.zip
#	payloads/OpenCore/OpenCore-DEBUG.zip
#	payloads/OpenCore/OpenCore-RELEASE.zip
#	resources/constants.py
#	resources/wx_gui/gui_settings.py
This commit is contained in:
Mykola Grymalyuk
2023-08-18 10:36:42 -06:00
13 changed files with 108 additions and 12 deletions
+42 -8
View File
@@ -3,14 +3,15 @@
# Generate stand alone application for OpenCore-Patcher # Generate stand alone application for OpenCore-Patcher
# Copyright (C) 2022-2023 - Mykola Grymalyuk # Copyright (C) 2022-2023 - Mykola Grymalyuk
from pathlib import Path import os
import sys
import time import time
import argparse import argparse
import os
import subprocess
import plistlib import plistlib
import time import platform
import sys import subprocess
from pathlib import Path
from resources import constants from resources import constants
@@ -30,11 +31,13 @@ class CreateBinary:
def __init__(self): def __init__(self):
start = time.time() start = time.time()
print("Starting build script") self._set_cwd()
self._is_x86_64()
print("Starting build script")
self.args = self._parse_arguments() self.args = self._parse_arguments()
self._set_cwd() print(f"Current Working Directory:\n- {os.getcwd()}")
self._preflight_processes() self._preflight_processes()
self._build_binary() self._build_binary()
@@ -42,13 +45,44 @@ class CreateBinary:
print(f"Build script completed in {str(round(time.time() - start, 2))} seconds") print(f"Build script completed in {str(round(time.time() - start, 2))} seconds")
def _is_x86_64(self):
"""
Check if invoked as x86_64
Some of our dependancies are not universal, so we'll create a new virtual environment and invoke as Rosetta
"""
if platform.machine() != "arm64":
return
print("Detected ARM64, creating x86_64 environment")
args = sys.argv[:]
if "python" in args[0].lower():
args.pop(0)
if not Path(".x86_64_venv").exists():
print("Creating new venv")
subprocess.run(["arch", "-x86_64", sys.executable, "-m", "venv", ".x86_64_venv"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("Installing requirements")
subprocess.run(["arch", "-x86_64", ".x86_64_venv/bin/pip3", "install", "-r", "requirements.txt"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("Relaunching as x86_64")
result = subprocess.run(["arch", "-x86_64", ".x86_64_venv/bin/python3"] + args)
if result.returncode != 0:
if result.stdout:
print("STDOUT: " + result.stdout.decode("utf-8"))
if result.stderr:
print("STDERR: " + result.stderr.decode("utf-8"))
sys.exit(result.returncode)
def _set_cwd(self): def _set_cwd(self):
""" """
Initialize current working directory to parent of this script Initialize current working directory to parent of this script
""" """
os.chdir(Path(__file__).resolve().parent) os.chdir(Path(__file__).resolve().parent)
print(f"Current Working Directory:\n- {os.getcwd()}")
def _parse_arguments(self): def _parse_arguments(self):
+11
View File
@@ -1,6 +1,17 @@
# OpenCore Legacy Patcher changelog # OpenCore Legacy Patcher changelog
## 0.6.9 ## 0.6.9
- Resolve BCM2046 and BCM2070 support on macOS 13.3 and newer
- Increment Binaries:
- OpenCorePkg 0.9.3 - release
- Lilu 1.6.6 - release
- WhateverGreen 1.6.5 - release
- RestrictEvents 1.1.2 - release
- FeatureUnlock 1.1.5 - release
- DebugEnhancer 1.0.8 - release
- CPUFriend 1.2.7 - release
- BlueToolFixup 2.6.8 - rolling (2305aaa)
- CryptexFixup 1.0.2 - release
## 0.6.8 ## 0.6.8
- Update non-Metal Binaries: - Update non-Metal Binaries:
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -43,7 +43,7 @@ class Constants:
self.featureunlock_version: str = "1.1.5" # FeatureUnlock self.featureunlock_version: str = "1.1.5" # FeatureUnlock
self.debugenhancer_version: str = "1.0.8" # DebugEnhancer self.debugenhancer_version: str = "1.0.8" # DebugEnhancer
self.cpufriend_version: str = "1.2.7" # CPUFriend self.cpufriend_version: str = "1.2.7" # CPUFriend
self.bluetool_version: str = "2.6.7" # BlueToolFixup (BrcmPatchRAM) self.bluetool_version: str = "2.6.8" # BlueToolFixup (BrcmPatchRAM)
self.cslvfixup_version: str = "2.6.1" # CSLVFixup self.cslvfixup_version: str = "2.6.1" # CSLVFixup
self.autopkg_version: str = "1.0.3" # AutoPkgInstaller self.autopkg_version: str = "1.0.3" # AutoPkgInstaller
self.cryptexfixup_version: str = "1.0.2" # CryptexFixup self.cryptexfixup_version: str = "1.0.2" # CryptexFixup
+7 -3
View File
@@ -280,6 +280,8 @@ class PatchSysVolume:
if self.needs_kmutil_exemptions is True: if self.needs_kmutil_exemptions is True:
logging.info("Note: Apple will require you to open System Preferences -> Security to allow the new kernel extensions to be loaded") logging.info("Note: Apple will require you to open System Preferences -> Security to allow the new kernel extensions to be loaded")
self.constants.root_patcher_succeeded = True self.constants.root_patcher_succeeded = True
return True
return False
def _rebuild_kernel_collection(self) -> bool: def _rebuild_kernel_collection(self) -> bool:
@@ -418,9 +420,11 @@ class PatchSysVolume:
""" """
Unmount root volume Unmount root volume
""" """
if self.root_mount_path:
logging.info("- Unmounting Root Volume (Don't worry if this fails)") logging.info("- Unmounting Root Volume (Don't worry if this fails)")
utilities.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode() utilities.elevated(["diskutil", "unmount", self.root_mount_path], stdout=subprocess.PIPE).stdout.decode().strip().encode()
else:
logging.info("- Skipping Root Volume unmount")
def _rebuild_dyld_shared_cache(self) -> None: def _rebuild_dyld_shared_cache(self) -> None:
+47
View File
@@ -4,8 +4,10 @@ import pprint
import logging import logging
import py_sip_xnu import py_sip_xnu
import subprocess import subprocess
import os
from pathlib import Path from pathlib import Path
from resources.sys_patch.sys_patch import PatchSysVolume
from resources.wx_gui import ( from resources.wx_gui import (
gui_support, gui_support,
@@ -806,6 +808,9 @@ class SettingsFrame(wx.Frame):
}, },
}, },
"Developer": { "Developer": {
"Validation": {
"type": "title",
},
"Install latest nightly build 🧪": { "Install latest nightly build 🧪": {
"type": "button", "type": "button",
"function": self.on_nightly, "function": self.on_nightly,
@@ -831,6 +836,28 @@ class SettingsFrame(wx.Frame):
"Export constants.py values to a txt file.", "Export constants.py values to a txt file.",
], ],
}, },
"Developer Root Volume Patching": {
"type": "title",
},
"Mount Root Volume": {
"type": "button",
"function": self.on_mount_root_vol,
"description": [
"Life's too short to type 'sudo mount -o",
"nobrowse -t apfs /dev/diskXsY",
"/System/Volumes/Update/mnt1' every time.",
],
},
"wrap_around 2": {
"type": "wrap_around",
},
"Save Root Volume": {
"type": "button",
"function": self.on_bless_root_vol,
"description": [
"Rebuild kernel cache and bless snapshot 🙏",
],
},
}, },
} }
@@ -1267,3 +1294,23 @@ Hardware Information:
def on_test_exception(self, event: wx.Event) -> None: def on_test_exception(self, event: wx.Event) -> None:
raise Exception("Test Exception") raise Exception("Test Exception")
def on_mount_root_vol(self, event: wx.Event) -> None:
if os.geteuid() != 0:
wx.MessageDialog(self.parent, "Please relaunch as Root to mount the Root Volume", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
else:
#Don't need to pass model as we're bypassing all logic
if PatchSysVolume("",self.constants)._mount_root_vol() == True:
wx.MessageDialog(self.parent, "Root Volume Mounted, remember to fix permissions before saving the Root Volume", "Success", wx.OK | wx.ICON_INFORMATION).ShowModal()
else:
wx.MessageDialog(self.parent, "Root Volume Mount Failed, check terminal output", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
def on_bless_root_vol(self, event: wx.Event) -> None:
if os.geteuid() != 0:
wx.MessageDialog(self.parent, "Please relaunch as Root to save changes", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
else:
#Don't need to pass model as we're bypassing all logic
if PatchSysVolume("",self.constants)._rebuild_root_volume() == True:
wx.MessageDialog(self.parent, "Root Volume saved, please reboot to apply changes", "Success", wx.OK | wx.ICON_INFORMATION).ShowModal()
else:
wx.MessageDialog(self.parent, "Root Volume update Failed, check terminal output", "Error", wx.OK | wx.ICON_ERROR).ShowModal()