Skip to content

Commit 2879a1a

Browse files
committed
Merge branch 'develop' into gitdownload
2 parents 48b7d96 + e5229d4 commit 2879a1a

17 files changed

+229
-114
lines changed

.travis.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
dist: trusty
1+
dist:
2+
trusty
23

3-
language: generic
4+
language:
5+
generic
46

5-
sudo: required
7+
sudo:
8+
required
9+
10+
group:
11+
travis_latest
612

713
before_install:
814
- sudo pip install bashate
@@ -15,4 +21,5 @@ script:
1521
- sudo bash ./integration-tests/int-apps-install-uninstall.sh
1622

1723
matrix:
18-
fast_finish: true
24+
fast_finish: true
25+

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Features features of AtoMiC ToolKit include:
3737
<li>CouchPotato - Install, Uninstall, Reset Password, Update and Backup / Restore</li>
3838
<li>Deluge - Install, Uninstall, Update and Backup / Restore</li>
3939
<li>Emby - Install, Uninstall, Update and Backup / Restore</li>
40+
<li>FileBot - Install, Uninstall, Update</li>
4041
<li>Glances - Install, Uninstall, Update</li>
4142
<li>Grafana - Install, Uninstall, Update and Backup / Restore</li>
4243
<li>Headphones - Install, Uninstall, Reset Password, Update and Backup / Restore</li>

batch-processes/bat-apps-install-uninstall.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ source "$SCRIPTPATH/setup.sh" -u couchpotato
1616
source "$SCRIPTPATH/setup.sh" -i deluged
1717
source "$SCRIPTPATH/setup.sh" -x deluged
1818
source "$SCRIPTPATH/setup.sh" -u deluged
19+
source "$SCRIPTPATH/setup.sh" -i filebot
20+
source "$SCRIPTPATH/setup.sh" -u filebot
1921
source "$SCRIPTPATH/setup.sh" -i emby-server
2022
source "$SCRIPTPATH/setup.sh" -x emby-server
2123
source "$SCRIPTPATH/setup.sh" -u emby-server
@@ -58,7 +60,7 @@ source "$SCRIPTPATH/setup.sh" -i nzbhydra
5860
# source "$SCRIPTPATH/setup.sh" -x nzbhydra
5961
source "$SCRIPTPATH/setup.sh" -u nzbhydra
6062
source "$SCRIPTPATH/setup.sh" -i ombi
61-
source "$SCRIPTPATH/setup.sh" -x ombi
63+
# source "$SCRIPTPATH/setup.sh" -x ombi # Should work however stops and starts to quickly so fails so needs further investigation.
6264
source "$SCRIPTPATH/setup.sh" -u ombi
6365
source "$SCRIPTPATH/setup.sh" -i plexmediaserver
6466
source "$SCRIPTPATH/setup.sh" -x plexmediaserver

batch-processes/bat-apps-install.sh

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
source "$SCRIPTPATH/setup.sh" -i couchpotato
55
# source "$SCRIPTPATH/setup.sh" -i deluged
66
source "$SCRIPTPATH/setup.sh" -i emby-server
7+
source "$SCRIPTPATH/setup.sh" -i filebot
78
source "$SCRIPTPATH/setup.sh" -i glances
89
source "$SCRIPTPATH/setup.sh" -i grafana
910
source "$SCRIPTPATH/setup.sh" -i headphones

batch-processes/bat-apps-uninstall.sh

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
source "$SCRIPTPATH/setup.sh" -u couchpotato
55
source "$SCRIPTPATH/setup.sh" -u deluged
66
source "$SCRIPTPATH/setup.sh" -u emby-server
7+
source "$SCRIPTPATH/setup.sh" -u filebot
78
source "$SCRIPTPATH/setup.sh" -u glances
89
source "$SCRIPTPATH/setup.sh" -u grafana
910
source "$SCRIPTPATH/setup.sh" -u headphones

batch-processes/bat-apps-update.sh

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
source "$SCRIPTPATH/setup.sh" -m couchpotato
55
source "$SCRIPTPATH/setup.sh" -m deluged
66
source "$SCRIPTPATH/setup.sh" -m emby-server
7+
source "$SCRIPTPATH/setup.sh" -m filebot
78
source "$SCRIPTPATH/setup.sh" -m glances
89
source "$SCRIPTPATH/setup.sh" -m grafana
910
source "$SCRIPTPATH/setup.sh" -m headphones

