Skip to content

Instantly share code, notes, and snippets.

@rlagmlah
Last active August 31, 2021 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlagmlah/299638f43ce3344e4d7ec64fa9be2a4f to your computer and use it in GitHub Desktop.
Save rlagmlah/299638f43ce3344e4d7ec64fa9be2a4f to your computer and use it in GitHub Desktop.
Script to manually install Sonarr, Jackett, Radarr on TrueNAS 12.
#!/usr/local/bin/bash
echo Insatll Jackett
echo Download Jackett.tar.gz
_jackett_last_version=`curl --silent "https://api.github.com/repos/Jackett/Jackett/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'`
_fetch_url="https://github.com/Jackett/Jackett/releases/download/${_jackett_last_version}/Jackett.Binaries.Mono.tar.gz"
fetch ${_fetch_url} -o /tmp/jackett.tar.gz
if [ -d /usr/local/share/jackett ]; then
echo Remove existing directory
rm -r /usr/local/share/jackett
fi
echo Install...
tar -xzf /tmp/jackett.tar.gz -C /usr/local/share
mv /usr/local/share/Jackett /usr/local/share/jackett
rm /tmp/jackett.tar.gz
if [ ! -d /usr/local/jackett ]; then
echo create jackett data directory
mkdir -p /usr/local/jackett
fi
echo Install Sonarr
echo Download Sonarr.tar.gz
fetch "https://services.sonarr.tv/v1/download/main/latest?version=3&os=linux" -o /tmp/sonarr.tar.gz
echo Install...
tar -xzf /tmp/sonarr.tar.gz -C /usr/local/share
if [ -d /usr/local/share/sonarr ]; then
echo Remove existing directory
rm -r /usr/local/share/sonarr
fi
mv /usr/local/share/Sonarr /usr/local/share/sonarr
rm /tmp/sonarr.tar.gz
if [ ! -d /usr/local/sonarr ]; then
echo create sonarr data directory
mkdir -p /usr/local/sonarr
fi
echo Install Radarr
echo Download Radarr.tar.gz
_radarr_last_version=`curl --silent "https://api.github.com/repos/Radarr/Radarr/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's/v//'`
_fetch_url="https://github.com/Radarr/Radarr/releases/download/v${_radarr_last_version}/Radarr.master.${_radarr_last_version}.linux.tar.gz"
fetch ${_fetch_url} -o /tmp/radarr.tar.gz
echo Install...
tar -xzf /tmp/radarr.tar.gz -C /usr/local/share
if [ -d /usr/local/share/radarr ]; then
echo Remove existing directory
rm -r /usr/local/share/radarr
fi
mv /usr/local/share/Radarr /usr/local/share/radarr
rm /tmp/radarr.tar.gz
if [ ! -d /usr/local/radarr ]; then
echo create radarr data directory
mkdir -p /usr/local/radarr
fi
if ! id -u sonarr >/dev/null 2>&1; then
pw groupadd sonarr -g 351
pw user add sonarr -m -d /nonexistent -s /usr/sbin/nologin -u 351 -g sonarr -c "Sonarr PVR"
fi
if ! id -u radarr >/dev/null 2>&1; then
pw groupadd radarr -g 352
pw user add radarr -m -d /nonexistent -s /usr/sbin/nologin -u 352 -g radarr -c "Radarr Daemon"
fi
if ! id -u jackett >/dev/null 2>&1; then
pw groupadd jackett -g 354
pw user add jackett -m -d /nonexistent -s /usr/sbin/nologin -u 354 -g jackett -c "Jackett Torznab Proxy Daemon"
fi
echo Set permissions
chown -R jackett:jackett /usr/local/share/jackett /usr/local/jackett
chown -R radarr:radarr /usr/local/radarr/ /usr/local/radarr
chown -R sonarr:sonarr /usr/local/sonarr/ /usr/local/sonarr
echo Download rc.d script
fetch https://gist.githubusercontent.com/rlagmlah/6f6e6b69eeae1cac14185aaa86fea40c/raw/98aa762b22705f2687c14c8c9382e827ef7a5672/jackett -o /usr/local/etc/rc.d/jackett
fetch https://gist.githubusercontent.com/rlagmlah/6f6e6b69eeae1cac14185aaa86fea40c/raw/98aa762b22705f2687c14c8c9382e827ef7a5672/radarr -o /usr/local/etc/rc.d/radarr
fetch https://gist.githubusercontent.com/rlagmlah/6f6e6b69eeae1cac14185aaa86fea40c/raw/98aa762b22705f2687c14c8c9382e827ef7a5672/sonarr -o /usr/local/etc/rc.d/sonarr
chmod +x /usr/local/etc/rc.d/sonarr /usr/local/etc/rc.d/radarr /usr/local/etc/rc.d/jackett
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment