Skip to content

Commit

Permalink
Merge branch 'main' into bsd
Browse files Browse the repository at this point in the history
  • Loading branch information
Jazzzny committed Jun 27, 2024
2 parents ceeef7c + ded1e8c commit 4f2f9a8
Show file tree
Hide file tree
Showing 26 changed files with 878 additions and 646 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# OpenCore Legacy Patcher changelog

## 1.6.0

- Set `AssociatedBundleIdentifiers` property in launch services as an array
- Move to auto-generated pre/postinstall scripts for PKGs
- Streamlines PKG creation process, ensuring Install and AutoPKG scripts are always in sync
- Add support for `gktool` in PKG postinstall scripts
- Removes Gatekeeper "verifying" prompt on first launch after PKG installation
- Note `gktool` is only available on macOS Sonoma and newer
- Resolve unpatching crash edge case when host doesn't require patches.

## 1.5.0
- Restructure project directories
Expand Down
103 changes: 0 additions & 103 deletions ci_tooling/autopkg/postinstall.sh

This file was deleted.

80 changes: 0 additions & 80 deletions ci_tooling/autopkg/preinstall.sh

This file was deleted.

56 changes: 47 additions & 9 deletions ci_tooling/build_modules/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
package.py: Generate packages (Installer, Uninstaller, AutoPkg-Assets)
"""

import tempfile
import macos_pkg_builder

from opencore_legacy_patcher import constants

from .package_scripts import GenerateScripts


class GeneratePackage:
"""
Expand Down Expand Up @@ -63,48 +67,82 @@ def _generate_uninstaller_welcome(self) -> str:
return _welcome


def _generate_autopkg_welcome(self) -> str:
"""
Generate Welcome message for AutoPkg-Assets PKG
"""
_welcome = ""

_welcome += "# DO NOT RUN AUTOPKG-ASSETS MANUALLY!\n\n"
_welcome += "## THIS CAN BREAK YOUR SYSTEM'S INSTALL!\n\n"
_welcome += "This package should only ever be invoked by the Patcher itself, never downloaded or run by the user. Download the OpenCore-Patcher.pkg on the Github Repository.\n\n"
_welcome += f"[OpenCore Legacy Patcher GitHub Release]({constants.Constants().repo_link})"

return _welcome


def generate(self) -> None:
"""
Generate OpenCore-Patcher.pkg
"""
print("Generating OpenCore-Patcher-Uninstaller.pkg")
_tmp_uninstall = tempfile.NamedTemporaryFile(delete=False)
with open(_tmp_uninstall.name, "w") as f:
f.write(GenerateScripts().uninstall())

assert macos_pkg_builder.Packages(
pkg_output="./dist/OpenCore-Patcher-Uninstaller.pkg",
pkg_bundle_id="com.dortania.opencore-legacy-patcher-uninstaller",
pkg_version=constants.Constants().patcher_version,
pkg_background="./ci_tooling/installation_pkg/PkgBackgroundUninstaller.png",
pkg_preinstall_script="./ci_tooling/installation_pkg/uninstall.sh",
pkg_background="./ci_tooling/pkg_assets/PkgBackground-Uninstaller.png",
pkg_preinstall_script=_tmp_uninstall.name,
pkg_as_distribution=True,
pkg_title="OpenCore Legacy Patcher Uninstaller",
pkg_welcome=self._generate_uninstaller_welcome(),
).build() is True

print("Generating OpenCore-Patcher.pkg")

_tmp_pkg_preinstall = tempfile.NamedTemporaryFile(delete=False)
_tmp_pkg_postinstall = tempfile.NamedTemporaryFile(delete=False)
with open(_tmp_pkg_preinstall.name, "w") as f:
f.write(GenerateScripts().preinstall_pkg())
with open(_tmp_pkg_postinstall.name, "w") as f:
f.write(GenerateScripts().postinstall_pkg())

assert macos_pkg_builder.Packages(
pkg_output="./dist/OpenCore-Patcher.pkg",
pkg_bundle_id="com.dortania.opencore-legacy-patcher",
pkg_version=constants.Constants().patcher_version,
pkg_allow_relocation=False,
pkg_as_distribution=True,
pkg_background="./ci_tooling/installation_pkg/PkgBackground.png",
pkg_preinstall_script="./ci_tooling/installation_pkg/preinstall.sh",
pkg_postinstall_script="./ci_tooling/installation_pkg/postinstall.sh",
pkg_background="./ci_tooling/pkg_assets/PkgBackground-Installer.png",
pkg_preinstall_script=_tmp_pkg_preinstall.name,
pkg_postinstall_script=_tmp_pkg_postinstall.name,
pkg_file_structure=self._files,
pkg_title="OpenCore Legacy Patcher",
pkg_welcome=self._generate_installer_welcome(),
).build() is True

print("Generating AutoPkg-Assets.pkg")

_tmp_auto_pkg_preinstall = tempfile.NamedTemporaryFile(delete=False)
_tmp_auto_pkg_postinstall = tempfile.NamedTemporaryFile(delete=False)
with open(_tmp_auto_pkg_preinstall.name, "w") as f:
f.write(GenerateScripts().preinstall_autopkg())
with open(_tmp_auto_pkg_postinstall.name, "w") as f:
f.write(GenerateScripts().postinstall_autopkg())

assert macos_pkg_builder.Packages(
pkg_output="./dist/AutoPkg-Assets.pkg",
pkg_bundle_id="com.dortania.pkg.AutoPkg-Assets",
pkg_version=constants.Constants().patcher_version,
pkg_allow_relocation=False,
pkg_as_distribution=True,
pkg_background="./ci_tooling/autopkg/PkgBackground.png",
pkg_preinstall_script="./ci_tooling/autopkg/preinstall.sh",
pkg_postinstall_script="./ci_tooling/autopkg/postinstall.sh",
pkg_background="./ci_tooling/pkg_assets/PkgBackground-AutoPkg.png",
pkg_preinstall_script=_tmp_auto_pkg_preinstall.name,
pkg_postinstall_script=_tmp_auto_pkg_postinstall.name,
pkg_file_structure=self._autopkg_files,
pkg_title="AutoPkg Assets",
pkg_welcome="# DO NOT RUN AUTOPKG-ASSETS MANUALLY!\n\n## THIS CAN BREAK YOUR SYSTEM'S INSTALL!\n\nThis package should only ever be invoked by the Patcher itself, never downloaded or run by the user. Download the OpenCore-Patcher.pkg on the Github Repository.\n\n[OpenCore Legacy Patcher GitHub Release](https://github.com/dortania/OpenCore-Legacy-Patcher/releases/)",
pkg_welcome=self._generate_autopkg_welcome(),
).build() is True
Loading

0 comments on commit 4f2f9a8

Please sign in to comment.