forked from SimpleHomelab/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
14 changed files
with
328 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
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,15 @@ | ||
#!/bin/bash | ||
APPNAME='jackett' | ||
APPSHORTNAME='jk' | ||
APPPATH='/opt/jackett' | ||
APPTITLE='Jackett' | ||
APPDEPS='libcurl4-openssl-dev' | ||
APPDPORT='9117' | ||
APPSETTINGSDIR="/home/$UNAME/.config/Jackett" | ||
APPSETTINGS=$APPSETTINGSDIR'/ServerConfig.json' | ||
PORTSEARCH='"Port": ' | ||
USERSEARCH='NA' | ||
PASSSEARCH='NA' | ||
APPSYSTEMD='jackett.service' | ||
APPSYSTEMDLOC=$SCRIPTPATH'/jackett/'$APPSYSTEMD | ||
APPINITDLOC=$SCRIPTPATH'/jackett/jackett.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,15 @@ | ||
#!/bin/bash | ||
# Script Name: AtoMiC Jackett Installer | ||
# Author: TommyE123 | ||
# Publisher: http://www.htpcBeginner.com | ||
# License: MIT License (refer to README.md for more details) | ||
# | ||
|
||
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
echo | ||
echo -e $YELLOW'--->Latest File Found...'$ENDCOLOR | ||
OUTPUT="$(curl -s https://api.github.com/repos/jackett/jackett/releases| grep browser_download_url | head -n 1 | cut -d '"' -f 4)" | ||
echo "${OUTPUT}" | ||
echo | ||
echo -e $YELLOW'--->Downloading and extracting files...'$ENDCOLOR | ||
sudo curl -L "${OUTPUT}" | tar -xzf - -C $APPPATH --strip-components=1 |
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 @@ | ||
/opt/jackett |
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,10 @@ | ||
#!/bin/bash | ||
# Script Name: AtoMiC Jackett init.d update | ||
# Author: TommyE123 | ||
# Publisher: http://www.htpcbeginner.com | ||
# | ||
|
||
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
echo 'Updating init.d file' | ||
|
||
sudo sed -i "s@RUN_AS=ReplaceMe@RUN_AS=$UNAME@g" /etc/init.d/$APPNAME || { echo -e $RED'Replacing RUN_AS failed.'$ENDCOLOR ; exit 1; } |
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,35 @@ | ||
#!/bin/bash | ||
# Script Name: AtoMiC Jackett Installer | ||
# Author: TommyE123 | ||
# Publisher: http://www.htpcBeginner.com | ||
# License: MIT License (refer to README.md for more details) | ||
# | ||
|
||
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
|
||
if [[ $ISSETUP != "Yes" ]] | ||
then | ||
echo | ||
echo -e '\e[91mCannot be run directly. Please run setup.sh from AtoMiC ToolKit root folder: \033[0msudo bash setup.sh' | ||
echo | ||
exit 0 | ||
fi | ||
source $SCRIPTPATH/inc/commons.sh | ||
source $SCRIPTPATH/inc/header.sh | ||
|
||
echo -e $GREEN"AtoMiC $APPTITLE Installer Script"$ENDCOLOR | ||
|
||
source $SCRIPTPATH/inc/pause.sh | ||
source $SCRIPTPATH/utils/mono/mono-installer.sh | ||
source $SCRIPTPATH/jackett/jackett-constants.sh | ||
source $SCRIPTPATH/inc/app-move-previous.sh | ||
source $SCRIPTPATH/inc/pkgupdate.sh | ||
source $SCRIPTPATH/inc/app-install-deps.sh | ||
source $SCRIPTPATH/inc/app-folders-create.sh | ||
source $SCRIPTPATH/jackett/jackett-download.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,35 @@ | ||
#!/bin/bash | ||
if [[ $ISSETUP != "Yes" ]] | ||
then | ||
echo | ||
echo -e '\e[91mCannot be run directly. Please run setup.sh from AtoMiC ToolKit root folder: \033[0msudo bash setup.sh' | ||
echo | ||
exit 0 | ||
fi | ||
SUBCHOICE=$(whiptail --title "AtoMiC ToolKit - Manage Jackett" --menu "What would you like to do?" --backtitle "$BACKTITLE" --fb --cancel-button "Exit" $LINES $COLUMNS $NETLINES \ | ||
"Install" "Install Jackett" \ | ||
"Uninstall" "Uninstall Jackett" \ | ||
"Backup" "Backup Jackett settings" \ | ||
"Restore" "Restore Jackett settings from a previous backup" \ | ||
"Manual Update" "Manually update Jackett" \ | ||
"Access Details" "View Jackett access details" \ | ||
"Go Back" "Back to Main Menu" 3>&1 1>&2 2>&3) | ||
|
||
exitstatus=$? | ||
if [ $exitstatus = 0 ]; then | ||
source $SCRIPTPATH/jackett/jackett-constants.sh | ||
case "$SUBCHOICE" in | ||
"Install" ) source $SCRIPTPATH/jackett/jackett-installer.sh ;; | ||
"Uninstall" ) source $SCRIPTPATH/jackett/jackett-uninstaller.sh ;; | ||
"Backup" ) source $SCRIPTPATH/inc/app-backup-controller.sh ;; | ||
"Restore" ) source $SCRIPTPATH/inc/app-restore-controller.sh ;; | ||
"Manual Update" ) source $SCRIPTPATH/jackett/jackett-update.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 | ||
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,13 @@ | ||
#!/bin/bash | ||
# Script Name: AtoMiC Jackett Systemd Update | ||
# Author: TommyE123 | ||
# Publisher: http://www.htpcBeginner.com | ||
# License: MIT License (refer to README.md for more details) | ||
# | ||
|
||
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
|
||
sudo sed -i "s@User=ReplaceMe@User=$UNAME@g" /etc/systemd/system/$APPSYSTEMD || { echo -e $RED'Modifying USER in SYSTEMD file failed.'$ENDCOLOR; exit 1; } | ||
|
||
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,28 @@ | ||
#!/bin/bash | ||
# Script Name: AtoMiC Jackett Uninstaller | ||
# Author: TommyE123 | ||
# Publisher: http://www.htpcBeginner.com | ||
# License: MIT License (refer to README.md for more details) | ||
# | ||
|
||
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
|
||
if [[ $ISSETUP != "Yes" ]] | ||
then | ||
echo | ||
echo -e '\e[91mCannot be run directly. Please run setup.sh from AtoMiC ToolKit root folder: \033[0msudo bash setup.sh' | ||
echo | ||
exit 0 | ||
fi | ||
source $SCRIPTPATH/inc/commons.sh | ||
source $SCRIPTPATH/inc/header.sh | ||
|
||
echo -e $GREEN"AtoMiC $APPTITLE Uninstaller Script"$ENDCOLOR | ||
|
||
source $SCRIPTPATH/inc/pause.sh | ||
source $SCRIPTPATH/inc/app-stop.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,33 @@ | ||
#!/bin/bash | ||
# Script Name: AtoMiC Jackett Updater | ||
# Author: TommyE123 | ||
# Publisher: http://www.htpcBeginner.com | ||
# License: MIT License (refer to README.md for more details) | ||
# | ||
|
||
# DO NOT EDIT ANYTHING UNLESS YOU KNOW WHAT YOU ARE DOING. | ||
|
||
if [[ $ISSETUP != "Yes" ]] | ||
then | ||
echo | ||
echo -e '\e[91mCannot be run directly. Please run setup.sh from AtoMiC ToolKit root folder: \033[0msudo bash setup.sh' | ||
echo | ||
exit 0 | ||
fi | ||
source $SCRIPTPATH/inc/commons.sh | ||
source $SCRIPTPATH/inc/header.sh | ||
|
||
echo -e $GREEN"AtoMiC $APPTITLE Update Script"$ENDCOLOR | ||
|
||
source $SCRIPTPATH/inc/pause.sh | ||
source $SCRIPTPATH/inc/app-folder-check.sh | ||
source $SCRIPTPATH/inc/pkgupdate.sh | ||
source $SCRIPTPATH/inc/app-stop.sh | ||
source $SCRIPTPATH/inc/app-file-del.sh | ||
source $SCRIPTPATH/inc/app-folders-create.sh | ||
source $SCRIPTPATH/jackett/jackett-download.sh | ||
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 | ||
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,121 @@ | ||
#! /bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: Jackett | ||
# Required-Start: $local_fs $network $remote_fs | ||
# Required-Stop: $local_fs $network $remote_fs | ||
# Should-Start: $NetworkManager | ||
# Should-Stop: $NetworkManager | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: starts instance of Jackett | ||
# Description: starts instance of Jackett using start-stop-daemon | ||
### END INIT INFO | ||
|
||
############### EDIT ME ################## | ||
# path to app | ||
APP_PATH=/opt/jackett | ||
|
||
# user | ||
RUN_AS=ReplaceMe | ||
|
||
# path to mono bin | ||
DAEMON=$(which mono) | ||
|
||
# Path to store PID file | ||
PID_FILE=/var/run/jackett/jackett.pid | ||
PID_PATH=$(dirname $PID_FILE) | ||
|
||
# script name | ||
NAME=jackett | ||
|
||
# app name | ||
DESC=Jackett | ||
|
||
# startup args | ||
EXENAME="JackettConsole.exe" | ||
DAEMON_OPTS=" "$EXENAME | ||
|
||
############### END EDIT ME ################## | ||
|
||
JACKETT_PID=`ps auxf | grep $EXENAME | grep -v grep | awk '{print $2}'` | ||
|
||
test -x $DAEMON || exit 0 | ||
|
||
set -e | ||
|
||
#Look for PID and create if doesn't exist | ||
if [ ! -d $PID_PATH ]; then | ||
mkdir -p $PID_PATH | ||
chown $RUN_AS $PID_PATH | ||
fi | ||
|
||
if [ ! -d $DATA_DIR ]; then | ||
mkdir -p $DATA_DIR | ||
chown $RUN_AS $DATA_DIR | ||
fi | ||
|
||
if [ -e $PID_FILE ]; then | ||
PID=`cat $PID_FILE` | ||
if ! kill -0 $PID > /dev/null 2>&1; then | ||
echo "Removing stale $PID_FILE" | ||
rm $PID_FILE | ||
fi | ||
fi | ||
|
||
echo $JACKETT_PID > $PID_FILE | ||
|
||
case "$1" in | ||
start) | ||
if [ -z "${JACKETT_PID}" ]; then | ||
echo "Starting $DESC" | ||
rm -rf $PID_PATH || return 1 | ||
install -d --mode=0755 -o $RUN_AS $PID_PATH || return 1 | ||
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS | ||
else | ||
echo "Jackett already running." | ||
fi | ||
;; | ||
stop) | ||
echo "Stopping $DESC" | ||
echo $JACKETT_PID > $PID_FILE | ||
start-stop-daemon --stop --pidfile $PID_FILE --retry 15 | ||
;; | ||
|
||
restart|force-reload) | ||
echo "Restarting $DESC" | ||
start-stop-daemon --stop --pidfile $PID_FILE --retry 15 | ||
start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS | ||
;; | ||
status) | ||
# Use LSB function library if it exists | ||
if [ -f /lib/lsb/init-functions ]; then | ||
. /lib/lsb/init-functions | ||
if [ -e $PID_FILE ]; then | ||
status_of_proc -p $PID_FILE "$DAEMON" "$NAME" && exit 0 || exit $? | ||
else | ||
log_daemon_msg "$NAME is not running" | ||
exit 3 | ||
fi | ||
|
||
else | ||
# Use basic functions | ||
if [ -e $PID_FILE ]; then | ||
PID=`cat $PID_FILE` | ||
if kill -0 $PID > /dev/null 2>&1; then | ||
echo " * $NAME is running" | ||
exit 0 | ||
fi | ||
else | ||
echo " * $NAME is not running" | ||
exit 3 | ||
fi | ||
fi | ||
;; | ||
*) | ||
N=/etc/init.d/$NAME | ||
echo "Usage: $N {start|stop|restart|force-reload|status}" >&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,14 @@ | ||
[Unit] | ||
Description=Jackett | ||
After=network.target | ||
|
||
[Service] | ||
User=ReplaceMe | ||
Restart=always | ||
RestartSec=5 | ||
Type=simple | ||
ExecStart=/usr/bin/mono --debug /opt/jackett/JackettConsole.exe --NoRestart | ||
TimeoutStopSec=20 | ||
|
||
[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