mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-11 16:27:19 +10:00
Implement update shim
This commit is contained in:
5
.github/workflows/build-app-wxpython.yml
vendored
5
.github/workflows/build-app-wxpython.yml
vendored
@@ -64,12 +64,9 @@ jobs:
|
||||
--installer-signing-identity "${{ env.ORG_MAC_DEVELOPER_ID_INSTALLER_IDENTITY }}"
|
||||
--notarization-apple-id "${{ env.ORG_MAC_NOTARIZATION_APPLE_ID }}" --notarization-password "${{ env.ORG_MAC_NOTARIZATION_PASSWORD }}" --notarization-team-id "${{ env.ORG_MAC_NOTARIZATION_TEAM_ID }}"
|
||||
--git-branch "${{ env.branch }}" --git-commit-url "${{ env.commiturl }}" --git-commit-date "${{ env.commitdate }}"
|
||||
--reset-dmg-cache --reset-pyinstaller-cache
|
||||
--reset-dmg-cache --reset-pyinstaller-cache --prepare-shim --prepare-autopkg
|
||||
--analytics-key "${{ env.ANALYTICS_KEY }}" --analytics-endpoint "${{ env.ANALYTICS_SITE }}"
|
||||
|
||||
- name: Generate support package
|
||||
run: /usr/local/bin/packagesbuild ./ci_tooling/autopkg/AutoPkg-Assets-Setup.pkgproj
|
||||
|
||||
- name: Prepare App for Upload
|
||||
run: /bin/mv ./dist/OpenCore-Patcher.app.zip ./OpenCore-Patcher-GUI.app.zip
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ from ci_tooling.build_module import (
|
||||
application,
|
||||
disk_images,
|
||||
package,
|
||||
sign_notarize
|
||||
sign_notarize,
|
||||
shim,
|
||||
autopkg
|
||||
)
|
||||
|
||||
|
||||
@@ -42,6 +44,8 @@ def main() -> None:
|
||||
# Local Build Parameters
|
||||
parser.add_argument("--reset-dmg-cache", action="store_true", help="Redownload PatcherSupportPkg.dmg and regenerate payloads.dmg", default=False)
|
||||
parser.add_argument("--reset-pyinstaller-cache", action="store_true", help="Clean PyInstaller Cache", default=False)
|
||||
parser.add_argument("--prepare-shim", action="store_true", help="Prepare Update Shim", default=False)
|
||||
parser.add_argument("--prepare-autopkg", action="store_true", help="Prepare AutoPkg Assets", default=False)
|
||||
|
||||
# Analytics Parameters
|
||||
parser.add_argument("--analytics-key", type=str, help="Analytics Key", default=None)
|
||||
@@ -97,6 +101,25 @@ def main() -> None:
|
||||
notarization_team_id=args.notarization_team_id,
|
||||
).sign_and_notarize()
|
||||
|
||||
# Build AutoPkg-Assets.pkg
|
||||
if args.prepare_autopkg:
|
||||
autopkg.GenerateAutoPkg().generate()
|
||||
|
||||
# Create Update Shim
|
||||
if args.prepare_shim:
|
||||
shim.GenerateShim().generate()
|
||||
if Path("dist/OpenCore-Patcher.app").exists():
|
||||
Path("dist/OpenCore-Patcher.app").rename("dist/OpenCore-Patcher-Core.app")
|
||||
Path("dist/OpenCore-Patcher (Shim).app").rename("dist/OpenCore-Patcher.app")
|
||||
|
||||
sign_notarize.SignAndNotarize(
|
||||
path=Path("dist/OpenCore-Patcher.app"),
|
||||
signing_identity=args.application_signing_identity,
|
||||
notarization_apple_id=args.notarization_apple_id,
|
||||
notarization_password=args.notarization_password,
|
||||
notarization_team_id=args.notarization_team_id,
|
||||
).sign_and_notarize()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
_start = time.time()
|
||||
|
||||
17
ci_tooling/build_module/autopkg.py
Normal file
17
ci_tooling/build_module/autopkg.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from pathlib import Path
|
||||
|
||||
from opencore_legacy_patcher.support import subprocess_wrapper
|
||||
|
||||
class GenerateAutoPkg:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._package_build_bin = "/usr/local/bin/packagesbuild"
|
||||
self._autopkg_config = "./ci_tooling/autopkg/AutoPkg-Assets-Setup.pkgproj"
|
||||
|
||||
|
||||
def generate(self) -> None:
|
||||
"""
|
||||
Generate AutoPkg Assets
|
||||
"""
|
||||
print("Generating AutoPkg Assets")
|
||||
subprocess_wrapper.run_and_verify([self._package_build_bin, self._autopkg_config])
|
||||
31
ci_tooling/build_module/shim.py
Normal file
31
ci_tooling/build_module/shim.py
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from opencore_legacy_patcher.support import subprocess_wrapper
|
||||
|
||||
|
||||
class GenerateShim:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._shim_path = "./ci_tooling/update_shim/OpenCore-Patcher.app"
|
||||
self._shim_pkg = f"{self._shim_path}/Contents/Resources/OpenCore-Patcher.pkg"
|
||||
|
||||
self._build_pkg = "./dist/OpenCore-Patcher.pkg"
|
||||
self._output_shim = "./dist/OpenCore-Patcher (Shim).app"
|
||||
|
||||
|
||||
def generate(self) -> None:
|
||||
"""
|
||||
Generate Update Shim
|
||||
"""
|
||||
print("Generating Update Shim")
|
||||
if Path(self._shim_pkg).exists():
|
||||
Path(self._shim_pkg).unlink()
|
||||
|
||||
subprocess_wrapper.run_and_verify(["/bin/cp", "-R", self._build_pkg, self._shim_pkg])
|
||||
|
||||
if Path(self._output_shim).exists():
|
||||
Path(self._output_shim).unlink()
|
||||
|
||||
subprocess_wrapper.run_and_verify(["/bin/cp", "-R", self._shim_path, self._output_shim])
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>OpenCore-Patcher</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>OpenCore-Patcher</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>OC-Patcher.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.dortania.opencore-legacy-patcher-helper</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>OpenCore-Patcher</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.10.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2020-2023 Dortania</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
ci_tooling/update_shim/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
Executable file
BIN
ci_tooling/update_shim/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
Executable file
Binary file not shown.
Binary file not shown.
8
ci_tooling/update_shim/README.md
Normal file
8
ci_tooling/update_shim/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# OpenCore-Patcher Update Shim
|
||||
|
||||
To handle the new PKG installation method, old versions of OpenCore Legacy Patcher updating to newer versions will still require 'OpenCore-Patcher.app' to be available for download.
|
||||
|
||||
Thus the goal of this app is to install an embedded PKG under ./OpenCore-Patcher.app/Contents/Resources/OpenCore-Patcher.pkg to handle the update process.
|
||||
|
||||
Source is available at:
|
||||
* https://github.com/dortania/OCLP-Helper
|
||||
@@ -385,8 +385,8 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
with open(self.constants.installer_sh_path, "r") as f:
|
||||
logging.info(f"installer.sh contents:\n{f.read()}")
|
||||
|
||||
args = [self.constants.oclp_helper_path, "/bin/sh", self.constants.installer_sh_path]
|
||||
result = subprocess.run(args, capture_output=True, text=True)
|
||||
args = ["/bin/sh", self.constants.installer_sh_path]
|
||||
result = subprocess_wrapper.run_as_root(args, capture_output=True, text=True)
|
||||
output = result.stdout
|
||||
error = result.stderr if result.stderr else ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user