mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-11 16:27:19 +10:00
PKG Scripts: Add PackageKit parameters
This commit is contained in:
@@ -5,13 +5,22 @@
|
||||
# Set SUID bit on helper tool, and create app alias.
|
||||
# ------------------------------------------------------
|
||||
|
||||
# MARK: PackageKit Parameters
|
||||
# ---------------------------
|
||||
|
||||
pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall
|
||||
pathToPackage=$1 # ex. ~/Downloads/Installer.pkg
|
||||
pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)
|
||||
pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc
|
||||
pathToStartupDisk=$4 # ex. '/'
|
||||
|
||||
|
||||
# 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"
|
||||
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
|
||||
@@ -52,8 +61,8 @@ function _createAlias() {
|
||||
}
|
||||
|
||||
function _main() {
|
||||
_setSUIDBit $helperPath
|
||||
_createAlias $mainAppPath $shimAppPath
|
||||
_setSUIDBit "$pathToTargetVolume/$helperPath"
|
||||
_createAlias "$pathToTargetVolume/$mainAppPath" "$pathToTargetVolume/$shimAppPath"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,14 +6,24 @@
|
||||
# ------------------------------------------------------
|
||||
|
||||
|
||||
# MARK: PackageKit Parameters
|
||||
# ---------------------------
|
||||
|
||||
pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall
|
||||
pathToPackage=$1 # ex. ~/Downloads/Installer.pkg
|
||||
pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)
|
||||
pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc
|
||||
pathToStartupDisk=$4 # ex. '/'
|
||||
|
||||
|
||||
# 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"
|
||||
"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"
|
||||
)
|
||||
|
||||
|
||||
@@ -56,8 +66,8 @@ function _createParentDirectory() {
|
||||
|
||||
function _main() {
|
||||
for file in $filesToRemove; do
|
||||
_removeFile $file
|
||||
_createParentDirectory $file
|
||||
_removeFile $pathToTargetVolume/$file
|
||||
_createParentDirectory $pathToTargetVolume/$file
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,24 @@
|
||||
# ------------------------------------------------------
|
||||
|
||||
|
||||
# MARK: PackageKit Parameters
|
||||
# ---------------------------
|
||||
|
||||
pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall
|
||||
pathToPackage=$1 # ex. ~/Downloads/Installer.pkg
|
||||
pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)
|
||||
pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc
|
||||
pathToStartupDisk=$4 # ex. '/'
|
||||
|
||||
|
||||
# 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"
|
||||
"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"
|
||||
)
|
||||
|
||||
|
||||
@@ -44,7 +54,7 @@ function _cleanLaunchService() {
|
||||
local domain="com.dortania.opencore-legacy-patcher"
|
||||
|
||||
# Iterate over launch agents and daemons
|
||||
for launchServiceVariant in "/Library/LaunchAgents" "/Library/LaunchDaemons"; do
|
||||
for launchServiceVariant in "$pathToTargetVolume/Library/LaunchAgents" "$pathToTargetVolume/Library/LaunchDaemons"; do
|
||||
# Check if directory exists
|
||||
if [[ ! -d $launchServiceVariant ]]; then
|
||||
continue
|
||||
@@ -63,7 +73,7 @@ function _cleanLaunchService() {
|
||||
function _main() {
|
||||
_cleanLaunchService
|
||||
for file in $filesToRemove; do
|
||||
_removeFile $file
|
||||
_removeFile "$pathToTargetVolume/$file"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user