Skip to content

Commit

Permalink
Added Lidarr
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyE123 authored Apr 30, 2018
1 parent 26c2b65 commit 1b98ba2
Show file tree
Hide file tree
Showing 21 changed files with 275 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Features features of AtoMiC ToolKit include:
<li>Jackett - Install, Uninstall, Update and Backup / Restore</li>
<li>Kodi - Install, Uninstall Autoboot enable and Update</li>
<li>Lazy Librarian - Install, Uninstall, Reset Password, Update and Backup / Restore</li>
<li>Lidarr - Install, Uninstall, Update and Backup / Restore</li>
<li>Madsonic - Install, Uninstall, Update and Backup / Restore</li>
<li>Medusa - Install, Uninstall, Update and Backup / Restore</li>
<li>Muximux - Install, Uninstall, Update</li>
Expand Down
3 changes: 3 additions & 0 deletions batch-processes/bat-apps-install-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ source "$SCRIPTPATH/setup.sh" -u headphones
# source "$SCRIPTPATH/setup.sh" -i lazylibrarian # Init.d script broken
# source "$SCRIPTPATH/setup.sh" -x lazylibrarian
# source "$SCRIPTPATH/setup.sh" -u lazylibrarian
source "$SCRIPTPATH/setup.sh" -i lidarr
# source "$SCRIPTPATH/setup.sh" -x lidarr
source "$SCRIPTPATH/setup.sh" -u lidarr
source "$SCRIPTPATH/setup.sh" -i madsonic
# source "$SCRIPTPATH/setup.sh" -x madsonic
source "$SCRIPTPATH/setup.sh" -u madsonic
Expand Down
1 change: 1 addition & 0 deletions batch-processes/bat-apps-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ source "$SCRIPTPATH/setup.sh" -i htpcmanager
source "$SCRIPTPATH/setup.sh" -i jackett
source "$SCRIPTPATH/setup.sh" -i kodi
source "$SCRIPTPATH/setup.sh" -i lazylibrarian
source "$SCRIPTPATH/setup.sh" -i lidarr
source "$SCRIPTPATH/setup.sh" -i madsonic
source "$SCRIPTPATH/setup.sh" -i medusa
source "$SCRIPTPATH/setup.sh" -i muximux
Expand Down
1 change: 1 addition & 0 deletions batch-processes/bat-apps-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ source "$SCRIPTPATH/setup.sh" -u htpcmanager
source "$SCRIPTPATH/setup.sh" -u jackett
source "$SCRIPTPATH/setup.sh" -u kodi
source "$SCRIPTPATH/setup.sh" -u lazylibrarian
source "$SCRIPTPATH/setup.sh" -u lidarr
source "$SCRIPTPATH/setup.sh" -u madsonic
source "$SCRIPTPATH/setup.sh" -u medusa
source "$SCRIPTPATH/setup.sh" -u muximux
Expand Down
1 change: 1 addition & 0 deletions batch-processes/bat-apps-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ source "$SCRIPTPATH/setup.sh" -m htpcmanager
source "$SCRIPTPATH/setup.sh" -m jackett
source "$SCRIPTPATH/setup.sh" -m kodi
source "$SCRIPTPATH/setup.sh" -m lazylibrarian
source "$SCRIPTPATH/setup.sh" -m lidarr
source "$SCRIPTPATH/setup.sh" -m madsonic
source "$SCRIPTPATH/setup.sh" -m medusa
source "$SCRIPTPATH/setup.sh" -m muximux
Expand Down
2 changes: 2 additions & 0 deletions lidarr/lidarr-backup-files
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APPSETTINGS
APPSETTINGSDB
21 changes: 21 additions & 0 deletions lidarr/lidarr-constants.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

