CI: Add Uninstall PKG

This commit is contained in:
Mykola Grymalyuk
2024-05-21 19:36:33 -06:00
parent af44dcef8e
commit 0ef817566e
7 changed files with 140 additions and 13 deletions
+17 -2
View File
@@ -48,8 +48,8 @@ jobs:
# p12-file-base64: ${{ secrets.ORG_MAC_DEVELOPER_ID_INSTALLER_CERT_P12_BASE64 }}
# p12-password: ${{ secrets.ORG_MAC_DEVELOPER_ID_INSTALLER_CERT_P12_PASSWORD }}
- name: Install Dependencies
run: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -m pip install -r requirements.txt
# - name: Install Dependencies
# run: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -m pip install -r requirements.txt
# - name: Force Universal2 charset for Python
# run: |
@@ -91,6 +91,12 @@ jobs:
name: OpenCore-Patcher.pkg
path: ./dist/OpenCore-Patcher.pkg
- name: Upload Uninstaller Package to Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenCore-Patcher-Uninstaller.pkg
path: ./dist/OpenCore-Patcher-Uninstaller.pkg
- name: Upload Binary to Release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
@@ -116,4 +122,13 @@ jobs:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./dist/OpenCore-Patcher.pkg
tag: ${{ github.ref }}
file_glob: true
- name: Upload Uninstaller Package to Release
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@e74ff71f7d8a4c4745b560a485cc5fdb9b5b999d
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./dist/OpenCore-Patcher-Uninstaller.pkg
tag: ${{ github.ref }}
file_glob: true
+10 -1
View File
@@ -76,7 +76,7 @@ def main() -> None:
entitlements=Path("./ci_tooling/entitlements/entitlements.plist"),
).sign_and_notarize()
# Build OpenCore-Patcher.pkg
# Build OpenCore-Patcher.pkg and OpenCore-Patcher-Uninstaller.pkg
package.GeneratePackage().generate()
# Sign OpenCore-Patcher.pkg
@@ -88,6 +88,15 @@ def main() -> None:
notarization_team_id=args.notarization_team_id,
).sign_and_notarize()
# Sign OpenCore-Patcher-Uninstaller.pkg
sign_notarize.SignAndNotarize(
path=Path("dist/OpenCore-Patcher-Uninstaller.pkg"),
signing_identity=args.installer_signing_identity,
notarization_apple_id=args.notarization_apple_id,
notarization_password=args.notarization_password,
notarization_team_id=args.notarization_team_id,
).sign_and_notarize()
if __name__ == '__main__':
_start = time.time()
+31 -3
View File
@@ -17,9 +17,9 @@ class GeneratePackage:
}
def _generate_welcome(self) -> str:
def _generate_installer_welcome(self) -> str:
"""
Generate Welcome message for PKG
Generate Welcome message for installer PKG
"""
_welcome = ""
@@ -39,10 +39,38 @@ class GeneratePackage:
return _welcome
def _generate_uninstaller_welcome(self) -> str:
"""
Generate Welcome message for uninstaller PKG
"""
_welcome = ""
_welcome = "# Application Uninstaller\n"
_welcome += "This package will uninstall the OpenCore Legacy Patcher application and its Privileged Helper Tool from your system."
_welcome += "\n\n"
_welcome += "This will not remove any root patches or OpenCore configurations that you may have installed using OpenCore Legacy Patcher."
_welcome += "\n\n"
_welcome += f"For more information on OpenCore Legacy Patcher, see our [documentation]({constants.Constants().guide_link}) and [GitHub repository]({constants.Constants().repo_link})."
return _welcome
def generate(self) -> None:
"""
Generate OpenCore-Patcher.pkg
"""
print("Generating OpenCore-Patcher-Uninstaller.pkg")
assert macos_pkg_builder.Packages(
pkg_output="./dist/OpenCore-Patcher-Uninstaller.pkg",
pkg_bundle_id="com.dortania.opencore-legacy-patcher-uninstaller",
pkg_version=constants.Constants().patcher_version,
pkg_background="./ci_tooling/installation_pkg/PkgBackgroundUninstaller.png",
pkg_preinstall_script="./ci_tooling/installation_pkg/uninstall.sh",
pkg_as_distribution=True,
pkg_title="OpenCore Legacy Patcher Uninstaller",
pkg_welcome=self._generate_uninstaller_welcome(),
).build() is True
print("Generating OpenCore-Patcher.pkg")
assert macos_pkg_builder.Packages(
pkg_output="./dist/OpenCore-Patcher.pkg",
@@ -55,5 +83,5 @@ class GeneratePackage:
pkg_postinstall_script="./ci_tooling/installation_pkg/postinstall.sh",
pkg_file_structure=self._files,
pkg_title="OpenCore Legacy Patcher",
pkg_welcome=self._generate_welcome(),
pkg_welcome=self._generate_installer_welcome(),
).build() is True
Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

+4 -4
View File
@@ -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
}
+3 -3
View File
@@ -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
}
+75
View File
@@ -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