mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 06:10:00 +10:00
Merge pull request #893 from dortania/test-ga
Add Commit Data to binaries
This commit is contained in:
@@ -10,11 +10,15 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build Offline TUI
|
name: Build Offline TUI
|
||||||
runs-on: x86_64_mojave
|
runs-on: x86_64_mojave
|
||||||
|
env:
|
||||||
|
branch: ${{ github.event.ref }}
|
||||||
|
commiturl: ${{ github.event.head_commit.url }}
|
||||||
|
commitdate: ${{ github.event.head_commit.timestamp }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: python3 create_offline_build.py
|
- run: python3 create_offline_build.py
|
||||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
|
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
|
||||||
- run: python3 ./payloads/binary.py
|
- run: python3 ./payloads/binary.py $branch $commiturl $commitdate
|
||||||
- run: ./after_pyinstaller.sh
|
- run: ./after_pyinstaller.sh
|
||||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||||
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
|
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
|
||||||
|
|||||||
@@ -10,11 +10,15 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build wxPython Offline
|
name: Build wxPython Offline
|
||||||
runs-on: x86_64_mojave
|
runs-on: x86_64_mojave
|
||||||
|
env:
|
||||||
|
branch: ${{ github.event.ref }}
|
||||||
|
commiturl: ${{ github.event.head_commit.url }}
|
||||||
|
commitdate: ${{ github.event.head_commit.timestamp }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: python3 create_offline_build.py
|
- run: python3 create_offline_build.py
|
||||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher-GUI.spec
|
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher-GUI.spec
|
||||||
- run: python3 ./payloads/binary.py
|
- run: python3 ./payloads/binary.py $branch $commiturl $commitdate
|
||||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||||
- run: cd dist; zip -r ../OpenCore-Patcher-wxPython.app.zip OpenCore-Patcher.app
|
- run: cd dist; zip -r ../OpenCore-Patcher-wxPython.app.zip OpenCore-Patcher.app
|
||||||
- run: ./../sign-wxpython.sh
|
- run: ./../sign-wxpython.sh
|
||||||
|
|||||||
@@ -10,10 +10,14 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build wxPython
|
name: Build wxPython
|
||||||
runs-on: x86_64_mojave
|
runs-on: x86_64_mojave
|
||||||
|
env:
|
||||||
|
branch: ${{ github.event.ref }}
|
||||||
|
commiturl: ${{ github.event.head_commit.url }}
|
||||||
|
commitdate: ${{ github.event.head_commit.timestamp }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher-GUI.spec
|
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher-GUI.spec
|
||||||
- run: python3 ./payloads/binary.py
|
- run: python3 ./payloads/binary.py $branch $commiturl $commitdate
|
||||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||||
- run: cd dist; zip -r ../OpenCore-Patcher-wxPython.app.zip OpenCore-Patcher.app
|
- run: cd dist; zip -r ../OpenCore-Patcher-wxPython.app.zip OpenCore-Patcher.app
|
||||||
- run: ./../sign-wxpython.sh
|
- run: ./../sign-wxpython.sh
|
||||||
|
|||||||
@@ -10,10 +10,14 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build TUI
|
name: Build TUI
|
||||||
runs-on: x86_64_mojave
|
runs-on: x86_64_mojave
|
||||||
|
env:
|
||||||
|
branch: ${{ github.event.ref }}
|
||||||
|
commiturl: ${{ github.event.head_commit.url }}
|
||||||
|
commitdate: ${{ github.event.head_commit.timestamp }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
|
- run: /Library/Frameworks/Python.framework/Versions/3.9/bin/pyinstaller OpenCore-Patcher.spec
|
||||||
- run: python3 ./payloads/binary.py
|
- run: python3 ./payloads/binary.py $branch $commiturl $commitdate
|
||||||
- run: ./after_pyinstaller.sh
|
- run: ./after_pyinstaller.sh
|
||||||
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
- run: 'codesign -s "Developer ID Application: Mykola Grymalyuk (S74BDJXQMD)" -v --force --deep --timestamp --entitlements ./payloads/entitlements.plist -o runtime "dist/OpenCore-Patcher.app"'
|
||||||
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
|
- run: cd dist; zip -r ../OpenCore-Patcher-TUI.app.zip OpenCore-Patcher.app
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# -*- mode: python ; coding: utf-8 -*-
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
import sys, os, time
|
import sys, os, time, subprocess
|
||||||
sys.path.append(os.path.abspath(os.getcwd()))
|
sys.path.append(os.path.abspath(os.getcwd()))
|
||||||
from resources import constants
|
from resources import constants
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
@@ -51,4 +51,5 @@ app = BUNDLE(exe,
|
|||||||
"NSRequiresAquaSystemAppearance": False,
|
"NSRequiresAquaSystemAppearance": False,
|
||||||
"NSHighResolutionCapable": True,
|
"NSHighResolutionCapable": True,
|
||||||
"Build Date": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
|
"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(),
|
||||||
})
|
})
|
||||||
|
|||||||
+53
-21
@@ -1,22 +1,54 @@
|
|||||||
# Patches LC_VERSION_MIN_MACOSX in Load Command to report 10.10
|
# Handle Misc patching for binaries during commit
|
||||||
#
|
# This includes Load Command Patching as well as Info.plist patching
|
||||||
# By default Pyinstaller will create binaries supporting 10.13+
|
# Copyright (C) 2022 - Mykola Grymalyuk
|
||||||
# However this limitation is entirely arbitrary for our libraries
|
import sys
|
||||||
# and instead we're able to support 10.10 without issues.
|
import plistlib
|
||||||
#
|
from pathlib import Path
|
||||||
# To verify set version:
|
|
||||||
# otool -l ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
|
|
||||||
#
|
|
||||||
# cmd LC_VERSION_MIN_MACOSX
|
|
||||||
# cmdsize 16
|
|
||||||
# version 10.13
|
|
||||||
# sdk 10.9
|
|
||||||
|
|
||||||
path = './dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher'
|
def main():
|
||||||
find = b'\x00\x0D\x0A\x00' # 10.13 (0xA0D)
|
patch_load_command()
|
||||||
replace = b'\x00\x0A\x0A\x00' # 10.10 (0xA0A)
|
patch_info_plist()
|
||||||
with open(path, 'rb') as f:
|
|
||||||
data = f.read()
|
def patch_load_command():
|
||||||
data = data.replace(find, replace)
|
# Patches LC_VERSION_MIN_MACOSX in Load Command to report 10.10
|
||||||
with open(path, 'wb') as f:
|
#
|
||||||
f.write(data)
|
# By default Pyinstaller will create binaries supporting 10.13+
|
||||||
|
# However this limitation is entirely arbitrary for our libraries
|
||||||
|
# and instead we're able to support 10.10 without issues.
|
||||||
|
#
|
||||||
|
# To verify set version:
|
||||||
|
# otool -l ./dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
|
||||||
|
#
|
||||||
|
# cmd LC_VERSION_MIN_MACOSX
|
||||||
|
# cmdsize 16
|
||||||
|
# version 10.13
|
||||||
|
# sdk 10.9
|
||||||
|
print("- Patching LC_VERSION_MIN_MACOSX")
|
||||||
|
path = './dist/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher'
|
||||||
|
find = b'\x00\x0D\x0A\x00' # 10.13 (0xA0D)
|
||||||
|
replace = b'\x00\x0A\x0A\x00' # 10.10 (0xA0A)
|
||||||
|
with open(path, 'rb') as f:
|
||||||
|
data = f.read()
|
||||||
|
data = data.replace(find, replace)
|
||||||
|
with open(path, 'wb') as f:
|
||||||
|
f.write(data)
|
||||||
|
|
||||||
|
def patch_info_plist():
|
||||||
|
# Add Commit Data to Info.plist
|
||||||
|
print("- Updating Info.plist")
|
||||||
|
argsv = sys.argv
|
||||||
|
argsv.pop(0)
|
||||||
|
if argsv:
|
||||||
|
plist_path = './dist/OpenCore-Patcher.app/Contents/Info.plist'
|
||||||
|
plist = plistlib.load(Path(plist_path).open("rb"))
|
||||||
|
print("- Adding Github Dictionary")
|
||||||
|
plist["Github"] = {
|
||||||
|
"Branch": argsv[0],
|
||||||
|
"Commit URL": argsv[1],
|
||||||
|
"Commit Date": argsv[2],
|
||||||
|
}
|
||||||
|
print("- Writing Plist")
|
||||||
|
plistlib.dump(plist, Path(plist_path).open("wb"), sort_keys=True)
|
||||||
|
else:
|
||||||
|
print("- No commit data supplied, skipping")
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user