APPNAME='lidarr'
APPSHORTNAME='lr'
APPPATH='/opt/lidarr'
APPTITLE='Lidarr'
APPDEPS='libmono-cil-dev'
APPDOWNLOADURL='https://api.github.com/repos/lidarr/lidarr/releases'
APPDOWNLOADEXT='linux.tar.gz'
APPDOWNLOADSTRIP='--strip-components=1'
APPDPORT='8686'
APPSETTINGSTYPE='DB'
APPSETTINGSDIR="/home/$UNAME/.config/Lidarr"
APPSETTINGS=$APPSETTINGSDIR'/config.xml'
APPSETTINGSDB=$APPSETTINGSDIR'/lidarr.db'
PORTSEARCH='<port>'
DBUSERSEARCH='SELECT Username FROM Users WHERE Id = 1;'
APPSYSTEMD='lidarr.service'
APPSYSTEMDLOC=$SCRIPTPATH'/lidarr/'$APPSYSTEMD
APPINITD='lidarr'
APPINITDLOC=$SCRIPTPATH'/lidarr/lidarr.init'
3 changes: 3 additions & 0 deletions lidarr/lidarr-folders-list
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/opt/lidarr
/home/UNAME/.config
/home/UNAME/.config/Lidarr
7 changes: 7 additions & 0 deletions lidarr/lidarr-init-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# Script Name: AtoMiC Lidarr init.d update

echo 'Updating init.d file'

ReplaceString "RUNASUSER=root" "RUNASUSER=$UNAME" "/etc/init.d/$APPINITD"
ReplaceString "RUNASGROUP=root" "RUNASGROUP=$UGROUP" "/etc/init.d/$APPINITD"
19 changes: 19 additions & 0 deletions lidarr/lidarr-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Script Name: AtoMiC Lidarr Installer

source "$SCRIPTPATH/inc/header.sh"
echo -e "${GREEN}AtoMiC $APPTITLE Installer Script$ENDCOLOR"
source "$SCRIPTPATH/inc/pause.sh"
source "$SCRIPTPATH/inc/app-autostart-remove.sh"
source "$SCRIPTPATH/inc/app-move-previous.sh"
source "$SCRIPTPATH/utils/mono/mono-installer.sh"
source "$SCRIPTPATH/lidarr/lidarr-constants.sh"
source "$SCRIPTPATH/inc/app-install-deps.sh"
source "$SCRIPTPATH/inc/app-folders-create.sh"
source "$SCRIPTPATH/inc/app-git-download-release.sh"
source "$SCRIPTPATH/inc/app-autostart-configure.sh"
source "$SCRIPTPATH/inc/app-set-permissions.sh"
source "$SCRIPTPATH/inc/app-start.sh"
source "$SCRIPTPATH/inc/app-install-confirmation.sh"
source "$SCRIPTPATH/inc/thankyou.sh"
source "$SCRIPTPATH/inc/exit.sh"
37 changes: 37 additions & 0 deletions lidarr/lidarr-menu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
# Script Name: AtoMiC Lidarr Menu

SUBCHOICE=$(whiptail --title "AtoMiC Toolkit - Manage Lidarr" \
--menu "What would you like to do?" --backtitle "$BACKTITLE" \
--fb --cancel-button "Exit" $LINES $COLUMNS "$NETLINES" \
"Install" "Install Lidarr" \
"Uninstall" "Uninstall Lidarr" \
"Backup" "Backup Lidarr settings" \
"Restore" "Restore Lidarr settings from a previous backup" \
"Manual Update" "Manually update Lidarr" \
"Enable Reverse Proxy" "Allow access" \
"Disable Reverse Proxy" "Remove access" \
"Access Details" "View Lidarr access details" \
"Go Back" "Back to Main Menu" 3>&1 1>&2 2>&3)

exitstatus=$?
if [[ $exitstatus = 0 ]]; then
source "$SCRIPTPATH/lidarr/lidarr-constants.sh"
case "$SUBCHOICE" in
"Install" ) source "$SCRIPTPATH/$APPNAME/$APPNAME-installer.sh" ;;
"Uninstall" ) source "$SCRIPTPATH/$APPNAME/$APPNAME-uninstaller.sh" ;;
"Backup" ) source "$SCRIPTPATH/inc/app-backup-controller.sh" ;;
"Restore" ) source "$SCRIPTPATH/inc/app-restore-controller.sh" ;;
"Manual Update" ) source "$SCRIPTPATH/$APPNAME/$APPNAME-update.sh" ;;
"Enable Reverse Proxy" ) source "$SCRIPTPATH/utils/nginx/nginx-enable-location.sh" ;;
"Disable Reverse Proxy" ) source "$SCRIPTPATH/utils/nginx/nginx-disable-location.sh" ;;
"Access Details" ) source "$SCRIPTPATH/inc/app-access-details.sh" ;;
"Go Back" ) source "$SCRIPTPATH/menus/menu-pvrs.sh" ;;
*) source "$SCRIPTPATH/inc/invalid-option.sh" ;;
esac
else
source "$SCRIPTPATH/inc/thankyou.sh"
echo
sleep 1
exit 0
fi
4 changes: 4 additions & 0 deletions lidarr/lidarr-reverse-proxy-disable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# Script Name: AtoMiC Lidarr Reverse Proxy Disable.

