forked from anandslab/AtoMiC-ToolKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
APPSETTINGS | ||
APPSETTINGSDB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/opt/lidarr | ||
/home/UNAME/.config | ||
/home/UNAME/.config/Lidarr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |