1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-22 07:43:13 +00:00

Create uninstall script for macOS (#8936)

This commit is contained in:
thebluepotato 2020-06-18 21:00:00 +02:00 committed by GitHub
parent 960068af35
commit c3bb53c02a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 3 deletions

View file

@ -180,7 +180,9 @@ stages:
condition: and(succeeded(), startsWith(variables['buildDescription'], 'macOS'))
inputs:
SourceFolder: $(Build.SourcesDirectory)
contents: install_service_macos
contents: |
install_service_macos
uninstall_jackett_macos
targetFolder: $(Build.BinariesDirectory)/Jackett
- task: CopyFiles@2
@ -229,6 +231,7 @@ stages:
chmod 755 JackettUpdater
if [ -f install_service_systemd_mono.sh ]; then chmod 755 install_service_systemd_mono.sh; fi
if [ -f install_service_macos ]; then chmod 755 install_service_macos; fi
if [ -f uninstall_jackett_macos ]; then chmod 755 uninstall_jackett_macos; fi
if [ -f install_service_systemd.sh ]; then chmod 755 install_service_systemd.sh; fi
if [ -f jackett_launcher.sh ]; then chmod 755 jackett_launcher.sh; fi

View file

@ -311,8 +311,8 @@ namespace Jackett.Common.Services
if (variant == Variants.JackettVariant.CoreMacOs)
{
var macosServicePath = tempDir + "/Jackett/install_service_macos";
filePermissionService.MakeFileExecutable(macosServicePath);
filePermissionService.MakeFileExecutable(tempDir + "/Jackett/install_service_macos");
filePermissionService.MakeFileExecutable(tempDir + "/Jackett/uninstall_jackett_macos");
}
else if (variant == Variants.JackettVariant.Mono)
{

59
uninstall_jackett_macos Executable file
View file

@ -0,0 +1,59 @@
#!/bin/zsh
#Setting up colors
BOLDRED="$(printf '\033[1;31m')"
BOLDGREEN="$(printf '\033[1;32m')"
NC="$(printf '\033[0m')" # No Color
# Move working directory to Jackett's
cd "$(dirname "$0")"
# Check if we're running from Jackett's directory
if [ ! -f ./jackett ]; then
echo "${BOLDRED}ERROR${NC}: Couldn't locate ./jackett - Is the script in the right directory?"
exit 1
fi
jackettdir="$(pwd)"
echo "This script will uninstall Jackett. Do you want to proceed?"
select yn in "Yes" "No"; do
case $yn in
Yes ) break;;
No ) exit;;
esac
done
echo "What should be removed? ${BOLDRED}WARNING${NC}: deleting binaries will remove all files located in ${jackettdir}. ${BOLDRED}WARNING${NC}: deleting config files prevents Jackett from being reinstalled."
select yn in "Only agent" "Only agent and binaries" "Agent, binaries and config"; do
case $yn in
"Only agent" ) delagent=true; break;;
"Only agent and binaries" ) delagent=true; delbin=true; break;;
"Agent, binaries and config" ) delagent=true; delbin=true; delconf=true; break;;
esac
done
# Unload and delete agent
if [[ "$delagent" = true ]]; then
echo "Deleting agent..."
launchctl unload ~/Library/LaunchAgents/org.user.Jackett.plist
rm ~/Library/LaunchAgents/org.user.Jackett.plist
fi
# Deleting the current folder
if [[ "$delbin" = true ]]; then
echo "Deleting binaries..."
rm -R $jackettdir
else
echo "Binaries have not been deleted from ${jackettdir}"
fi
# Remove config files
if [[ "$delconf" = true ]]; then
echo "Deleting config files..."
rm -R ~/.config/Jackett/
else
echo "Configuration files have been kept in ~/.config/Jackett/"
fi
echo "${BOLDGREEN}Uninstall completed.${NC}"