Restructure into package format

This commit is contained in:
Mykola Grymalyuk
2024-03-31 21:27:36 -06:00
parent d02d89b9c0
commit 463bed4e06
81 changed files with 881 additions and 464 deletions

View File

@@ -38,7 +38,7 @@ jobs:
# p12-password: ${{ secrets.MAC_NOTARIZATION_PASSWORD }}
- name: Codesign Binary
run: 'codesign -s "${{ env.MAC_CODESIGN_IDENTITY }}" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
run: 'codesign -s "${{ env.MAC_CODESIGN_IDENTITY }}" -v --force --deep --timestamp --entitlements ./ci_tooling/entitlements/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
- name: Package Binary
run: cd dist; ditto -c -k --sequesterRsrc --keepParent OpenCore-Patcher.app ../OpenCore-Patcher-wxPython.app.zip
@@ -47,7 +47,7 @@ jobs:
run: xcrun notarytool submit OpenCore-Patcher-wxPython.app.zip --apple-id "${{ env.MAC_NOTARIZATION_USERNAME }}" --password "${{ env.MAC_NOTARIZATION_PASSWORD }}" --team-id "${{ env.MAC_NOTARIZATION_TEAM_ID }}"
- name: Generate support package
run: /usr/local/bin/packagesbuild ./payloads/InstallPackage/AutoPkg-Assets-Setup.pkgproj
run: /usr/local/bin/packagesbuild ./ci_tooling/autopkg/AutoPkg-Assets-Setup.pkgproj
- name: Prepare App for Upload
run: mv ./OpenCore-Patcher-wxPython.app.zip ./OpenCore-Patcher-GUI.app.zip

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# Generate stand alone application for OpenCore-Patcher
# Copyright (C) 2022-2023 - Mykola Grymalyuk
"""
Build-Binary.command: Generate stand alone application for OpenCore-Patcher
"""
import os
import sys
@@ -12,7 +12,7 @@ import subprocess
from pathlib import Path
from resources import constants
from opencore_legacy_patcher import constants
class CreateBinary:
@@ -229,7 +229,6 @@ class CreateBinary:
"Config",
"Drivers",
"Icon",
"InstallPackage",
"Kexts",
"OpenCore",
"Tools",
@@ -237,10 +236,7 @@ class CreateBinary:
]
whitelist_files = [
"entitlements.plist",
"launcher.sh",
"OC-Patcher-TUI.icns",
"OC-Patcher.icns",
]

View File

@@ -1,6 +1,9 @@
#!/usr/bin/env python3
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
from resources import main
"""
PyInstaller Entry Point
"""
from opencore_legacy_patcher import main
if __name__ == '__main__':
main.OpenCoreLegacyPatcher()
main()

View File