inc/option-handler.sh

+18-8
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,19 @@ while true; do
4444
shift;
4545
if [[ -n $1 ]]; then
4646
uninstall="$1";
47-
if [[ ! -f $SCRIPTPATH/$1/$1-uninstaller.sh ]]; then
47+
if [[ -f $SCRIPTPATH/$1/$1-uninstaller.sh ]]; then
48+
source "$SCRIPTPATH/$1/$1-constants.sh"
49+
source "$SCRIPTPATH/$1/$1-uninstaller.sh"
50+
elif [[ -f $SCRIPTPATH/utils/$1/$1-uninstaller.sh ]]; then
51+
if [[ -f $SCRIPTPATH/utils/$1/$1-constants.sh ]]; then
52+
source "$SCRIPTPATH/utils/$1/$1-constants.sh"
53+
fi
54+
source "$SCRIPTPATH/utils/$1/$1-uninstaller.sh"
55+
else
4856
echo
4957
echo
5058
echo "$BADARG"
5159
source "$SCRIPTPATH/inc/exit.sh"
52-
else
53-
source "$SCRIPTPATH/$1/$1-constants.sh"
54-
source "$SCRIPTPATH/$1/$1-uninstaller.sh"
5560
fi
5661
shift;
5762
fi
@@ -92,14 +97,19 @@ while true; do
9297
shift;
9398
if [[ -n $1 ]]; then
9499
manualupdate="$1";
95-
if [ ! -f "$SCRIPTPATH/$1/$1-update.sh" ]; then
100+
if [[ -f $SCRIPTPATH/$1/$1-update.sh ]]; then
101+
source "$SCRIPTPATH/$1/$1-constants.sh"
102+
source "$SCRIPTPATH/$1/$1-update.sh"
103+
elif [[ -f $SCRIPTPATH/utils/$1/$1-update.sh ]]; then
104+
if [[ -f $SCRIPTPATH/utils/$1/$1-constants.sh ]]; then
105+
source "$SCRIPTPATH/utils/$1/$1-constants.sh"
106+
fi
107+
source "$SCRIPTPATH/utils/$1/$1-update.sh"
108+
else
96109
echo
97110
echo
98111
echo "$BADARG"
99112
source "$SCRIPTPATH/inc/exit.sh"
100-
else
101-
source "$SCRIPTPATH/$1/$1-constants.sh"
102-
source "$SCRIPTPATH/$1/$1-update.sh"
103113
fi
104114
shift;
105115
fi

ombi/ombi-constants.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ ACCESSHOST='NA'
1414
DBUSERSEARCH='SELECT aspnetusers FROM Users ORDER BY ROWID ASC LIMIT 1;'
1515
APPSYSTEMD='ombi.service'
1616
APPSYSTEMDLOC="$SCRIPTPATH/ombi/$APPSYSTEMD"
17-
APPINITD='ombi'
17+
APPINITD='Ombi'
1818
APPINITDLOC="$SCRIPTPATH/ombi/ombi.init"

ombi/ombi-init-update.sh

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
# Script Name: AtoMiC Ombi init.d update
33

44
echo 'Updating init.d file'
5-
if sudo sed -i "s@user=\"ReplaceMe\"@user=\"$UNAME\"@g" "/etc/init.d/$APPINITD" || \
6-
{ echo -e "${RED}Replacing user failed.$ENDCOLOR" ; exit 1; }; then
7-
echo "Set USER to $UNAME"
8-
fi
9-
10-
if sudo sed -i "s@group=\"ReplaceMe\"@group=\"$UGROUP\"@g" "/etc/init.d/$APPINITD" || \
11-
{ echo -e "${RED}Replacing group failed.$ENDCOLOR" ; exit 1; }; then
12-
echo "Set GROUP to $UGROUP"
5+
if sudo sed -i "s@DAEMON_USER=\"ReplaceMe\"@DAEMON_USER=\"$UNAME\"@g" "/etc/init.d/$APPINITD" || \
6+
{ echo -e "${RED}Replacing DAEMON_USER failed.$ENDCOLOR" ; exit 1; }; then
7+
echo "Set DAEMON_USER to $UNAME"
138
fi

ombi/ombi.init

