gui_main.py: Add popup on OpenCore Build

This commit is contained in:
Mykola Grymalyuk
2022-04-21 21:35:05 -06:00
parent 0e3d4244e7
commit 9f3a4584b4
7 changed files with 53 additions and 25 deletions
@@ -32,8 +32,8 @@ jobs:
- name: Upload Package to Artifacts
uses: actions/upload-artifact@v2
with:
name: OCLP-Install.pkg
path: ./dist/OCLP-Install.pkg
name: AutoPkg-Assets.pkg
path: ./dist/AutoPkg-Assets.pkg
- name: Upload Binary to Release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
@@ -47,6 +47,6 @@ jobs:
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./dist/OCLP-Install.pkg
file: ./dist/AutoPkg-Assets.pkg
tag: ${{ github.ref }}
file_glob: true
+2 -2
View File
@@ -24,5 +24,5 @@ __pycache__/
/payloads/Installer.sh
/payloads/Info.plist
/payloads/seed.plist
/payloads/OCLP-Install.pkg
/payloads/OCLP-Install.pkg.zip
/payloads/AutoPkg-Assets.pkg
/payloads/AutoPkg-Assets.pkg.zip
+7 -4
View File
@@ -6,8 +6,6 @@
- Drops `CSR_ALLOW_UNTRUSTED_KEXTS` and `CSR_ALLOW_UNAPPROVED_KEXTS`
- Remember TeraScale 2 Setting on MacBookPro8,2/3
- Avoids requiring toggling after first time
- Streamline GUI relaunch for Root Patch/Unpatch
- On relaunch, GUI starts patching immediately (previously user would need to re-nagivate the menu)
- Resolve Electron Crashing with SIP lowered on 12.3
- Adds `ipc_control_port_options=0` boot argument
- Unknown whether this is a "bug" or intentional from Apple, affects native Macs with SIP disabled
@@ -31,14 +29,19 @@
- Implement Automatic Patch Detection/Installation
- Requires GUI for usage
- Installations:
- During macOS Installer creating in-app, OCLP-Install.pkg is installed to macOS installer
- During macOS Installer creating in-app, AutoPkg-Assets.pkg is installed to macOS installer
- After running the installer with AutoPkgInstaller.kext, Root Patcher will install patches
- Must boot macOS Installer, does not support in-OS usage
- Post OS Updates:
- After OS updates, Patcher will detect whether system requires root patches and prompt you
- Implemented via Launch Agent in `/Library/LaunchAgents`
- OpenCore-Patcher.app will be copied to `/Library/Application Support/Dortania` for storage
- Add Reboot Prompt in GUI after Root Patching
- GUI Enhancements:
- Add Reboot Prompt after Root Patching
- Add Disk Installation Prompt after OpenCore Config Building
- Streamline GUI relaunch for Root Patch/Unpatch (remembering previous state during patching)
- Grey out return buttons while performing sensitive tasks
- Add `Currently Booted SIP` info to SIP Settings
- Remove manual root unpatching
- Removed due to reliablity issues
- `bless` based reversion still supported in Big Sur+
+23 -4
View File
@@ -518,11 +518,23 @@ class wx_python_gui:
# Once finished, change build_opencore button to "Install OpenCore"
self.build_opencore.SetLabel("🔩 Install OpenCore")
self.build_opencore.Bind(wx.EVT_BUTTON, self.install_menu)
self.build_opencore.Enable()
# Reset stdout
sys.stdout = self.stock_stdout
sys.stderr = self.stock_stderr
# Throw popup asking to install OpenCore
self.dialog = wx.MessageDialog(
parent=self.frame,
message=f"Would you like to install OpenCore now?",
caption="Finished building your OpenCore configuration!",
style=wx.YES_NO | wx.ICON_QUESTION
)
self.dialog.SetYesNoLabels("Install to disk", "View build log")
if self.dialog.ShowModal() == wx.ID_YES:
self.install_menu()
else:
self.build_opencore.Enable()
def install_menu(self, event=None):
self.frame.DestroyChildren()
@@ -1487,7 +1499,7 @@ class wx_python_gui:
def download_and_unzip_pkg(self):
# Function's main goal is to grab the correct OCLP-Install.pkg and unzip it
# Function's main goal is to grab the correct AutoPkg-Assets.pkg and unzip it
# Note the following:
# - When running a release build, pull from Github's release page with the same versioning
# - When running from source/unable to find on Github, use the nightly.link variant
@@ -2356,10 +2368,17 @@ class wx_python_gui:
)
self.sip_label_2.Center(wx.HORIZONTAL)
self.sip_label_2_2 = wx.StaticText(self.frame, label=f"Currently Booted SIP: {hex(utilities.csr_dump())}")
self.sip_label_2_2.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.sip_label_2_2.SetPosition(
wx.Point(self.sip_label_2.GetPosition().x, self.sip_label_2.GetPosition().y + self.sip_label_2.GetSize().height + 5)
)
self.sip_label_2_2.Center(wx.HORIZONTAL)
self.sip_label_3 = wx.StaticText(self.frame, label="For older Macs requiring root patching, we set SIP to\n be partially disabled (0x802) to allow root patching.")
self.sip_label_3.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.sip_label_3.SetPosition(
wx.Point(self.sip_label_2.GetPosition().x, self.sip_label_2.GetPosition().y + self.sip_label_2.GetSize().height + 10)
wx.Point(self.sip_label_2_2.GetPosition().x, self.sip_label_2_2.GetPosition().y + self.sip_label_2_2.GetSize().height + 10)
)
self.sip_label_3.Center(wx.HORIZONTAL)
+1 -1
View File
@@ -867,7 +867,7 @@ class BuildOpenCore:
print("- Adding ipc_control_port_options=0 to boot-args")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " ipc_control_port_options=0"
# Adds AutoPkgInstaller for Automatic OpenCore-Patcher installation
# Only install if running the GUI (OCLP-Install.pkg requires the GUI)
# Only install if running the GUI (AutoPkg-Assets.pkg requires the GUI)
if self.constants.wxpython_variant is True:
self.enable_kext("AutoPkgInstaller.kext", self.constants.autopkg_version, self.constants.autopkg_path)
if self.constants.custom_sip_value:
+4 -4
View File
@@ -23,8 +23,8 @@ class Constants:
self.repo_link = "https://github.com/dortania/OpenCore-Legacy-Patcher"
self.repo_link_latest = f"{self.repo_link}/releases/tag/{self.patcher_version}"
self.copyright_date = "Copyright © 2020-2022 Dortania"
self.installer_pkg_url = f"{self.repo_link_latest}/OCLP-Install.pkg.zip"
self.installer_pkg_url_nightly = "http://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython-offline/main/OCLP-Install.pkg.zip"
self.installer_pkg_url = f"{self.repo_link_latest}/AutoPkg-Assets.pkg.zip"
self.installer_pkg_url_nightly = "http://nightly.link/dortania/OpenCore-Legacy-Patcher/workflows/build-app-wxpython-offline/main/AutoPkg-Assets.pkg.zip"
# OpenCore Versioning
# https://github.com/acidanthera/OpenCorePkg
@@ -565,11 +565,11 @@ class Constants:
@property
def installer_pkg_path(self):
return self.payload_path / Path("OCLP-Install.pkg")
return self.payload_path / Path("AutoPkg-Assets.pkg")
@property
def installer_pkg_zip_path(self):
return self.payload_path / Path("OCLP-Install.pkg.zip")
return self.payload_path / Path("AutoPkg-Assets.pkg.zip")
# Apple Payloads Paths
+13 -7
View File
@@ -102,18 +102,24 @@ def check_seal():
return False
def csr_decode(os_sip):
def csr_dump():
# Based off sip_config.py
# https://gist.github.com/pudquick/8b320be960e1654b908b10346272326b
# https://opensource.apple.com/source/xnu/xnu-7195.141.2/libsyscall/wrappers/csr.c.auto.html
# Far more reliable than parsing csr-active-config
# Far more reliable than parsing NVRAM's csr-active-config (ie. user can wipe it, boot.efi can strip bits)
# Note that 'csr_get_active_config' was not introduced until 10.11
# However this function should never be called on 10.10 or earlier
libsys = CDLL('/usr/lib/libSystem.dylib')
raw = c_uint(0)
errmsg = libsys.csr_get_active_config(byref(raw))
sip_int = raw.value
try:
libsys = CDLL('/usr/lib/libSystem.dylib')
raw = c_uint(0)
errmsg = libsys.csr_get_active_config(byref(raw))
return raw.value
except AttributeError:
return 0
def csr_decode(os_sip):
sip_int = csr_dump()
for i, current_sip_bit in enumerate(sip_data.system_integrity_protection.csr_values):
if sip_int & (1 << i):
sip_data.system_integrity_protection.csr_values[current_sip_bit] = True