diff --git a/ci_tooling/installation_pkg/postinstall.sh b/ci_tooling/installation_pkg/postinstall.sh index 219f3d3dc..bd812ada7 100644 --- a/ci_tooling/installation_pkg/postinstall.sh +++ b/ci_tooling/installation_pkg/postinstall.sh @@ -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" } diff --git a/ci_tooling/installation_pkg/preinstall.sh b/ci_tooling/installation_pkg/preinstall.sh index 702618304..b94c341d8 100644 --- a/ci_tooling/installation_pkg/preinstall.sh +++ b/ci_tooling/installation_pkg/preinstall.sh @@ -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 } diff --git a/ci_tooling/installation_pkg/uninstall.sh b/ci_tooling/installation_pkg/uninstall.sh index 65a9da0cc..a837ac972 100644 --- a/ci_tooling/installation_pkg/uninstall.sh +++ b/ci_tooling/installation_pkg/uninstall.sh @@ -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 }