1 |
commit: 96117d3b7fc98d99bd11a4bf135cfb85fab87024 |
2 |
Author: Paolo Pedroni <paolo.pedroni <AT> iol <DOT> it> |
3 |
AuthorDate: Wed Feb 17 10:24:42 2016 +0000 |
4 |
Commit: Kristian Fiskerstrand <k_f <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 28 20:38:24 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=96117d3b |
7 |
|
8 |
net-p2p/deluge: unbundle startup scripts for deluge-web |
9 |
|
10 |
Different startup scripts for daemon and web server. This fixes |
11 |
bug #350213 (thanks to Cameron Tacklind <cameron <AT> tacklind.com> for |
12 |
inspiration, even though implemented slightly differently) |
13 |
|
14 |
net-p2p/deluge/files/deluge-web.conf | 6 ++++ |
15 |
net-p2p/deluge/files/deluge-web.init | 54 ++++++++++++++++++++++++++++++++++++ |
16 |
net-p2p/deluge/files/deluged.conf-2 | 7 +++++ |
17 |
net-p2p/deluge/files/deluged.init-2 | 54 ++++++++++++++++++++++++++++++++++++ |
18 |
4 files changed, 121 insertions(+) |
19 |
|
20 |
diff --git a/net-p2p/deluge/files/deluge-web.conf b/net-p2p/deluge/files/deluge-web.conf |
21 |
new file mode 100644 |
22 |
index 0000000..f0aad8f |
23 |
--- /dev/null |
24 |
+++ b/net-p2p/deluge/files/deluge-web.conf |
25 |
@@ -0,0 +1,6 @@ |
26 |
+# /etc/conf.d/deluge-web |
27 |
+# Change this to the user you want to run deluged as. |
28 |
+# You may specify a group too, after a colon |
29 |
+DELUGE_WEB_USER="" |
30 |
+#DELUGE_WEB_HOME="" |
31 |
+DELUGE_WEB_OPTS="" |
32 |
|
33 |
diff --git a/net-p2p/deluge/files/deluge-web.init b/net-p2p/deluge/files/deluge-web.init |
34 |
new file mode 100644 |
35 |
index 0000000..fc540e4 |
36 |
--- /dev/null |
37 |
+++ b/net-p2p/deluge/files/deluge-web.init |
38 |
@@ -0,0 +1,54 @@ |
39 |
+#!/sbin/runscript |
40 |
+# Copyright 1999-2013 Gentoo Foundation |
41 |
+# Distributed under the terms of the GNU General Public License, v2 or later |
42 |
+# $Id$ |
43 |
+ |
44 |
+depend() { |
45 |
+ need net |
46 |
+} |
47 |
+ |
48 |
+checkconfig() { |
49 |
+ if [ "${DELUGE_WEB_USER}" = "" ] ; then |
50 |
+ eerror "Please edit /etc/conf.d/deluge-web" |
51 |
+ eerror "You have to specify a user to run deluge-web as, as we will not run it as root!" |
52 |
+ eerror "Modify DELUGE_WEB_USER to your needs (you can also add a group, after a colon)" |
53 |
+ return 1 |
54 |
+ fi |
55 |
+ if ! getent passwd "${DELUGE_WEB_USER%:*}" >/dev/null ; then |
56 |
+ eerror "Please edit /etc/conf.d/deluge-web" |
57 |
+ eerror "Your user has to exist!" |
58 |
+ return 1 |
59 |
+ fi |
60 |
+ if [ "${DELUGE_WEB_USER%:*}" = "${DELUGE_WEB_USER}" ] ; then |
61 |
+ return 0 |
62 |
+ else |
63 |
+ if ! getent group "${DELUGE_WEB_USER#*:}" >/dev/null ; then |
64 |
+ eerror "Please edit /etc/conf.d/deluge-web" |
65 |
+ eerror "Your group has to exist too!" |
66 |
+ return 1 |
67 |
+ fi |
68 |
+ fi |
69 |
+ return 0 |
70 |
+} |
71 |
+ |
72 |
+start() { |
73 |
+ checkconfig || return $? |
74 |
+ if [ "${DELUGE_WEB_HOME}" = "" ] ; then |
75 |
+ DELUGE_WEB_USER_HOME=$(getent passwd "${DELUGE_WEB_USER%:*}" | cut -d ':' -f 6) |
76 |
+ else |
77 |
+ DELUGE_WEB_USER_HOME=${DELUGE_WEB_HOME} |
78 |
+ fi |
79 |
+ ebegin "Starting Deluge-Web" |
80 |
+ start-stop-daemon --start --background --pidfile \ |
81 |
+ /run/deluge-web.pid --make-pidfile \ |
82 |
+ --exec /usr/bin/deluge-web --user "${DELUGE_WEB_USER%:*}" \ |
83 |
+ -e HOME="${DELUGE_WEB_USER_HOME}" -- ${DELUGE_WEB_OPTS} |
84 |
+ eend $? |
85 |
+} |
86 |
+ |
87 |
+stop() { |
88 |
+ ebegin "Stopping Deluge-Web" |
89 |
+ start-stop-daemon --stop --user "${DELUGE_WEB_USER%:*}" \ |
90 |
+ --pidfile /run/deluge-web.pid |
91 |
+ eend $? |
92 |
+} |
93 |
|
94 |
diff --git a/net-p2p/deluge/files/deluged.conf-2 b/net-p2p/deluge/files/deluged.conf-2 |
95 |
new file mode 100644 |
96 |
index 0000000..5c507c6 |
97 |
--- /dev/null |
98 |
+++ b/net-p2p/deluge/files/deluged.conf-2 |
99 |
@@ -0,0 +1,7 @@ |
100 |
+# /etc/conf.d/deluged |
101 |
+# Change this to the user you want to run deluged as. |
102 |
+# You may specify a group too, after a colon |
103 |
+DELUGED_USER="" |
104 |
+# DELUGED_UMASK="0002" |
105 |
+# DELUGED_OPTS="-p 58846" |
106 |
+ |
107 |
|
108 |
diff --git a/net-p2p/deluge/files/deluged.init-2 b/net-p2p/deluge/files/deluged.init-2 |
109 |
new file mode 100644 |
110 |
index 0000000..082bf9d |
111 |
--- /dev/null |
112 |
+++ b/net-p2p/deluge/files/deluged.init-2 |
113 |
@@ -0,0 +1,54 @@ |
114 |
+#!/sbin/runscript |
115 |
+# Copyright 1999-2013 Gentoo Foundation |
116 |
+# Distributed under the terms of the GNU General Public License, v2 or later |
117 |
+# $Id$ |
118 |
+ |
119 |
+depend() { |
120 |
+ need net |
121 |
+} |
122 |
+ |
123 |
+checkconfig() { |
124 |
+ if [ "${DELUGED_USER}" = "" ] ; then |
125 |
+ eerror "Please edit /etc/conf.d/deluged" |
126 |
+ eerror "You have to specify a user to run deluged as, as we will not run it as root!" |
127 |
+ eerror "Modify DELUGED_USER to your needs (you can also add a group, after a colon)" |
128 |
+ return 1 |
129 |
+ fi |
130 |
+ if ! getent passwd "${DELUGED_USER%:*}" >/dev/null ; then |
131 |
+ eerror "Please edit /etc/conf.d/deluged" |
132 |
+ eerror "Your user has to exist!" |
133 |
+ return 1 |
134 |
+ fi |
135 |
+ if [ "${DELUGED_USER%:*}" = "${DELUGED_USER}" ] ; then |
136 |
+ return 0 |
137 |
+ else |
138 |
+ if ! getent group "${DELUGED_USER#*:}" >/dev/null ; then |
139 |
+ eerror "Please edit /etc/conf.d/deluged" |
140 |
+ eerror "Your group has to exist too!" |
141 |
+ return 1 |
142 |
+ fi |
143 |
+ fi |
144 |
+ return 0 |
145 |
+} |
146 |
+ |
147 |
+start() { |
148 |
+ checkconfig || return $? |
149 |
+ if [ "${DELUGED_HOME}" = "" ] ; then |
150 |
+ DELUGED_USER_HOME=$(getent passwd "${DELUGED_USER%:*}" | cut -d ':' -f 6) |
151 |
+ else |
152 |
+ DELUGED_USER_HOME=${DELUGED_HOME} |
153 |
+ fi |
154 |
+ ebegin "Starting Deluged" |
155 |
+ start-stop-daemon --start --user "${DELUGED_USER%:*}" \ |
156 |
+ --name deluged --pidfile /run/deluged.pid --background --make-pidfile \ |
157 |
+ ${DELUGED_UMASK:+--umask ${DELUGED_UMASK}} \ |
158 |
+ --exec /usr/bin/deluged -e HOME="${DELUGED_USER_HOME}" -- --do-not-daemonize ${DELUGED_OPTS} |
159 |
+ eend $? |
160 |
+} |
161 |
+ |
162 |
+stop() { |
163 |
+ ebegin "Stopping Deluged" |
164 |
+ start-stop-daemon --stop --user "${DELUGED_USER%:*}" \ |
165 |
+ --name deluged --pidfile /run/deluged.pid |
166 |
+ eend $? |
167 |
+} |