From e6251da97af2fcf73c0ab14840169d41edc1851e Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Thu, 1 Jun 2023 18:39:22 -0600 Subject: [PATCH] Add safe guards for macOS 14 --- CHANGELOG.md | 5 +++++ resources/macos_installer_handler.py | 6 +++++- resources/sys_patch/sys_patch_detect.py | 1 + resources/wx_gui/gui_macos_installer_download.py | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35a6dd0ec..2b7a5bcb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ - ex. OpenCore-Patcher.app - UI changes: - Add "Show Log File" button to menubar +- Avoid listing unsupported installer to download by default + - ex. macOS 14 InstallAssistant.pkg +- Resolve crash when fetching remote macOS installers offline +- Avoid displaying root patches on unsupported macOS versions + - ex. macOS 14 - Backend changes: - Call `setpgrp()` to prevent app from being killed if parent process is killed (ie. LaunchAgents) - Rework logging handler: diff --git a/resources/macos_installer_handler.py b/resources/macos_installer_handler.py index 04a8f6bd2..16b4080a2 100644 --- a/resources/macos_installer_handler.py +++ b/resources/macos_installer_handler.py @@ -479,7 +479,6 @@ class RemoteInstallerCatalog: os_builds.append(newest_apps[ia]["Build"]) - # Final passthrough # Remove Betas if there's a non-beta version available for ia in list(newest_apps): if newest_apps[ia]["Variant"] in ["CustomerSeed", "DeveloperSeed", "PublicSeed"]: @@ -488,6 +487,11 @@ class RemoteInstallerCatalog: newest_apps.pop(ia) break + # Remove unsupported versions (namely 14) + for ia in list(newest_apps): + if newest_apps[ia]["Version"].split(".")[0] not in supported_versions: + newest_apps.pop(ia) + return newest_apps diff --git a/resources/sys_patch/sys_patch_detect.py b/resources/sys_patch/sys_patch_detect.py index 2766c0cd5..379ac756a 100644 --- a/resources/sys_patch/sys_patch_detect.py +++ b/resources/sys_patch/sys_patch_detect.py @@ -579,6 +579,7 @@ class DetectRootPatch: "Settings: Kernel Debug Kit missing": self.missing_kdk if self.constants.detected_os >= os_data.os_data.ventura.value else False, "Validation: Patching Possible": self.verify_patch_allowed(), "Validation: Unpatching Possible": self._verify_unpatch_allowed(), + f"Validation: Unsupported Host OS": True if self.constants.detected_os > os_data.os_data.ventura and not Path("~/.dortania_developer").expanduser().exists() else False, f"Validation: SIP is enabled (Required: {self._check_sip()[2]} or higher)": self.sip_enabled, f"Validation: Currently Booted SIP: ({hex(py_sip_xnu.SipXnu().get_sip_status().value)})": self.sip_enabled, "Validation: SecureBootModel is enabled": self.sbm_enabled, diff --git a/resources/wx_gui/gui_macos_installer_download.py b/resources/wx_gui/gui_macos_installer_download.py index adc569164..bed39c95d 100644 --- a/resources/wx_gui/gui_macos_installer_download.py +++ b/resources/wx_gui/gui_macos_installer_download.py @@ -155,6 +155,11 @@ class macOSInstallerDownloadFrame(wx.Frame): # Note that on full display, the last installer is generally a beta if show_full is False and app == list(installers.keys())[-1]: installer_button.SetDefault() + else: + logging.error("No installers found on SUCatalog") + installer_button = wx.StaticText(dialog, label="Failed to fetch catalog from Apple", pos=(-1, subtitle_label.GetPosition()[1] + subtitle_label.GetSize()[1] + 5)) + installer_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + installer_button.Centre(wx.HORIZONTAL) # Show all available installers show_all_button = wx.Button(dialog, label="Show all available installers" if show_full is False else "Show only latest installers", pos=(-1, installer_button.GetPosition()[1] + installer_button.GetSize()[1]), size=(200, 30))