CI: Add PKG building support

This commit is contained in:
Mykola Grymalyuk
2024-05-21 10:42:11 -06:00
parent 952ac0de8c
commit e8233c3691
11 changed files with 664 additions and 12 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

@@ -0,0 +1,64 @@
#!/bin/zsh --no-rcs
# ------------------------------------------------------
# OpenCore Legacy Patcher PKG Post Install Script
# ------------------------------------------------------
# Set SUID bit on helper tool, and create app alias.
# ------------------------------------------------------
# MARK: Variables
# ---------------------------
helperPath="/Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper"
mainAppPath="/Library/Application Support/Dortania/OpenCore-Patcher.app"
shimAppPath="/Applications/OpenCore-Patcher.app"
# MARK: Functions
# ---------------------------
function _setSUIDBit() {
local binaryPath=$1
echo " Setting SUID bit on: $binaryPath"
# Check if path is a directory
if [[ -d $binaryPath ]]; then
/bin/chmod -R +s $binaryPath
else
/bin/chmod +s $binaryPath
fi
}
function _createAlias() {
local mainPath=$1
local aliasPath=$2
# Check if alias path exists
if [[ -e $aliasPath ]]; then
# Check if alias path is a symbolic link
if [[ -L $aliasPath ]]; then
echo " Removing old symbolic link: $aliasPath"
/bin/rm -f $aliasPath
else
echo " Removing old file: $aliasPath"
/bin/rm -rf $aliasPath
fi
fi
# Create symbolic link
echo " Creating symbolic link: $aliasPath"
/bin/ln -s $mainPath $aliasPath
}
function _main() {
_setSUIDBit $helperPath
_createAlias $mainAppPath $shimAppPath
}
# MARK: Main
# ---------------------------
echo "Starting postinstall script..."
_main
+69
View File
@@ -0,0 +1,69 @@
#!/bin/zsh --no-rcs
# ------------------------------------------------------
# OpenCore Legacy Patcher PKG Preinstall Script
# ------------------------------------------------------
# Remove old files, and prepare directories.
# ------------------------------------------------------
# MARK: Variables
# ---------------------------
filesToRemove=(
"/Applications/OpenCore-Patcher.app"
"/Library/Application Support/Dortania/Update.plist"
"/Library/Application Support/Dortania/OpenCore-Patcher.app"
"/Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper"
)
# MARK: Functions
# ---------------------------
function _removeFile() {
local file=$1
if [[ ! -e $file ]]; then
# Check if file is a symbolic link
if [[ -L $file ]]; then
echo " Removing symbolic link: $file"
/bin/rm -f $file
fi
return
fi
echo " Removing file: $file"
# Check if file is a directory
if [[ -d $file ]]; then
/bin/rm -rf $file
else
/bin/rm -f $file
fi
}
function _createParentDirectory() {
local file=$1
local parentDirectory=$(/usr/bin/dirname $file)
# Check if parent directory exists
if [[ ! -d $parentDirectory ]]; then
echo " Creating parent directory: $parentDirectory"
/bin/mkdir -p $parentDirectory
fi
}
function _main() {
for file in $filesToRemove; do
_removeFile $file
_createParentDirectory $file
done
}
# MARK: Main
# ---------------------------
echo "Starting preinstall script..."
_main