1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-26 09:48:37 +00:00

Enhance the service installation on MacOS (#1793)

* Make the script self-executing

* Update script with colors

Since it’s self-executing, at least the output is more visible

* Changes to README

* Update Jackett.Console.csproj

* Clarify README
This commit is contained in:
thebluepotato 2017-09-08 17:12:47 +02:00 committed by kaso17
parent 3532a73d59
commit a2ae2d3384
3 changed files with 14 additions and 7 deletions

View file

@ -291,7 +291,8 @@ Install [Mono 4](http://www.mono-project.com/download/#download-mac) or better (
### Install as service
1. Download and extract the latest `Jackett.Binaries.Mono.tar.gz` release from the [releases page](https://github.com/Jackett/Jackett/releases).
2. In Terminal, run the install script from the extracted directory using `./install_service_macos.sh`
2. Open the extracted folder and double-click on `install_service_macos`.
3. If the installation was a success, you can close the Terminal window.
The service will start on each logon. You can always stop it by running `launchctl unload ~/Library/LaunchAgents/org.user.Jackett.plist` from Terminal. You can start it again it using `launchctl load ~/Library/LaunchAgents/org.user.Jackett.plist`.
Logs are stored as usual under `~/.config/Jackett/log.txt`.

View file

@ -153,7 +153,7 @@
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<Content Include="install_service_macos.sh">
<Content Include="install_service_macos">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

View file

@ -1,5 +1,10 @@
#!/bin/bash
#Setting up colors
BOLDRED="$(printf '\033[1;31m')"
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
@ -8,18 +13,18 @@ cd "$(dirname "$0")"
# Check if we're running from Jackett's directory
if [ ! -f ./JackettConsole.exe ]; then
echo "Couldn't locate JackettConsole.exe. Is the script in the right directory?"
echo "${BOLDRED}ERROR${NC}: Couldn't locate JackettConsole.exe. Is the script in the right directory?"
exit 1
fi
jackettdir="$(pwd)"
# Check if mono is installed
command -v mono >/dev/null 2>&1 || { echo >&2 "Jackett requires Mono but it's not installed. Aborting."; exit 1; }
command -v mono >/dev/null 2>&1 || { echo >&2 "${BOLDRED}ERROR${NC}: Jackett requires Mono but it's not installed. Aborting."; exit 1; }
monodir="$(dirname $(command -v mono))"
# Check that no other service called Jackett is already running
if [[ $(launchctl list | grep org.user.Jackett) ]]; then
echo "Jackett already seems to be running as a service. Please stop it before running this script again."
echo "${BOLDRED}ERROR${NC}: Jackett already seems to be running as a service. Please stop it before running this script again."
exit 1
fi
@ -59,12 +64,13 @@ launchctl load ~/Library/LaunchAgents/org.user.Jackett.plist
# Check that it's running
if [[ $(launchctl list | grep org.user.Jackett) ]]; then
echo "Agent successfully installed and launched!"
echo "${BOLDGREEN}Agent successfully installed and launched!${NC}"
else
cat << EOL
Could not launch agent. The installation might have failed.
${BOLDRED}ERROR${NC}: Could not launch agent. The installation might have failed.
Please open an issue on https://github.com/Jackett/Jackett/issues and paste following information:
Mono directory: \`${monodir}\`
Jackett directory: \`${jackettdir}\`
EOL
fi