+91-92
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,107 @@
11
#!/bin/sh
22
### BEGIN INIT INFO
3-
# Provides: Ombi
4-
# Required-Start: $local_fs $network $remote_fs $syslog
5-
# Required-Stop: $local_fs $network $remote_fs $syslog
3+
# Provides: ombi
4+
# Required-Start: $local_fs $remote_fs $network
5+
# Required-Stop: $local_fs $remote_fs $network
66
# Default-Start: 2 3 4 5
77
# Default-Stop: 0 1 6
8-
# Short-Description: Start daemon at boot time
9-
# Description: Enable service provided by daemon.
8+
# Short-Description: Ombi
9+
# Description: A personal media assitant. A simple way for shared media users to request and download content
1010
### END INIT INFO
1111

12-
user="ReplaceMe"
13-
group="ReplaceMe"
14-
dir="/opt/Ombi"
15-
cmd="/opt/Ombi/Ombi"
12+
. /lib/lsb/init-functions
13+
################################################################################
14+
# Update these variables to reflect your system
15+
################################################################################
16+
DAEMON_PWD="/opt/Ombi"
17+
DAEMON_USER="ReplaceMe"
18+
DAEMON_NAME="ombi"
19+
DAEMON_LOG="/var/log/${DAEMON_NAME}.log"
20+
DAEMON_PATH="${DAEMON_PWD}/Ombi"
21+
DAEMON_OPTS="--host http://*:5000 --storage ${DAEMON_PWD}"
22+
DAEMON_DESC=$(get_lsb_header_val $0 "Short-Description")
23+
DAEMON_PID="/var/run/${DAEMON_NAME}.pid"
24+
DAEMON_NICE=0
1625

17-
name=`basename $0`
18-
PIDDIR="/var/run/$name"
19-
pid_file="/var/run/$name/$name.pid"
20-
stdout_log="/var/log/$name.log"
21-
stderr_log="/var/log/$name.err"
26+
[ -r "/etc/default/${DAEMON_NAME}" ] && . "/etc/default/${DAEMON_NAME}"
2227

23-
get_pid() {
24-
cat "$pid_file"
28+
do_start() {
29+
local result
30+
31+
pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
32+
if [ $? -eq 0 ]; then
33+
log_warning_msg "${DAEMON_NAME} is already started"
34+
result=0
35+
else
36+
log_daemon_msg "Starting ${DAEMON_NAME}"
37+
touch "${DAEMON_LOG}"
38+
chown $DAEMON_USER "${DAEMON_LOG}"
39+
chmod u+rw "${DAEMON_LOG}"
40+
if [ -z "${DAEMON_USER}" ]; then
41+
start-stop-daemon --start --quiet --oknodo --background \
42+
--nicelevel $DAEMON_NICE \
43+
--chdir "${DAEMON_PWD}" \
44+
--pidfile "${DAEMON_PID}" --make-pidfile \
45+
--startas /bin/bash -- -c "exec ${DAEMON_PATH} ${DAEMON_OPTS} >> ${DAEMON_LOG} 2>&1"
46+
result=$?
47+
else
48+
start-stop-daemon --start --quiet --oknodo --background \
49+
--nicelevel $DAEMON_NICE \
50+
--chdir "${DAEMON_PWD}" \
51+
--pidfile "${DAEMON_PID}" --make-pidfile \
52+
--chuid "${DAEMON_USER}" \
53+
--startas /bin/bash -- -c "exec ${DAEMON_PATH} ${DAEMON_OPTS} >> ${DAEMON_LOG} 2>&1"
54+
result=$?
55+
fi
56+
log_end_msg $result
57+
fi
58+
return $result
2559
}
2660

27-
is_running() {
28-
[ -f "$pid_file" ] && ps -p `get_pid` > /dev/null 2>&1
61+
do_stop() {
62+
local result
63+
64+
pidofproc -p "${DAEMON_PID}" "${DAEMON_PATH}" > /dev/null
65+
if [ $? -ne 0 ]; then
66+
log_warning_msg "${DAEMON_NAME} is not started"
67+
result=0
68+
else
69+
log_daemon_msg "Stopping ${DAEMON_NAME}"
70+
killproc -p "${DAEMON_PID}" "${DAEMON_PATH}"
71+
result=$?
72+
log_end_msg $result
73+
rm "${DAEMON_PID}"
74+
fi
75+
return $result
2976
}
3077

31-
if [ ! -d ${PIDDIR} ]; then
32-
mkdir -p ${PIDDIR}; chown ${user}:${group} ${PIDDIR}; chmod 0750 ${PIDDIR};
33-
fi
78+
do_restart() {
79+
local result
80+
do_stop
81+
result=$?
82+
if [ $result = 0 ]; then
83+
do_start
84+
result=$?
85+
fi
86+
return $result
87+
}
3488

35-
case "$1" in
36-
start)
37-
if is_running; then
38-
echo "Already started"
39-
else
40-
echo "Starting $name"
41-
cd "$dir"
42-
if [ -z "$user" ]; then
43-
sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
44-
echo $! > "$pid_file"
45-
else
46-
sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
47-
sleep 1 # process not always started fast enough
48-
echo $(pgrep -U "$user" -xf "$cmd") > "$pid_file"
49-
fi
50-
echo $! > "$pid_file"
51-
if ! is_running; then
52-
echo "Unable to start, see $stdout_log and $stderr_log"
53-
exit 1
54-
fi
55-
fi
56-
;;
57-
stop)
58-
if is_running; then
59-
echo -n "Stopping $name.."
60-
kill `get_pid`
61-
for i in 1 2 3 4 5 6 7 8 9 10
62-
# for i in `seq 10`
63-
do
64-
if ! is_running; then
65-
break
66-
fi
89+
do_status() {
90+
local result
91+
status_of_proc -p "${DAEMON_PID}" "${DAEMON_PATH}" "${DAEMON_NAME}"
92+
result=$?
93+
return $result
94+
}
6795

