From 33eef9b87f3fcce75e597eadf34cdda064200ae7 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Sat, 22 Jan 2022 15:32:35 -0700 Subject: [PATCH] installer.py: Add Variant Info --- .gitignore | 1 + OpenCore-Patcher-GUI.spec | 3 ++- gui/gui_main.py | 10 +++++++--- resources/cli_menu.py | 6 +++++- resources/constants.py | 1 + resources/installer.py | 24 +++++++++++++++++++----- resources/sys_patch_detect.py | 2 +- 7 files changed, 36 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 9f6e5e610..d5781dd42 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ __pycache__/ /docs/node_modules/ /payloads/List.txt /payloads/Installer.sh +/payloads/Info.plist diff --git a/OpenCore-Patcher-GUI.spec b/OpenCore-Patcher-GUI.spec index f06a2221b..af1def368 100644 --- a/OpenCore-Patcher-GUI.spec +++ b/OpenCore-Patcher-GUI.spec @@ -46,10 +46,11 @@ app = BUNDLE(exe, bundle_identifier="com.dortania.opencore-legacy-patcher-wxpython", info_plist={ "CFBundleShortVersionString": constants.Constants().patcher_version, - "NSHumanReadableCopyright": "Copyright 2020-2022 Dortania", + "NSHumanReadableCopyright": constants.Constants().copyright_date "LSMinimumSystemVersion": "10.10.0", "NSRequiresAquaSystemAppearance": False, "NSHighResolutionCapable": True, "Build Date": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), "BuildMachineOSBuild": subprocess.run("sw_vers -buildVersion".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode().strip(), + "NSPrincipalClass": "NSApplication", }) diff --git a/gui/gui_main.py b/gui/gui_main.py index f0b628ed8..c8d602aac 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -315,7 +315,7 @@ class wx_python_gui: # Copyright Label - self.copyright = wx.StaticText(self.frame, label="Copyright © 2020-2022 Dortania") + self.copyright = wx.StaticText(self.frame, label=self.constants.copyright_date) self.copyright.SetFont(wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) self.copyright.SetPosition( wx.Point( @@ -1065,8 +1065,12 @@ class wx_python_gui: i = -20 if avalible_installers: for app in avalible_installers: - print(f"macOS {avalible_installers[app]['Version']} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])} - {avalible_installers[app]['Source']})") - self.install_selection = wx.Button(self.frame, label=f"macOS {avalible_installers[app]['Version']} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])})", size=(250, 30)) + print(f"macOS {avalible_installers[app]['Version']} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])} - {avalible_installers[app]['Source']}) - {avalible_installers[app]['Variant']}") + if avalible_installers[app]['Variant'] in ["DeveloperSeed" , "PublicSeed"]: + extra = " Beta" + else: + extra = "" + self.install_selection = wx.Button(self.frame, label=f"macOS {avalible_installers[app]['Version']}{extra} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])})", size=(280, 30)) i = i + 25 self.install_selection.SetPosition( wx.Point( diff --git a/resources/cli_menu.py b/resources/cli_menu.py index 232704810..95a56ce14 100644 --- a/resources/cli_menu.py +++ b/resources/cli_menu.py @@ -1264,7 +1264,11 @@ B. Exit # Add mirror of 11.2.3 for users who want it options.append([f"macOS {mirror_data.Install_macOS_Big_Sur_11_2_3['Version']} ({mirror_data.Install_macOS_Big_Sur_11_2_3['Build']} - {utilities.human_fmt(mirror_data.Install_macOS_Big_Sur_11_2_3['Size'])} - {mirror_data.Install_macOS_Big_Sur_11_2_3['Source']})", lambda: self.download_install_assistant(mirror_data.Install_macOS_Big_Sur_11_2_3['Link'])]) for app in avalible_installers: - options.append([f"macOS {avalible_installers[app]['Version']} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])} - {avalible_installers[app]['Source']})", lambda x=app: self.download_install_assistant(avalible_installers[x]['Link'])]) + if avalible_installers[app]['Variant'] in ["DeveloperSeed", "PublicSeed"]: + variant = " Beta" + else: + variant = "" + options.append([f"macOS {avalible_installers[app]['Version']}{variant} ({avalible_installers[app]['Build']} - {utilities.human_fmt(avalible_installers[app]['Size'])} - {avalible_installers[app]['Source']})", lambda x=app: self.download_install_assistant(avalible_installers[x]['Link'])]) for option in options: menu.add_menu_option(option[0], function=option[1]) response = menu.start() diff --git a/resources/constants.py b/resources/constants.py index 22a36c3cf..ef01496a7 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -22,6 +22,7 @@ class Constants: self.guide_link = "https://dortania.github.io/OpenCore-Legacy-Patcher/" 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" # OpenCore Versioning # https://github.com/acidanthera/OpenCorePkg diff --git a/resources/installer.py b/resources/installer.py index 560a18c9a..71dd80668 100644 --- a/resources/installer.py +++ b/resources/installer.py @@ -99,11 +99,24 @@ def list_downloadable_macOS_installers(download_path, catalog): catalog_plist["Products"][item]["ExtendedMetaInfo"]["InstallAssistantPackageIdentifiers"]["BuildManifest"] for bm_package in catalog_plist["Products"][item]["Packages"]: - if "BuildManifest.plist" in bm_package["URL"]: - utilities.download_file(bm_package["URL"], (Path(download_path) / Path("BuildManifest.plist"))) - build_plist = plistlib.load((Path(download_path) / Path("BuildManifest.plist")).open("rb")) - version = build_plist["ProductVersion"] - build = build_plist["ProductBuildVersion"] + if "Info.plist" in bm_package["URL"] and "InstallInfo.plist" not in bm_package["URL"]: + utilities.download_file(bm_package["URL"], (Path(download_path) / Path("Info.plist"))) + build_plist = plistlib.load((Path(download_path) / Path("Info.plist")).open("rb")) + version = build_plist["MobileAssetProperties"]["OSVersion"] + build = build_plist["MobileAssetProperties"]["Build"] + try: + catalog_url = build_plist["MobileAssetProperties"]["BridgeVersionInfo"]["CatalogURL"] + if "beta" in catalog_url: + catalog_url = "PublicSeed" + elif "customerseed" in catalog_url: + catalog_url = "CustomerSeed" + elif "seed" in catalog_url: + catalog_url = "DeveloperSeed" + else: + catalog_url = "Unknown" + except KeyError: + # Assume CustomerSeed if no catalog URL is found + catalog_url = "CustomerSeed" for ia_package in catalog_plist["Products"][item]["Packages"]: if "InstallAssistant.pkg" in ia_package["URL"]: download_link = ia_package["URL"] @@ -118,6 +131,7 @@ def list_downloadable_macOS_installers(download_path, catalog): "Size": size, "integrity": integrity, "Source": "Apple Inc.", + "Variant": catalog_url, } }) except KeyError: diff --git a/resources/sys_patch_detect.py b/resources/sys_patch_detect.py index 9a8d8d854..a3bea8dc7 100644 --- a/resources/sys_patch_detect.py +++ b/resources/sys_patch_detect.py @@ -173,7 +173,7 @@ class detect_root_patch: "Validation: Patching Possible": self.verify_patch_allowed(), "Validation: SIP is enabled": self.sip_enabled, "Validation: SBM is enabled": self.sbm_enabled, - "Validation: AMFI is enabled": self.amfi_enabled, + "Validation: AMFI is enabled": self.amfi_enabled if self.amfi_must_disable else False, "Validation: FileVault is enabled": self.fv_enabled, "Validation: System is dosdude1 patched": self.dosdude_patched, "Validation: Board ID is unsupported": self.bad_board_id,