@@ -13,7 +13,7 @@ from PyInstaller.building.build_main import Analysis
sys.path.append(os.path.abspath(os.getcwd()))
from resources import constants
from opencore_legacy_patcher import constants
block_cipher = None
@@ -70,7 +70,7 @@ coll = COLLECT(exe,
app = BUNDLE(coll,
name='OpenCore-Patcher.app',
icon="payloads/OC-Patcher.icns",
icon="payloads/Icon/AppIcons/OC-Patcher.icns",
bundle_identifier="com.dortania.opencore-legacy-patcher",
info_plist={
"CFBundleName": "OpenCore Legacy Patcher",

View File

@@ -1,57 +0,0 @@
# Copyright (C) 2022, Mykola Grymalyuk
# Within AppleMobileFileIntegrity.kext, Apple has a bitmask-based boot-arg (ex. amfi=128)
# Below information is from reversed values in 13.0 Beta 6's AppleMobileFileIntegrity.kext
# Currently only 'amfi=3' has been used by Apple publicly
# - 0x3 used in 11.0.1 dyld source:
# - https://github.com/apple-oss-distributions/dyld/blob/5c9192436bb195e7a8fe61f22a229ee3d30d8222/testing/test-cases/kernel-hello-world.dtest/main.c#L2
import enum
class AppleMobileFileIntegrity(enum.IntEnum):
# Names set are solely for readability
# Internal names are unknown
AMFI_ALLOW_TASK_FOR_PID: int = 0x1 # Allow Task for PID (alt. amfi_unrestrict_task_for_pid=0x1)
AMFI_ALLOW_INVALID_SIGNATURE: int = 0x2 # Reduce sig enforcement (alt. amfi_allow_any_signature=0x1)
AMFI_LV_ENFORCE_THIRD_PARTY: int = 0x4 # Don't mark external binaries as platform binaries
AMFI_UNKNOWN_1: int = 0x8
AMFI_UNKNOWN_2: int = 0x10
AMFI_UNKNOWN_3: int = 0x20
AMFI_UNKNOWN_4: int = 0x40
AMFI_ALLOW_EVERYTHING: int = 0x80 # Disable sig enforcement and Library Validation (alt. amfi_get_out_of_my_way=0x1)
# Internally within AMFI.kext, Apple references 0x2 and 0x80 as both 'Disable signature enforcement'
# However 0x80 is a higher privilege than 0x2, and breaks TCC support in OS (ex. Camera, Microphone, etc prompts)
# Supported boot-args within AMFI.kext, last compared against 13.0 Beta 6
#
# Within _initializeAppleMobileFileIntegrity():
# - amfi_unrestrict_task_for_pid=0x1
# - amfi_dev_mode_policy=0x1
# - amfi_allow_any_signature=0x1
# - amfi_get_out_of_my_way=0x1
# - amfi_unrestricted_local_signing=0x1
# - pmap_cs_unrestricted_local_signing=0x1
# - amfi_ready_to_roll=0x1
# - cs_enforcement_disable=0x1
#
# Within AMFIInitializeLocalSigningPublicKey():
# - -restore
#
# Within macOSPolicyConfigurationInit():
# - amfi_force_policy=0x1
# - amfi_block_unsigned_code=0x1
# - amfi_force_cs_kill=0x1
# - amfi_hsp_disable=0x1
# - amfi_hsp_logging=0x1
# - amfi_allow_bni_as_platform=0x1
# - amfi_allow_non_platform=0x1
# - amfi_prevent_old_entitled_platform_binaries=0x1
# - amfi_allow_only_tc=0x1
# - amfi_allow_only_tc_override=0x1
#
# Within configurationSettingsInit()
# - amfi_enforce_launch_constraints=0x1
# - amfi_allow_3p_launch_constraints=0x1
# - BATS_TESTPLAN_ID="Custom Team ID"

View File

@@ -0,0 +1 @@
from .application_entry import main

View File

@@ -1,24 +1,31 @@
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
"""
application_entry.py: Project entry point
"""
import os
import sys
import time
import logging
import threading
from pathlib import Path
from resources.wx_gui import gui_entry
from resources import (
constants,
utilities,
from . import constants
from .wx_gui import gui_entry
from .detections import (
device_probe,
os_probe,
os_probe
)
from .utilities import (
utilities,
defaults,
arguments,
reroute_payloads,
commit_info,
logging_handler,
analytics_handler,
analytics_handler
)
@@ -43,7 +50,7 @@ class OpenCoreLegacyPatcher:
Generate base data required for the patcher to run
"""
self.constants.wxpython_variant: bool = True
self.constants.wxpython_variant = True
# Ensure we live after parent process dies (ie. LaunchAgent)
os.setpgrp()
@@ -111,3 +118,9 @@ class OpenCoreLegacyPatcher:
time.sleep(0.1)
arguments.arguments(self.constants)
def main():
"""
Main entry point
"""
OpenCoreLegacyPatcher()

View File

@@ -1,13 +1,13 @@
# pylint: disable=multiple-statements
# Defines versioning, file paths and other settings for the patcher
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
constants.py: Defines versioning, file paths and other settings for the patcher
"""
from pathlib import Path
from typing import Optional
from pathlib import Path
from typing import Optional
from packaging import version
from resources import device_probe
from data import os_data
from .datasets import os_data
from .detections import device_probe
class Constants:
@@ -739,7 +739,7 @@ class Constants:
@property
def app_icon_path(self):
return self.payload_path / Path("OC-Patcher.icns")
return self.payload_path / Path("Icon/AppIcons/OC-Patcher.icns")
@property
def icon_path_external(self):

View File

@@ -0,0 +1,63 @@
"""
amfi_data.py: AppleMobileFileIntegrity Bitmask Data
"""
"""
Within AppleMobileFileIntegrity.kext, Apple has a bitmask-based boot-arg (ex. amfi=128)
Below information is from reversed values in 13.0 Beta 6's AppleMobileFileIntegrity.kext
Currently only 'amfi=3' has been used by Apple publicly
- 0x3 used in 11.0.1 dyld source:
- https://github.com/apple-oss-distributions/dyld/blob/5c9192436bb195e7a8fe61f22a229ee3d30d8222/testing/test-cases/kernel-hello-world.dtest/main.c#L2
"""
import enum
class AppleMobileFileIntegrity(enum.IntEnum):
# Names set are solely for readability
# Internal names are unknown
AMFI_ALLOW_TASK_FOR_PID: int = 0x1 # Allow Task for PID (alt. amfi_unrestrict_task_for_pid=0x1)
AMFI_ALLOW_INVALID_SIGNATURE: int = 0x2 # Reduce sig enforcement (alt. amfi_allow_any_signature=0x1)
AMFI_LV_ENFORCE_THIRD_PARTY: int = 0x4 # Don't mark external binaries as platform binaries
AMFI_UNKNOWN_1: int = 0x8
AMFI_UNKNOWN_2: int = 0x10
AMFI_UNKNOWN_3: int = 0x20
AMFI_UNKNOWN_4: int = 0x40
AMFI_ALLOW_EVERYTHING: int = 0x80 # Disable sig enforcement and Library Validation (alt. amfi_get_out_of_my_way=0x1)
"""
Internally within AMFI.kext, Apple references 0x2 and 0x80 as both 'Disable signature enforcement'
However 0x80 is a higher privilege than 0x2, and breaks TCC support in OS (ex. Camera, Microphone, etc prompts)
Supported boot-args within AMFI.kext, last compared against 13.0 Beta 6
Within _initializeAppleMobileFileIntegrity():
- amfi_unrestrict_task_for_pid=0x1
- amfi_dev_mode_policy=0x1
- amfi_allow_any_signature=0x1
- amfi_get_out_of_my_way=0x1
- amfi_unrestricted_local_signing=0x1
- pmap_cs_unrestricted_local_signing=0x1
- amfi_ready_to_roll=0x1
- cs_enforcement_disable=0x1
Within AMFIInitializeLocalSigningPublicKey():
- -restore
Within macOSPolicyConfigurationInit():
- amfi_force_policy=0x1
- amfi_block_unsigned_code=0x1
- amfi_force_cs_kill=0x1
- amfi_hsp_disable=0x1
- amfi_hsp_logging=0x1
- amfi_allow_bni_as_platform=0x1
- amfi_allow_non_platform=0x1
- amfi_prevent_old_entitled_platform_binaries=0x1
- amfi_allow_only_tc=0x1
- amfi_allow_only_tc_override=0x1
Within configurationSettingsInit()
- amfi_enforce_launch_constraints=0x1
- amfi_allow_3p_launch_constraints=0x1
- BATS_TESTPLAN_ID="Custom Team ID"
"""

View File

@@ -1,3 +1,7 @@
"""
bluetooth_data.py: Enum for Bluetooth Chipsets
"""
import enum

View File

@@ -1,3 +1,7 @@
"""
cpu_data.py: CPU Generation Data
"""
import enum

View File

@@ -1,4 +1,9 @@
# Comprised of https://github.com/sindresorhus/github-markdown-css and additions for OCLP
"""
css_data.py: CSS data for project's update window
Comprised of https://github.com/sindresorhus/github-markdown-css and additions for OCLP
"""
updater_css = """

View File

@@ -1,6 +1,9 @@
# Example Hardware probe of multiple models
# To be used when running validation tests
from resources import device_probe
"""
example_data.py: Sample Hardware probes, for use in OpenCore Legacy Patcher validation
"""
from ..detections import device_probe
class MacBook:

View File

@@ -1,5 +1,8 @@
# Lists all models and required patches
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
"""
model_array.py: Datasets for different models
"""
SupportedSMBIOS = [
# MacBook
"MacBook5,1",

View File

@@ -1,6 +1,11 @@
from curses.ascii import isdigit
"""
os_data.py: OS Version Data
"""
import enum
from curses.ascii import isdigit
class os_data(enum.IntEnum):
# OS Versions, Based off Major Kernel Version

View File

@@ -1,4 +1,8 @@
# Array of Device IDs for different devices
"""
pci_data.py: PCI Device IDs for different vendors and devices
"""
class nvidia_ids:
# Courteous of envytools as well as MacRumors:
# https://envytools.readthedocs.io/en/latest/hw/pciid.html

View File

@@ -1,4 +1,10 @@
from data import os_data
"""
sip_data.py: System Integrity Protection Data
"""
from . import os_data
class system_integrity_protection:
csr_values = {
# Source: macOS 11.4 (XNU's csr.h)

View File

@@ -1,24 +1,35 @@
# Defines Model Data
# Terms:
# AAPL: AppleInternal Model (ie. not released to public)
# Board ID: The board ID is a unique identifier for the motherboard.
# Firmware Features: Hex bitmask denoting supported abilities of firmware. (ie. APFS, Large BaseSystem, etc.)
# Secure Boot Model: T2/Apple Silicon Model Identifier
# CPU Generation: Stock CPU supported by the board (generally lowest generation)
# Wireless Model: Driver used for wireless networking
# Bluetooth Model: Chipset model
# Screen Size: Size of the screen in inches (generally lowest size if multiple in same model)
# UGA Graphics: If model needs UGA to GOP conversion
# Ethernet Chipset: Vendor of the ethernet chipset (if multiple unique chipset within Vendor, chipset name is used)
# nForce Chipset: If model uses nForce chipset
# Switchable GPUs: If model uses a GMUX
# Stock GPUs: GPUs variations shipped
"""
smbios_data.py: SMBIOS Dictionary for model data
"""
# Reference:
# https://github.com/acidanthera/OpenCorePkg/blob/master/Library/OcMacInfoLib/AutoGenerated.c
"""
Terms:
AAPL: AppleInternal Model (ie. not released to public)
Board ID: The board ID is a unique identifier for the motherboard.
Firmware Features: Hex bitmask denoting supported abilities of firmware. (ie. APFS, Large BaseSystem, etc.)
Secure Boot Model: T2/Apple Silicon Model Identifier
CPU Generation: Stock CPU supported by the board (generally lowest generation)
Wireless Model: Driver used for wireless networking
Bluetooth Model: Chipset model
Screen Size: Size of the screen in inches (generally lowest size if multiple in same model)
UGA Graphics: If model needs UGA to GOP conversion
Ethernet Chipset: Vendor of the ethernet chipset (if multiple unique chipset within Vendor, chipset name is used)
nForce Chipset: If model uses nForce chipset
Switchable GPUs: If model uses a GMUX
Stock GPUs: GPUs variations shipped
Reference:
https://github.com/acidanthera/OpenCorePkg/blob/master/Library/OcMacInfoLib/AutoGenerated.c
"""
from ..detections import device_probe
from . import (
cpu_data,
os_data,
bluetooth_data
)
from resources import device_probe
from data import cpu_data, os_data, bluetooth_data
smbios_dictionary = {
"MacBook1,1": {

View File

@@ -1,9 +1,10 @@
# Dictionary defining patch sets used during Root Volume patching (sys_patch.py)
# Copyright (C) 2022-2023, Mykola Grymalyuk
"""
sys_patch_dict.py: Dictionary defining patch sets used during Root Volume patching (sys_patch.py)
"""
import packaging.version
from data import os_data
from . import os_data
class SystemPatchDictionary():

View File

@@ -1,7 +1,12 @@
"""
usb_data.py: USB Device IDs for different vendors and devices
"""
class AppleIDs:
# All top case devices use Vendor ID 05ac
Modern_AppleUSBTCKeyboard = [
0x223,
0x223,
0x224,
0x225,
0x230,
@@ -53,7 +58,7 @@ class AppleIDs:
0x22a,
0x22b
]
AppleUSBTrackpad = [
0x20e,
0x20f,
@@ -75,7 +80,7 @@ class AppleIDs:
]
AppleUSBMultiTouch = [
0x223,
0x223,
0x224,
0x225,
0x230,

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +1,11 @@
# Determine AppleMobileFileIntegrity's OS configuration
# Copyright (C) 2022-2023, Mykola Grymalyuk
"""
amfi_detect.py: Determine AppleMobileFileIntegrity's OS configuration
"""
import enum
from resources import utilities
from data import amfi_data
from ..utilities import utilities
from ..datasets import amfi_data
class AmfiConfigDetectLevel(enum.IntEnum):

View File

@@ -1,18 +1,24 @@
# Hardware probing
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
"""
device_probe.py: Hardware probing
"""
import binascii
import enum
import itertools
import subprocess
import plistlib
import hashlib
from pathlib import Path
from dataclasses import dataclass, field
from typing import Any, ClassVar, Optional, Type, Union
from resources import utilities, ioreg
from data import pci_data, usb_data
from ..utilities import utilities
from ..detections import ioreg
from ..datasets import (
pci_data,
usb_data
)
def class_code_to_bytes(class_code: int) -> bytes:

View File

@@ -1,5 +1,6 @@
# PyObjc Handling for IOKit
# Copyright (C) 2020-2022, Dhinak G
"""
ioreg.py: PyObjc Handling for IOKit
"""
from typing import NewType, Union
import objc

View File

@@ -1,8 +1,10 @@
# Probe for OS data
"""
os_probe.py: OS Host information
"""
import platform
import subprocess
import plistlib
import subprocess
class OSProbe:

View File

@@ -1,12 +1,20 @@
# Class for handling Bluetooth Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
bluetooth.py: Class for handling Bluetooth Patches, invocation from build.py
"""
import logging
import binascii
from resources import constants, device_probe
from resources.build import support
from data import smbios_data, bluetooth_data
from . import support
from .. import constants
from ..detections import device_probe
from ..datasets import (
smbios_data,
bluetooth_data
)
class BuildBluetooth:

View File

@@ -1,19 +1,35 @@
# Class for generating OpenCore Configurations tailored for Macs
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
build.py: Class for generating OpenCore Configurations tailored for Macs
"""
import copy
import pickle
import plistlib
import shutil
import zipfile
import logging
import zipfile
import plistlib
from pathlib import Path
from datetime import date
from resources import constants, utilities
from resources.build import bluetooth, firmware, graphics_audio, support, storage, smbios, security, misc
from resources.build.networking import wired, wireless
from .. import constants
from ..utilities import utilities
from .networking import (
wired,
wireless
)
from . import (
bluetooth,
firmware,
graphics_audio,
support,
storage,
smbios,
security,
misc
)
def rmtree_handler(func, path, exc_info) -> None:

View File

@@ -1,5 +1,6 @@
# Class for handling CPU and Firmware Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
firmware.py: Class for handling CPU and Firmware Patches, invocation from build.py
"""
import shutil
import logging
@@ -7,9 +8,18 @@ import binascii
from pathlib import Path
from resources import constants, generate_smbios, device_probe
from resources.build import support
from data import smbios_data, cpu_data, os_data
from . import support
from .. import constants
from ..utilities import generate_smbios
from ..detections import device_probe
from ..datasets import (
smbios_data,
cpu_data,
os_data
)
class BuildFirmware:

View File

@@ -1,5 +1,6 @@
# Class for handling Graphics and Audio Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
graphics_audio.py: Class for handling Graphics and Audio Patches, invocation from build.py
"""
import shutil
import logging
@@ -7,9 +8,20 @@ import binascii
from pathlib import Path
from resources import constants, device_probe, utilities
from resources.build import support
from data import smbios_data, model_array, os_data, cpu_data, video_bios_data
from . import support
from .. import constants
from ..utilities import utilities
from ..detections import device_probe
from ..datasets import (
smbios_data,
model_array,
os_data,
cpu_data,
video_bios_data
)
class BuildGraphicsAudio:

View File

@@ -1,5 +1,6 @@
# Class for handling Misc Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
misc.py: Class for handling Misc Patches, invocation from build.py
"""
import shutil
import logging
@@ -7,15 +8,24 @@ import binascii
from pathlib import Path
from resources import constants, device_probe, generate_smbios, utilities
from resources.build import support
from data import model_array, smbios_data, cpu_data
from . import support
from .. import constants
from ..utilities import generate_smbios
from ..detections import device_probe
from ..datasets import (
model_array,
smbios_data,
cpu_data
)
class BuildMiscellaneous:
"""
Build Library for Miscellaneous Hardware and Software Support
xw
Invoke from build.py
"""

View File

@@ -1,9 +1,17 @@
# Class for handling Wired Networking Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
wired.py: Class for handling Wired Networking Patches, invocation from build.py
"""
from resources import constants, device_probe
from resources.build import support
from data import smbios_data, cpu_data
from .. import support
from ... import constants
from ...detections import device_probe
from ...datasets import (
smbios_data,
cpu_data
)
class BuildWiredNetworking:

View File

@@ -1,11 +1,17 @@
# Class for handling Wireless Networking Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
wireless.py: Class for handling Wireless Networking Patches, invocation from build.py
"""
import logging
from resources import constants, device_probe, utilities
from resources.build import support
from data import smbios_data
from .. import support
from ... import constants
from ...datasets import smbios_data
from ...utilities import utilities
from ...detections import device_probe
class BuildWirelessNetworking:

View File

@@ -1,11 +1,16 @@
# Class for handling macOS Security Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
security.py: Class for handling macOS Security Patches, invocation from build.py
"""
import logging
import binascii
from resources import constants, utilities, device_probe
from resources.build import support
from . import support
from .. import constants
from ..utilities import utilities
from ..detections import device_probe
class BuildSecurity:

View File

@@ -1,5 +1,6 @@
# Class for handling SMBIOS Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
smbios.py: Class for handling SMBIOS Patches, invocation from build.py
"""
import ast
import uuid
@@ -10,9 +11,19 @@ import subprocess
from pathlib import Path
from resources import constants, utilities, generate_smbios
from resources.build import support
from data import smbios_data, cpu_data, model_array
from . import support
from .. import constants
from ..utilities import (
utilities,
generate_smbios
)
from ..datasets import (
smbios_data,
cpu_data,
model_array
)
class BuildSMBIOS:

View File

@@ -1,11 +1,21 @@
# Class for handling Storage Controller Patches, invocation from build.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
storage.py: Class for handling Storage Controller Patches, invocation from build.py
"""
import logging
from resources import constants, device_probe, utilities
from resources.build import support
from data import model_array, smbios_data, cpu_data
from . import support
from .. import constants
from ..utilities import utilities
from ..detections import device_probe
from ..datasets import (
model_array,
smbios_data,
cpu_data
)
class BuildStorage:

View File

@@ -1,5 +1,6 @@
# Utility class for build functions
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
support.py: Utility class for build functions
"""
import shutil
import typing
@@ -10,7 +11,7 @@ import subprocess
from pathlib import Path
from resources import constants, utilities
from .. import constants
class BuildSupport:

View File

@@ -1,36 +1,39 @@
# Framework for mounting and patching macOS root volume
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
"""
sys_patch.py: Framework for mounting and patching macOS root volume
"""
# System based off of Apple's Kernel Debug Kit (KDK)
# - https://developer.apple.com/download/all/
"""
System based off of Apple's Kernel Debug Kit (KDK)
- https://developer.apple.com/download/all/
# The system relies on mounting the APFS volume as a live read/write volume
# We perform our required edits, then create a new snapshot for the system boot
The system relies on mounting the APFS volume as a live read/write volume
We perform our required edits, then create a new snapshot for the system boot
# The manual process is as follows:
# 1. Find the Root Volume
# 'diskutil info / | grep "Device Node:"'
# 2. Convert Snapshot Device Node to Root Volume Device Node
# /dev/disk3s1s1 -> /dev/disk3s1 (strip last 's1')
# 3. Mount the APFS volume as a read/write volume
# 'sudo mount -o nobrowse -t apfs /dev/disk5s5 /System/Volumes/Update/mnt1'
# 4. Perform edits to the system (ie. create new KernelCollection)
# 'sudo kmutil install --volume-root /System/Volumes/Update/mnt1/ --update-all'
# 5. Create a new snapshot for the system boot
# 'sudo bless --folder /System/Volumes/Update/mnt1/System/Library/CoreServices --bootefi --create-snapshot'
The manual process is as follows:
1. Find the Root Volume
'diskutil info / | grep "Device Node:"'
2. Convert Snapshot Device Node to Root Volume Device Node
/dev/disk3s1s1 -> /dev/disk3s1 (strip last 's1')
3. Mount the APFS volume as a read/write volume
'sudo mount -o nobrowse -t apfs /dev/disk5s5 /System/Volumes/Update/mnt1'
4. Perform edits to the system (ie. create new KernelCollection)
'sudo kmutil install --volume-root /System/Volumes/Update/mnt1/ --update-all'
5. Create a new snapshot for the system boot
'sudo bless --folder /System/Volumes/Update/mnt1/System/Library/CoreServices --bootefi --create-snapshot'
# Additionally Apple's APFS snapshot system supports system rollbacks:
# 'sudo bless --mount /System/Volumes/Update/mnt1 --bootefi --last-sealed-snapshot'
# Note: root volume rollbacks are unstable in Big Sur due to quickly discarding the original snapshot
# - Generally within 2~ boots, the original snapshot is discarded
# - Monterey always preserves the original snapshot allowing for reliable rollbacks
Additionally Apple's APFS snapshot system supports system rollbacks:
'sudo bless --mount /System/Volumes/Update/mnt1 --bootefi --last-sealed-snapshot'
Note: root volume rollbacks are unstable in Big Sur due to quickly discarding the original snapshot
- 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'
Alternative to mounting via 'mount', Apple's update system uses 'mount_apfs' directly
'/sbin/mount_apfs -R /dev/disk5s5 /System/Volumes/Update/mnt1'
# With macOS Ventura, you will also need to install the KDK onto root if you plan to use kmutil
# This is because Apple removed on-disk binaries (ref: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/998)
# 'sudo ditto /Library/Developer/KDKs/<KDK Version>/System /System/Volumes/Update/mnt1/System'
With macOS Ventura, you will also need to install the KDK onto root if you plan to use kmutil
This is because Apple removed on-disk binaries (ref: https://github.com/dortania/OpenCore-Legacy-Patcher/issues/998)
'sudo ditto /Library/Developer/KDKs/<KDK Version>/System /System/Volumes/Update/mnt1/System'
"""
import logging
import plistlib
@@ -40,10 +43,11 @@ import applescript
from pathlib import Path
from datetime import datetime
from resources import constants, utilities, kdk_handler
from resources.sys_patch import sys_patch_detect, sys_patch_auto, sys_patch_helpers, sys_patch_generate
from .. import constants
from ..utilities import utilities, kdk_handler
from ..sys_patch import sys_patch_detect, sys_patch_auto, sys_patch_helpers, sys_patch_generate
from data import os_data
from ..datasets import os_data
class PatchSysVolume:

View File

@@ -1,23 +1,35 @@
# Copyright (C) 2022, Mykola Grymalyuk
# Copyright (c) 2023 Jazzzny
"""
sys_patch_auto.py: Library of functions for launch services, including automatic patching
"""
import wx
import wx.html2
import requests
import markdown2
import hashlib
import logging
import plistlib
import requests
import markdown2
import subprocess
import webbrowser
import hashlib
from pathlib import Path
from .. import constants
from resources import utilities, updates, global_settings, network_handler, constants
from resources.sys_patch import sys_patch_detect
from resources.wx_gui import gui_entry, gui_support
from data import css_data
from ..datasets import css_data
from ..sys_patch import sys_patch_detect
from ..wx_gui import (
gui_entry,
gui_support
)
from ..utilities import (
utilities,
updates,
global_settings,
network_handler
)
class AutomaticSysPatch:

View File

@@ -1,18 +1,32 @@
# Hardware Detection Logic for Root Patching
# Returns a dictionary of patches with boolean values
# Used when supplying data to sys_patch.py
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
"""
sys_patch_detect.py: Hardware Detection Logic for Root Patching
"""
import logging
import plistlib
import py_sip_xnu
import packaging.version
from pathlib import Path
import packaging.version
import py_sip_xnu
from .. import constants
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)
from ..detections import (
amfi_detect,
device_probe
)
from ..utilities import (
kdk_handler,
network_handler,
utilities
)
from ..datasets import (
cpu_data,
model_array,
os_data,
sip_data,
smbios_data
)
class DetectRootPatch:

View File

@@ -1,8 +1,15 @@
# Generate patch set for use in sys_patch.py
"""
sys_patch_generate.py: Class for generating patch sets for the current host
"""
import logging
from resources import constants, utilities, device_probe
from data import sys_patch_dict
from .. import constants
from ..datasets import sys_patch_dict
from ..utilities import utilities
from ..detections import device_probe
class GenerateRootPatchSets:
"""

View File

@@ -1,17 +1,25 @@
# Additional support functions for sys_patch.py
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
sys_patch_helpers.py: Additional support functions for sys_patch.py
"""
import plistlib
import os
import logging
import plistlib
import subprocess
from typing import Union
from pathlib import Path
from datetime import datetime
from data import os_data
from resources import bplist, constants, generate_smbios, utilities
from .. import constants
from ..datasets import os_data
from ..utilities import (
bplist,
generate_smbios,
utilities
)
class SysPatchHelpers:

View File

@@ -1,9 +1,19 @@
"""
analytics_handler.py: Analytics and Crash Reporting Handler
"""
import json
import datetime
import plistlib
from pathlib import Path
import json
from resources import network_handler, constants, global_settings
from pathlib import Path
from .. import constants
from ..utilities import (
network_handler,
global_settings
)
DATE_FORMAT: str = "%Y-%m-%d %H-%M-%S"

View File

@@ -1,3 +1,7 @@
"""
arguments.py: CLI argument handling
"""
import sys
import time
import logging
@@ -7,11 +11,25 @@ import subprocess
from pathlib import Path
from data import model_array, os_data
from resources.build import build
from resources.sys_patch import sys_patch, sys_patch_auto
from resources import defaults, utilities, validation, constants
from resources.wx_gui import gui_entry
from .. import constants
from ..wx_gui import gui_entry
from ..efi_builder import build
from ..datasets import (
model_array,
os_data
)
from ..sys_patch import (
sys_patch,
sys_patch_auto
)
from ..utilities import (
utilities,
defaults,
validation
)
# Generic building args

View File

@@ -1,7 +1,11 @@
# Parse Commit Info from binary's info.plist
"""
commit_info.py: Parse Commit Info from binary's info.plist
"""
import plistlib
from pathlib import Path
import plistlib
class ParseCommitInfo:

View File

@@ -1,14 +1,19 @@
# Generate Default Data
"""
defaults.py: Generate default data for host/target
"""
import subprocess
from resources import (
from .. import constants
from ..detections import device_probe
from ..utilities import (
utilities,
device_probe,
generate_smbios,
global_settings,
constants
global_settings
)
from data import (
from ..datasets import (
smbios_data,
cpu_data,
os_data
@@ -25,16 +30,16 @@ class GenerateDefaults:
self.host_is_target: bool = host_is_target
# Reset Variables
self.constants.sip_status: bool = True
self.constants.secure_status: bool = False
self.constants.disable_cs_lv: bool = False
self.constants.disable_amfi: bool = False
self.constants.fu_status: bool = True
self.constants.sip_status = True
self.constants.secure_status = False
self.constants.disable_cs_lv = False
self.constants.disable_amfi = False
self.constants.fu_status = True
self.constants.fu_arguments: str = None
self.constants.fu_arguments = None
self.constants.custom_serial_number: str = ""
self.constants.custom_board_serial_number: str = ""
self.constants.custom_serial_number = ""
self.constants.custom_board_serial_number = ""
if self.host_is_target is True:
for gpu in self.constants.computer.gpus:

View File

@@ -1,8 +1,18 @@
from data import smbios_data, os_data, cpu_data
from resources import utilities
"""
generate_smbios.py: SMBIOS generation for OpenCore Legacy Patcher
"""
import logging
from ..utilities import utilities
from ..datasets import (
smbios_data,
os_data,
cpu_data
)
def set_smbios_model_spoof(model):
try:
smbios_data.smbios_dictionary[model]["Screen Size"]

View File

@@ -1,13 +1,18 @@
# Alternative to Apple's 'defaults' tool
# Store data in '/Users/Shared'
# This is to ensure compatibility when running without a user
# ie. during automated patching
"""
global_settings.py: Library for querying and writing global enviroment settings
Alternative to Apple's 'defaults' tool
Store data in '/Users/Shared'
This is to ensure compatibility when running without a user
ie. during automated patching
"""
import os
import logging
import plistlib
import subprocess
from pathlib import Path
import plistlib
import logging
import os
import subprocess
class GlobalEnviromentSettings:

View File

@@ -1,6 +1,6 @@
# Installation of OpenCore files to ESP
# Usage solely for TUI
# Copyright (C) 2020-2022, Dhinak G, Mykola Grymalyuk
"""
install.py: Installation of OpenCore files to ESP
"""
import logging
import plistlib
@@ -9,8 +9,10 @@ import applescript
from pathlib import Path
from resources import utilities, constants
from data import os_data
from .. import constants
from ..datasets import os_data
from ..utilities import utilities
class tui_disk_installation:

View File

@@ -1,7 +1,9 @@
# Validate the integrity of Apple downloaded files via .chunklist and .integrityDataV1 files
# Based off of chunklist.py:
# - https://gist.github.com/dhinakg/cbe30edf31ddc153fd0b0c0570c9b041
# Copyright (C) 2021-2023, Dhinak G, Mykola Grymalyuk
"""
integrity_verification.py: Validate the integrity of Apple downloaded files via .chunklist and .integrityDataV1 files
Based off of chunklist.py:
- https://gist.github.com/dhinakg/cbe30edf31ddc153fd0b0c0570c9b041
"""
import enum
import hashlib

View File

@@ -1,22 +1,26 @@
# Module for parsing and determining best Kernel Debug Kit for host OS
# Copyright (C) 2022-2023, Dhinak G, Mykola Grymalyuk
"""
kdk_handler.py: Module for parsing and determining best Kernel Debug Kit for host OS
"""
import datetime
from pathlib import Path
from typing import cast
import tempfile
import plistlib
import packaging.version
import requests
import subprocess
import os
import logging
import plistlib
import requests
import tempfile
import subprocess
import packaging.version
from resources import utilities, network_handler, constants
from data import os_data
from typing import cast
from pathlib import Path
from .. import constants
from ..datasets import os_data
from ..utilities import (
utilities,
network_handler
)
KDK_INSTALL_PATH: str = "/Library/Developer/KDKs"
KDK_INFO_PLIST: str = "KDKInfo.plist"
@@ -89,7 +93,7 @@ class KernelDebugKitObject:
self._get_latest_kdk()
def _get_remote_kdks(self) -> list or None:
def _get_remote_kdks(self) -> list:
"""
Fetches a list of available KDKs from the KdkSupportPkg API
Additionally caches the list for future use, avoiding extra API calls
@@ -247,7 +251,7 @@ class KernelDebugKitObject:
self.success = True
def retrieve_download(self, override_path: str = "") -> network_handler.DownloadObject or None:
def retrieve_download(self, override_path: str = "") -> network_handler.DownloadObject:
"""
Returns a DownloadObject for the KDK
@@ -381,7 +385,7 @@ class KernelDebugKitObject:
return True
def _local_kdk_installed(self, match: str = None, check_version: bool = False) -> str or None:
def _local_kdk_installed(self, match: str = None, check_version: bool = False) -> str:
"""
Checks if KDK matching build is installed
If so, validates it has not been corrupted

View File

@@ -1,3 +1,7 @@
"""
logging_handler.py: Initialize logging framework for program
"""
import os
import sys
import pprint
@@ -10,7 +14,12 @@ import applescript
from pathlib import Path
from datetime import datetime
from resources import constants, analytics_handler, global_settings
from .. import constants
from ..utilities import (
analytics_handler,
global_settings
)
class InitializeLoggingSupport:

View File

@@ -1,15 +1,22 @@
# Handler for macOS installers, both local and remote
"""
macos_installer_handler.py: Handler for macOS installers, both local and remote
"""
from pathlib import Path
import plistlib
import subprocess
import tempfile
import enum
import logging
import plistlib
import tempfile
import subprocess
import applescript
from data import os_data
from resources import network_handler, utilities
from pathlib import Path
from ..datasets import os_data
from ..utilities import (
network_handler,
utilities
)
APPLICATION_SEARCH_PATH: str = "/Applications"

View File

@@ -1,7 +1,9 @@
# Library dedicated to Network Handling tasks including downloading files
# Primarily based around the DownloadObject class, which provides a simple
# object for libraries to query download progress and status
# Copyright (C) 2023, Mykola Grymalyuk
"""
network_handler.py: Library dedicated to Network Handling tasks including downloading files
Primarily based around the DownloadObject class, which provides a simple
object for libraries to query download progress and status
"""
import time
import requests
@@ -10,9 +12,11 @@ import logging
import enum
import hashlib
import atexit
from typing import Union
from pathlib import Path
from resources import utilities
from ..utilities import utilities
SESSION = requests.Session()
@@ -218,7 +222,7 @@ class DownloadObject:
self._download(display_progress)
def download_simple(self, verify_checksum: bool = False) -> str or bool:
def download_simple(self, verify_checksum: bool = False) -> Union[str, bool]:
"""
Alternative to download(), mimics utilities.py's old download_file() function

View File

@@ -1,15 +1,19 @@
# Reroute binaries to tmp directory, and mount a disk image of the payloads
# Implements a shadowfile to avoid direct writes to the dmg
# Copyright (C) 2022, Mykola Grymalyuk
"""
reroute_payloads.py: Reroute binaries to tmp directory, and mount a disk image of the payloads
Implements a shadowfile to avoid direct writes to the dmg
"""
import plistlib
from pathlib import Path
import subprocess
import tempfile
import atexit
import plistlib
import tempfile
import subprocess
import logging
from resources import constants
from pathlib import Path
from .. import constants
class RoutePayloadDiskImage:

View File

@@ -1,13 +1,19 @@
# Copyright (C) 2022, Mykola Grymalyuk
# Check whether new updates are available for OpenCore Legacy Patcher binary
# Call check_binary_updates() to determine if any updates are available
# Returns dict with Link and Version of the latest binary update if available
import logging
from typing import Optional, Union
"""
updates.py: Check for OpenCore Legacy Patcher binary updates
Call check_binary_updates() to determine if any updates are available
Returns dict with Link and Version of the latest binary update if available
"""
import logging
from typing import Optional, Union
from packaging import version
from resources import constants, network_handler
from .. import constants
from ..utilities import network_handler
REPO_LATEST_RELEASE_URL: str = "https://api.github.com/repos/dortania/OpenCore-Legacy-Patcher/releases/latest"

View File

@@ -1,20 +1,29 @@
# Copyright (C) 2020-2023, Dhinak G, Mykola Grymalyuk
"""
utilities.py: Utility functions for OpenCore Legacy Patcher
"""
import argparse
import atexit
import binascii
import logging
import math
import os
import plistlib
import re
import math
import atexit
import shutil
import logging
import argparse
import binascii
import plistlib
import subprocess
from pathlib import Path
import py_sip_xnu
from data import os_data, sip_data
from resources import constants, ioreg
from pathlib import Path
from .. import constants
from ..detections import ioreg
from ..datasets import (
os_data,
sip_data
)
def hexswap(input_hex: str):
@@ -553,7 +562,7 @@ def elevated(*args, **kwargs) -> subprocess.CompletedProcess:
return subprocess.run(["/usr/bin/sudo"] + [args[0][0]] + args[0][1:], **kwargs)
def fetch_staged_update(variant: str = "Update") -> (str, str):
def fetch_staged_update(variant: str = "Update") -> tuple[str, str]:
"""
Check for staged macOS update
Supported variants:

View File

@@ -1,11 +1,24 @@
"""
validation.py: Validation class for the patcher
"""
import logging
import subprocess
from pathlib import Path
from resources.sys_patch import sys_patch_helpers
from resources.build import build
from resources import constants, network_handler
from data import example_data, model_array, sys_patch_dict, os_data
from .. import constants
from ..sys_patch import sys_patch_helpers
from ..utilities import network_handler
from ..efi_builder import build
from ..datasets import (
example_data,
model_array,
sys_patch_dict,
os_data
)
class PatcherValidation:

View File

@@ -1,12 +1,14 @@
# About frame, just to sat
"""
gui_about.py: About frame
"""
import wx
import wx.adv
import logging
from resources.wx_gui import gui_support
from .. import constants
from resources import constants
from ..wx_gui import gui_support
class AboutFrame(wx.Frame):

View File

@@ -1,12 +1,17 @@
# Generate UI for Building OpenCore
"""
gui_build.py: Generate UI for Building OpenCore
"""
import wx
import logging
import threading
import traceback
from resources import constants
from resources.build import build
from resources.wx_gui import (
from .. import constants
from ..efi_builder import build
from ..wx_gui import (
gui_main_menu,
gui_install_oc,
gui_support

View File

@@ -1,5 +1,5 @@
"""
UI to display to users before a macOS update is applied
gui_cache_os_update.py: UI to display to users before a macOS update is applied
Primarily for caching updates required for incoming OS (ex. KDKs)
"""
@@ -11,8 +11,9 @@ import threading
from pathlib import Path
from resources import constants, kdk_handler, utilities
from resources.wx_gui import gui_support, gui_download
from .. import constants
from ..utilities import kdk_handler, utilities
from ..wx_gui import gui_support, gui_download
class OSUpdateFrame(wx.Frame):

View File

@@ -1,16 +1,19 @@
# Generate UI for downloading files
"""
gui_download.py: Generate UI for downloading files
"""
import wx
import logging
from resources import (
constants,
from .. import constants
from ..wx_gui import gui_support
from ..utilities import (
network_handler,
utilities
)
from resources.wx_gui import gui_support
class DownloadFrame(wx.Frame):
"""
@@ -67,7 +70,7 @@ class DownloadFrame(wx.Frame):
self.download_obj.download()
while self.download_obj.is_active():
percentage: int = round(self.download_obj.get_percent())
if percentage == 0:
percentage = 1

View File

@@ -1,11 +1,17 @@
# Entry point for the wxPython GUI
"""
gui_entry.py: Entry point for the wxPython GUI
"""
import wx
import sys
import atexit
import logging
from resources import constants
from resources.wx_gui import (
from .. import constants
from ..sys_patch import sys_patch_detect
from ..wx_gui import (
gui_cache_os_update,
gui_main_menu,
gui_build,
@@ -13,7 +19,6 @@ from resources.wx_gui import (
gui_sys_patch_start,
gui_update,
)
from resources.sys_patch import sys_patch_detect
class SupportedEntryPoints:

View File

@@ -1,11 +1,14 @@
# Generate UI for help menu
"""
gui_help.py: GUI Help Menu
"""
import wx
import logging
import webbrowser
from resources import constants
from .. import constants
from resources.wx_gui import gui_support
from ..wx_gui import gui_support
class HelpFrame(wx.Frame):

View File

@@ -1,11 +1,22 @@
"""
gui_install_oc.py: Frame for installing OpenCore to disk
"""
import wx
import threading
import logging
import threading
import traceback
from resources.wx_gui import gui_main_menu, gui_support, gui_sys_patch_display
from resources import constants, install
from data import os_data
from .. import constants
from ..datasets import os_data
from ..utilities import install
from ..wx_gui import (
gui_main_menu,
gui_support,
gui_sys_patch_display
)
class InstallOCFrame(wx.Frame):

View File

@@ -1,25 +1,34 @@
"""
gui_macos_installer_download.py: macOS Installer Download Frame
"""
import wx
import locale
import logging
import threading
import webbrowser
import locale
from pathlib import Path
from resources.wx_gui import (
from .. import constants
from ..datasets import (
os_data,
smbios_data,
cpu_data
)
from ..wx_gui import (
gui_main_menu,
gui_support,
gui_download,
gui_macos_installer_flash
)
from resources import (
constants,
from ..utilities import (
macos_installer_handler,
utilities,
network_handler,
integrity_verification
)
from data import os_data, smbios_data, cpu_data
class macOSInstallerDownloadFrame(wx.Frame):
@@ -51,7 +60,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
Convert icon to bitmap
"""
return wx.Bitmap(wx.Bitmap(icon, wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(size[0], size[1], wx.IMAGE_QUALITY_HIGH))
def _macos_version_to_icon(self, version: int) -> int:
"""
Convert macOS version to icon
@@ -143,20 +152,20 @@ class macOSInstallerDownloadFrame(wx.Frame):
"""
Display available installers in frame
"""
bundles = [wx.BitmapBundle.FromBitmaps(icon) for icon in self.icons]
self.frame_modal.Destroy()
self.frame_modal = wx.Dialog(self, title="Select macOS Installer", size=(460, 500))
# Title: Select macOS Installer
title_label = wx.StaticText(self.frame_modal, label="Select macOS Installer", pos=(-1,-1))
title_label.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD))
# macOS Installers list
id = wx.NewIdRef()
self.list = wx.ListCtrl(self.frame_modal, id, style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_NO_HEADER | wx.BORDER_SUNKEN)
self.list.SetSmallImages(bundles)
@@ -226,7 +235,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
checkboxsizer = wx.BoxSizer(wx.HORIZONTAL)
checkboxsizer.Add(self.showolderversions_checkbox, 0, wx.ALIGN_CENTRE | wx.RIGHT, 5)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.AddSpacer(10)
sizer.Add(title_label, 0, wx.ALIGN_CENTRE | wx.ALL, 0)
@@ -253,15 +262,15 @@ class macOSInstallerDownloadFrame(wx.Frame):
wx.MessageDialog(self.frame_modal, "Download link copied to clipboard", "", wx.OK | wx.ICON_INFORMATION).ShowModal()
def on_select_list(self, event):
if self.list.GetSelectedItemCount() > 0:
self.select_button.Enable()
self.copy_button.Enable()
self.copy_button.Enable()
else:
self.select_button.Disable()
self.copy_button.Disable()
def on_download_installer(self, installers: dict) -> None:
"""
Download macOS installer
@@ -322,7 +331,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
self._validate_installer(list(installers.values())[selected_item]['integrity'])
def _validate_installer(self, chunklist_link: str) -> None:
"""
Validate macOS installer

View File

@@ -1,3 +1,7 @@
"""
gui_macos_installer_flash.py: macOS Installer Flash Frame
"""
import wx
import time
import logging
@@ -8,15 +12,21 @@ import subprocess
from pathlib import Path
from resources.wx_gui import gui_main_menu, gui_build, gui_support
from resources import (
constants,
from .. import constants
from ..datasets import os_data
from ..wx_gui import (
gui_main_menu,
gui_build,
gui_support
)
from ..utilities import (
macos_installer_handler,
utilities,
network_handler,
kdk_handler,
)
from data import os_data
class macOSInstallerFlashFrame(wx.Frame):

View File

@@ -1,19 +1,31 @@
# Generate GUI for main menu
# Portions of this file Copyright (c) 2023 Jazzzny
"""
gui_main_menu.py: Generate GUI for main menu
"""
import wx
import wx.html2
import markdown2
import requests
import sys
import logging
import requests
import markdown2
import threading
import webbrowser
import subprocess
from pathlib import Path
from resources.wx_gui import (
from .. import constants
from ..utilities import (
global_settings,
updates
)
from ..datasets import (
os_data,
css_data
)
from ..wx_gui import (
gui_build,
gui_macos_installer_download,
gui_support,
@@ -22,12 +34,6 @@ from resources.wx_gui import (
gui_sys_patch_display,
gui_update,
)
from resources import (
constants,
global_settings,
updates
)
from data import os_data, css_data
class MainFrame(wx.Frame):

View File

@@ -1,26 +1,32 @@
"""
gui_settings.py: Settings Frame for the GUI
"""
import os
import wx
import wx.adv
import pprint
import logging
import py_sip_xnu
import subprocess
import os
from pathlib import Path
from resources.sys_patch.sys_patch import PatchSysVolume
from resources.wx_gui import (
from .. import constants
from ..sys_patch import sys_patch
from ..wx_gui import (
gui_support,
gui_update
)
from resources import (
constants,
from ..utilities import (
global_settings,
defaults,
generate_smbios,
network_handler
)
from data import (
from ..datasets import (
model_array,
sip_data,
smbios_data,
@@ -1322,7 +1328,7 @@ Hardware Information:
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:
if sys_patch.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()
@@ -1332,7 +1338,7 @@ Hardware Information:
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:
if sys_patch.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()

View File

@@ -1,21 +1,30 @@
import datetime
import logging
import os
import plistlib
import random
import subprocess
import sys
import threading
import time
from pathlib import Path
"""
gui_support.py: Utilities for interacting with wxPython GUI
"""
import os
import wx
import sys
import time
import logging
import plistlib
import threading
import subprocess
import applescript
import packaging.version
import wx
from data import model_array, os_data, smbios_data
from resources import constants, device_probe
from resources.wx_gui import gui_about
from pathlib import Path
from .. import constants
from ..wx_gui import gui_about
from ..detections import device_probe
from ..datasets import (
model_array,
os_data,
smbios_data
)
def get_font_face():

View File

@@ -1,19 +1,20 @@
"""
gui_sys_patch_display.py: Display root patching menu
"""
import wx
import os
import wx
import logging
import plistlib
import threading
from pathlib import Path
from resources import (
constants,
)
from resources.sys_patch import (
sys_patch_detect
)
from resources.wx_gui import (
from .. import constants
from ..sys_patch import sys_patch_detect
from ..wx_gui import (
gui_main_menu,
gui_support,
gui_sys_patch_start,

View File

@@ -1,3 +1,6 @@
"""
gui_sys_patch_start.py: Root Patching Frame
"""
import wx
import sys
@@ -10,20 +13,21 @@ import subprocess
from pathlib import Path
from resources import (
constants,
kdk_handler,
)
from resources.sys_patch import (
from .. import constants
from ..datasets import os_data
from ..utilities import kdk_handler
from ..sys_patch import (
sys_patch,
sys_patch_detect
)
from resources.wx_gui import (
from ..wx_gui import (
gui_main_menu,
gui_support,
gui_download,
)
from data import os_data
class SysPatchStartFrame(wx.Frame):

View File

@@ -1,4 +1,7 @@
# Generate UI for updating the patcher
"""
gui_update.py: Generate UI for updating the patcher
"""
import wx
import sys
import time
@@ -9,9 +12,13 @@ import subprocess
from pathlib import Path
from resources.wx_gui import gui_download, gui_support
from resources import (
constants,
from .. import constants
from ..wx_gui import (
gui_download,
gui_support
)
from ..utilities import (
network_handler,
updates
)

Binary file not shown.

View File

@@ -1,5 +0,0 @@
#!/bin/bash
cd "$(dirname "$0")"
chmod +x OpenCore-Patcher
open OpenCore-Patcher