68-
echo -n "."
69-
sleep 1
70-
done
71-
echo
96+
do_usage() {
97+
echo $"Usage: $0 {start | stop | restart | status}"
98+
exit 1
99+
}
72100

73-
if is_running; then
74-
echo "Not stopped; may still be shutting down or shutdown may have failed"
75-
exit 1
76-
else
77-
echo "Stopped"
78-
if [ -f "$pid_file" ]; then
79-
rm "$pid_file"
80-
fi
81-
fi
82-
else
83-
echo "Not running"
84-
fi
85-
;;
86-
restart)
87-
$0 stop
88-
if is_running; then
89-
echo "Unable to stop, will not attempt to start"
90-
exit 1
91-
fi
92-
$0 start
93-
;;
94-
status)
95-
if is_running; then
96-
echo "Running"
97-
else
98-
echo "Stopped"
99-
exit 1
100-
fi
101-
;;
102-
*)
103-
echo "Usage: $0 {start|stop|restart|status}"
104-
exit 1
105-
;;
101+
case "$1" in
102+
start) do_start; exit $? ;;
103+
stop) do_stop; exit $? ;;
104+
restart) do_restart; exit $? ;;
105+
status) do_status; exit $? ;;
106+
*) do_usage; exit 1 ;;
106107
esac
107-
108-
exit 0

utils/filebot/filebot-constants.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
APPNAME='filebot'
4+
APPPATH="/snap/$APPNAME"
5+
APPDEPS='snapd'
6+
APPTITLE='FileBot'

utils/filebot/filebot-installer.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
# Script Name: AtoMiC FileBot Installer
3+
4+
source "$SCRIPTPATH/inc/header.sh"
5+
echo -e "${GREEN}AtoMiC $APPTITLE Installer Script$ENDCOLOR"
6+
7+
if IsSystemdSupported; then
8+
source "$SCRIPTPATH/inc/pause.sh"
9+
source "$SCRIPTPATH/inc/app-install-deps.sh"
10+
echo
11+
echo -e "$YELLOW--->Installing snap $APPTITLE package...$ENDCOLOR"
12+
13+
if [[ -d $APPPATH ]]; then
14+
echo "$APPTITLE already installed"
15+
echo
16+
else
17+
if snap install "$APPNAME"; then
18+
source "$SCRIPTPATH/inc/app-install-confirmation.sh"
19+
source "$SCRIPTPATH/utils/filebot/filebot-patron.sh"
20+
else
21+
echo -e "${RED}Linux Distro not currently supported.$ENDCOLOR"
22+
fi
23+
fi
24+
else
25+
echo -e "${RED}Linux Distro not currently supported." \
26+
"Please consider upgrading to a newer version$ENDCOLOR"
27+
fi

0 commit comments

Comments
 (0)