mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-18 05:34:42 +10:00
Add Commit Data to all builds
This commit is contained in:
@@ -1,16 +1,6 @@
|
||||
# Patches LC_VERSION_MIN_MACOSX in Load Command to report 10.10
|
||||
#
|
||||
# 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
|
||||
# Handle Misc patching for binaries during commit
|
||||
# This includes Load Command Patching as well as Info.plist patching
|
||||
# Copyright (C) 2022 - Mykola Grymalyuk
|
||||
import sys
|
||||
import plistlib
|
||||
from pathlib import Path
|
||||
@@ -19,8 +9,20 @@ def main():
|
||||
patch_load_command()
|
||||
patch_info_plist()
|
||||
|
||||
|
||||
def patch_load_command():
|
||||
# Patches LC_VERSION_MIN_MACOSX in Load Command to report 10.10
|
||||
#
|
||||
# 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)
|
||||
@@ -32,30 +34,22 @@ def patch_load_command():
|
||||
f.write(data)
|
||||
|
||||
def patch_info_plist():
|
||||
# Add Commit Data to Info.plist
|
||||
print("- Updating Info.plist")
|
||||
# Github Actions will supply us with the following environment variables:
|
||||
# - Commit Message
|
||||
# - Commit ID
|
||||
# - Branch
|
||||
# - Commit URL
|
||||
# - Commit Date
|
||||
|
||||
argsv = sys.argv
|
||||
argsv.pop(0)
|
||||
plist_path = './dist/OpenCore-Patcher.app/Contents/Info.plist'
|
||||
plist = plistlib.load(Path(plist_path).open("rb"))
|
||||
print("- Loaded Plist")
|
||||
# Add Github Dictonary
|
||||
print("- Adding Github Dictionary")
|
||||
plist["Github"] = {
|
||||
"Commit Message": argsv[0],
|
||||
"Commit ID": argsv[1],
|
||||
"Branch": argsv[2],
|
||||
"Commit URL": argsv[3],
|
||||
"Commit Date": argsv[4],
|
||||
}
|
||||
print("- Writing Plist")
|
||||
plistlib.dump(plist, Path(plist_path).open("wb"), sort_keys=True)
|
||||
|
||||
|
||||
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"] = {
|
||||
"Commit Message": argsv[0],
|
||||
"Branch": argsv[1],
|
||||
"Commit URL": argsv[2],
|
||||
"Commit Date": argsv[3],
|
||||
}
|
||||
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