mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-20 22:20:53 +10:00
CI: Add Uninstall PKG
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
@@ -20,7 +20,7 @@ shimAppPath="/Applications/OpenCore-Patcher.app"
|
||||
function _setSUIDBit() {
|
||||
local binaryPath=$1
|
||||
|
||||
echo " Setting SUID bit on: $binaryPath"
|
||||
echo "Setting SUID bit on: $binaryPath"
|
||||
|
||||
# Check if path is a directory
|
||||
if [[ -d $binaryPath ]]; then
|
||||
@@ -38,16 +38,16 @@ function _createAlias() {
|
||||
if [[ -e $aliasPath ]]; then
|
||||
# Check if alias path is a symbolic link
|
||||
if [[ -L $aliasPath ]]; then
|
||||
echo " Removing old symbolic link: $aliasPath"
|
||||
echo "Removing old symbolic link: $aliasPath"
|
||||
/bin/rm -f $aliasPath
|
||||
else
|
||||
echo " Removing old file: $aliasPath"
|
||||
echo "Removing old file: $aliasPath"
|
||||
/bin/rm -rf $aliasPath
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create symbolic link
|
||||
echo " Creating symbolic link: $aliasPath"
|
||||
echo "Creating symbolic link: $aliasPath"
|
||||
/bin/ln -s $mainPath $aliasPath
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ function _removeFile() {
|
||||
if [[ ! -e $file ]]; then
|
||||
# Check if file is a symbolic link
|
||||
if [[ -L $file ]]; then
|
||||
echo " Removing symbolic link: $file"
|
||||
echo "Removing symbolic link: $file"
|
||||
/bin/rm -f $file
|
||||
fi
|
||||
return
|
||||
fi
|
||||
|
||||
echo " Removing file: $file"
|
||||
echo "Removing file: $file"
|
||||
|
||||
# Check if file is a directory
|
||||
if [[ -d $file ]]; then
|
||||
@@ -49,7 +49,7 @@ function _createParentDirectory() {
|
||||
|
||||
# Check if parent directory exists
|
||||
if [[ ! -d $parentDirectory ]]; then
|
||||
echo " Creating parent directory: $parentDirectory"
|
||||
echo "Creating parent directory: $parentDirectory"
|
||||
/bin/mkdir -p $parentDirectory
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
#!/bin/zsh --no-rcs
|
||||
# ------------------------------------------------------
|
||||
# OpenCore Legacy Patcher PKG Uninstall Script
|
||||
# ------------------------------------------------------
|
||||
|
||||
|
||||
# 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 _cleanLaunchService() {
|
||||
local domain="com.dortania.opencore-legacy-patcher"
|
||||
|
||||
# Iterate over launch agents and daemons
|
||||
for launchServiceVariant in "/Library/LaunchAgents" "/Library/LaunchDaemons"; do
|
||||
# Check if directory exists
|
||||
if [[ ! -d $launchServiceVariant ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Iterate over launch service files
|
||||
for launchServiceFile in $(/bin/ls -1 $launchServiceVariant | /usr/bin/grep $domain); do
|
||||
local launchServicePath="$launchServiceVariant/$launchServiceFile"
|
||||
|
||||
# Remove launch service file
|
||||
_removeFile $launchServicePath
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function _main() {
|
||||
_cleanLaunchService
|
||||
for file in $filesToRemove; do
|
||||
_removeFile $file
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# MARK: Main
|
||||
# ---------------------------
|
||||
|
||||
echo "Starting uninstall script..."
|
||||
_main
|
||||
Reference in New Issue
Block a user