ReplaceString "<UrlBase>lidarr</UrlBase>" "<UrlBase></UrlBase>" "$APPSETTINGS"
4 changes: 4 additions & 0 deletions lidarr/lidarr-reverse-proxy-enable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# Script Name: AtoMiC Lidarr Reverse Proxy Enable.

ReplaceString "<UrlBase></UrlBase>" "<UrlBase>lidarr</UrlBase>" "$APPSETTINGS"
8 changes: 8 additions & 0 deletions lidarr/lidarr-systemd-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# Script Name: AtoMiC Sonarr Systemd Update

ReplaceString "User=ReplaceMe" "User=$UNAME" "/etc/systemd/system/$APPSYSTEMD"
ReplaceString "Group=ReplaceMe" "Group=$UGROUP" "/etc/systemd/system/$APPSYSTEMD"

sudo systemctl daemon-reload
sudo systemctl enable "$APPSYSTEMD"
11 changes: 11 additions & 0 deletions lidarr/lidarr-uninstaller.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Script Name: AtoMiC Lidarr Uninstaller

source "$SCRIPTPATH/inc/header.sh"
echo -e "${GREEN}AtoMiC $APPTITLE Uninstaller Script$ENDCOLOR"
source "$SCRIPTPATH/inc/pause.sh"
source "$SCRIPTPATH/inc/app-autostart-remove.sh"
source "$SCRIPTPATH/inc/app-file-del.sh"
source "$SCRIPTPATH/inc/app-uninstall-confirmation.sh"
source "$SCRIPTPATH/inc/thankyou.sh"
source "$SCRIPTPATH/inc/exit.sh"
21 changes: 21 additions & 0 deletions lidarr/lidarr-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Script Name: AtoMiC Lidarr Updater

source "$SCRIPTPATH/inc/header.sh"
echo -e "${GREEN}AtoMiC $APPTITLE Update Script$ENDCOLOR"
source "$SCRIPTPATH/inc/pause.sh"

if DoesAppFolderExist; then
source "$SCRIPTPATH/inc/app-stop.sh"
source "$SCRIPTPATH/utils/mono/mono-installer.sh"
source "$SCRIPTPATH/lidarr/lidarr-constants.sh"
source "$SCRIPTPATH/inc/app-install-deps.sh"
if "$SCRIPTPATH/lidarr/lidarr-version-handler.sh"; then
source "$SCRIPTPATH/inc/app-git-download-release.sh"
fi
source "$SCRIPTPATH/inc/app-set-permissions.sh"
source "$SCRIPTPATH/inc/app-start.sh"
source "$SCRIPTPATH/inc/app-update-confirmation.sh"
source "$SCRIPTPATH/inc/thankyou.sh"
fi
source "$SCRIPTPATH/inc/exit.sh"
13 changes: 13 additions & 0 deletions lidarr/lidarr-version-handler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Script Name: AtoMiC Lidarr Version Check

echo
source "$SCRIPTPATH/inc/commons.sh"
source "$SCRIPTPATH/lidarr/lidarr-constants.sh"
echo -e "${YELLOW}--->Lidarr Version Check...$ENDCOLOR"
source "$SCRIPTPATH/inc/app-git-latest-release-version.sh"
echo -e "Available Version: ${GREEN}$AVAILABLEVERSION$ENDCOLOR"

if ! checkappversion "LIDARR" "$AVAILABLEVERSION" ; then
exit 1
fi
94 changes: 94 additions & 0 deletions lidarr/lidarr.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

