mirror of
https://github.com/Jackett/Jackett
synced 2025-03-06 19:58:38 +00:00
Fixing macOS agent installs (#13626)
Updates some legacy launchctl commands and adds a very short delay before installer checks whether agent was successfully launched
This commit is contained in:
parent
06ddc9d037
commit
280572b3aa
2 changed files with 11 additions and 5 deletions
|
@ -5,8 +5,11 @@ BOLDRED="$(printf '\033[1;31m')"
|
||||||
BOLDGREEN="$(printf '\033[1;32m')"
|
BOLDGREEN="$(printf '\033[1;32m')"
|
||||||
NC="$(printf '\033[0m')" # No Color
|
NC="$(printf '\033[0m')" # No Color
|
||||||
|
|
||||||
|
|
||||||
|
userid=$(id -u)
|
||||||
|
|
||||||
# Stop and unload the service if it's running
|
# Stop and unload the service if it's running
|
||||||
launchctl unload ~/Library/LaunchAgents/org.user.Jackett.plist &>/dev/null
|
launchctl bootout gui/${userid}/org.user.Jackett &>/dev/null
|
||||||
|
|
||||||
# Move working directory to Jackett's
|
# Move working directory to Jackett's
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
@ -64,11 +67,14 @@ if [[ $qstr ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the agent
|
# Run the agent
|
||||||
launchctl load ~/Library/LaunchAgents/org.user.Jackett.plist
|
echo "Launching agent..."
|
||||||
|
#launchctl load ~/Library/LaunchAgents/org.user.Jackett.plist
|
||||||
|
launchctl bootstrap gui/${userid} ~/Library/LaunchAgents/org.user.Jackett.plist
|
||||||
|
sleep .5
|
||||||
|
|
||||||
# Check that it's launched
|
# Check that it's loaded
|
||||||
userid=$(id -u)
|
|
||||||
if [[ $(launchctl list | grep org.user.Jackett) ]]; then
|
if [[ $(launchctl list | grep org.user.Jackett) ]]; then
|
||||||
|
# Check that service is running
|
||||||
if [[ $(launchctl print gui/${userid}/org.user.Jackett | grep 'state') =~ "running" ]]; then
|
if [[ $(launchctl print gui/${userid}/org.user.Jackett | grep 'state') =~ "running" ]]; then
|
||||||
echo "${BOLDGREEN}Agent successfully installed and running!${NC}"
|
echo "${BOLDGREEN}Agent successfully installed and running!${NC}"
|
||||||
echo "Jackett location: ${jackettdir}"
|
echo "Jackett location: ${jackettdir}"
|
||||||
|
|
|
@ -35,7 +35,7 @@ done
|
||||||
# Unload and delete agent
|
# Unload and delete agent
|
||||||
if [[ "$delagent" = true ]]; then
|
if [[ "$delagent" = true ]]; then
|
||||||
echo "Deleting agent..."
|
echo "Deleting agent..."
|
||||||
launchctl unload ~/Library/LaunchAgents/org.user.Jackett.plist
|
launchctl bootout gui/$(id -u)/org.user.Jackett
|
||||||
rm ~/Library/LaunchAgents/org.user.Jackett.plist
|
rm ~/Library/LaunchAgents/org.user.Jackett.plist
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue