macos: Update install_service_macos (#8933)

This commit is contained in:
thebluepotato 2020-06-10 06:24:12 +02:00 committed by GitHub
parent e0310f2367
commit f0a4766c83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -6,7 +6,7 @@ BOLDGREEN="$(printf '\033[1;32m')"
NC="$(printf '\033[0m')" # No Color
# Stop and unload the service if it's running
launchctl remove org.user.Jackett
launchctl unload ~/Library/LaunchAgents/org.user.Jackett.plist &>/dev/null
# Move working directory to Jackett's
cd "$(dirname "$0")"
@ -55,18 +55,20 @@ cat >~/Library/LaunchAgents/org.user.Jackett.plist <<EOL
EOL
# Un-quarantine all dylib and DLL files
echo "Removing Jackett executable and all .dylib and .dll files from quarantine..."
qstr="$(xattr -p com.apple.quarantine jackett)"
qstr="00c1${qstr:4}"
xattr -w com.apple.quarantine $qstr jackett
xattr -w com.apple.quarantine $qstr *.{dylib,dll}
qstr="$(xattr -p com.apple.quarantine jackett)" 2>/dev/null
if [[ $qstr ]]; then
echo "Removing Jackett executable and all .dylib and .dll files from quarantine..."
qstr="00c1${qstr:4}"
xattr -w com.apple.quarantine $qstr jackett
xattr -w com.apple.quarantine $qstr *.{dylib,dll}
fi
# Run the agent
launchctl load ~/Library/LaunchAgents/org.user.Jackett.plist
# Check that it's running
if [[ $(launchctl list | grep org.user.Jackett) ]]; then
echo "${BOLDGREEN}Agent successfully installed and launched!${NC}"
echo "${BOLDGREEN}Agent successfully installed and launched!${NC}"
else
cat << EOL
${BOLDRED}ERROR${NC}: Could not launch agent. The installation might have failed.