### BEGIN INIT INFO
# Provides: lidarr
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: lidarr
# Description: Lidarr
### END INIT INFO

. /lib/lsb/init-functions

#set -e

NAME=lidarr
DESC="Lidarr"
MONO=$(which mono)

DAEMON=/opt/lidarr/Lidarr.exe
DAEMONOPTS=""

PIDDIR=/var/run/${NAME}
PIDFILE=${PIDDIR}/${NAME}.pid

RUNASUSER=root
RUNASGROUP=root
RUNAS=$RUNASUSER:$RUNASGROUP

DATADIR=/home/$RUNASUSER/

if ! [ -r ${DAEMON} ]; then echo "Can't read: ${DAEMON}" 2>&1; exit 1; fi
if ! [ -x ${MONO} ]; then echo "Not executable: ${MONO}" 2>&1; exit 1; fi
if ! [ -d ${DATADIR} ]; then echo "No such directory: ${DATADIR}" 2>&1; exit 1; fi

if [ ! -d ${PIDDIR} ]; then
mkdir -p ${PIDDIR}; chown ${RUNASUSER}:root ${PIDDIR}; chmod 0750 ${PIDDIR};
fi

do_start() {
RETVAL=1
if [ -e ${PIDFILE} ]; then
if ! kill -0 $(cat ${PIDFILE}) &> /dev/null; then
rm -f $PIDFILE
fi
fi

log_daemon_msg "Starting ${DESC}" "${NAME}"
if pgrep -f "^${MONO} ${DAEMON}" > /dev/null 2>&1; then
log_progress_msg "(already running?)"
else
start-stop-daemon -q -d ${DATADIR} -c $RUNAS --start --background --make-pidfile --pidfile $PIDFILE --exec $MONO -- $DAEMON $DAEMON_OPTS
RETVAL=$?
fi
log_end_msg $RETVAL
}
do_stop() {
RETVAL=1
log_daemon_msg "Stopping ${DESC}" "${NAME}"
if ! pgrep -f "^${MONO} ${DAEMON}" > /dev/null 2>&1; then
log_progress_msg "(not running?)"
else
start-stop-daemon -q --stop --pidfile $PIDFILE --retry 15
RETVAL=$?
fi
log_end_msg $RETVAL

}

case "$1" in
start)
do_start
;;
stop)
do_stop
;;

status)
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
;;

restart|force-reload)
do_stop;
do_start;
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2
exit 1
;;
esac

exit 0
16 changes: 16 additions & 0 deletions lidarr/lidarr.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Lidarr
After=syslog.target network.target

[Service]
User=ReplaceMe
Group=ReplaceMe

Type=simple
ExecStart=/usr/bin/mono /opt/lidarr/Lidarr.exe -nobrowser
TimeoutStopSec=20
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions menus/menu-pvrs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SUBCHOICE=$(whiptail --title "AtoMiC ToolKit - htpcBeginner.com" \
"CouchPotato" "Movies PVR Client" \
"Headphones" "Music PVR Client" \
"Lazy Librarian" "Book PVR Client" \
"Lidarr" "Like Sonarr but made for music" \
"Medusa" "Automatic Video Library Manager for TV Shows" \
"Mylar" "Comics PVR Client" \
"Radarr" "Works with movies à la Couchpotato" \
Expand All @@ -26,6 +27,8 @@ if [[ $exitstatus = 0 ]]; then
source "$SCRIPTPATH/headphones/headphones-menu.sh" ;;
"Lazy Librarian" )
source "$SCRIPTPATH/lazylibrarian/lazylibrarian-menu.sh" ;;
"Lidarr" )
source "$SCRIPTPATH/lidarr/lidarr-menu.sh" ;;
"Medusa" )
source "$SCRIPTPATH/medusa/medusa-menu.sh" ;;
"Mylar" )
Expand Down
5 changes: 5 additions & 0 deletions utils/nginx/locations-available/lidarr.atomic.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Version=1.0
location /lidarr/
{
proxy_pass http://127.0.0.1:8686;
}

0 comments on commit 1b98ba2

Please sign in to comment.