1 |
armin76 10/10/02 15:36:03 |
2 |
|
3 |
Modified: deluged.init |
4 |
Log: |
5 |
Update init script, bug #339352, bug #288599, thanks to Juanlu Pérez <juanluperez at gmail dot com>, Paolo Pedroni <paolo dot pedroni at iol dot it> and Michał Górny <mgorny at gentoo dot org> |
6 |
(Portage version: 2.1.8.3/cvs/Linux ia64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.6 net-p2p/deluge/files/deluged.init |
10 |
|
11 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/deluge/files/deluged.init?rev=1.6&view=markup |
12 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/deluge/files/deluged.init?rev=1.6&content-type=text/plain |
13 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/deluge/files/deluged.init?r1=1.5&r2=1.6 |
14 |
|
15 |
Index: deluged.init |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo-x86/net-p2p/deluge/files/deluged.init,v |
18 |
retrieving revision 1.5 |
19 |
retrieving revision 1.6 |
20 |
diff -u -r1.5 -r1.6 |
21 |
--- deluged.init 17 Feb 2009 15:32:17 -0000 1.5 |
22 |
+++ deluged.init 2 Oct 2010 15:36:03 -0000 1.6 |
23 |
@@ -1,28 +1,28 @@ |
24 |
#!/sbin/runscript |
25 |
-# Copyright 1999-2008 Gentoo Foundation |
26 |
+# Copyright 1999-2010 Gentoo Foundation |
27 |
# Distributed under the terms of the GNU General Public License, v2 or later |
28 |
-# $Header: /var/cvsroot/gentoo-x86/net-p2p/deluge/files/deluged.init,v 1.5 2009/02/17 15:32:17 armin76 Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/net-p2p/deluge/files/deluged.init,v 1.6 2010/10/02 15:36:03 armin76 Exp $ |
30 |
|
31 |
depend() { |
32 |
need net |
33 |
} |
34 |
|
35 |
checkconfig() { |
36 |
- if [[ "${DELUGED_USER}" == "" ]] ; then |
37 |
+ if [ "${DELUGED_USER}" = "" ] ; then |
38 |
eerror "Please edit /etc/conf.d/deluged" |
39 |
eerror "You have to specify a user to run deluged as, as we will not run it as root!" |
40 |
eerror "Modify DELUGED_USER to your needs (you can also add a group, after a colon)" |
41 |
return 1 |
42 |
fi |
43 |
- if ! `getent passwd | cut -d ':' -f 1 | grep $( echo "${DELUGED_USER}" | cut -d ':' -f 1 ) -sq` ; then |
44 |
+ if ! getent passwd "${DELUGED_USER%:*}" >/dev/null ; then |
45 |
eerror "Please edit /etc/conf.d/deluged" |
46 |
eerror "Your user has to exist!" |
47 |
return 1 |
48 |
fi |
49 |
- if ! `echo "${DELUGED_USER}" | grep ':' -sq` ; then |
50 |
+ if [ "${DELUGED_USER%:*}" = "${DELUGED_USER}" ] ; then |
51 |
return 0 |
52 |
else |
53 |
- if ! `cut -d ':' -f 1 /etc/group | grep $( echo "${DELUGED_USER}" | cut -d ':' -f 2 ) -sq` ; then |
54 |
+ if ! getent group "${DELUGED_USER#*:}" >/dev/null ; then |
55 |
eerror "Please edit /etc/conf.d/deluged" |
56 |
eerror "Your group has to exist too!" |
57 |
return 1 |
58 |
@@ -33,10 +33,10 @@ |
59 |
|
60 |
start() { |
61 |
checkconfig || return $? |
62 |
- if [[ "${DELUGED_HOME}" == "" ]] ; then |
63 |
- DELUGED_USER_HOME=`getent passwd | grep ^$( echo "${DELUGED_USER}" | cut -d ':' -f 1 ): | cut -d ':' -f 6` |
64 |
+ if [ "${DELUGED_HOME}" = "" ] ; then |
65 |
+ DELUGED_USER_HOME=$(getent passwd "${DELUGED_USER%:*}" | cut -d ':' -f 6) |
66 |
else |
67 |
- DELUGED_USER_HOME="${DELUGED_HOME}" |
68 |
+ DELUGED_USER_HOME=${DELUGED_HOME} |
69 |
fi |
70 |
ebegin "Starting Deluged" |
71 |
start-stop-daemon --start --user "${DELUGED_USER}" \ |
72 |
@@ -45,7 +45,7 @@ |
73 |
eend $? |
74 |
|
75 |
|
76 |
- if [[ "${DELUGEUI_START}" == "true" ]] ; then |
77 |
+ if [ "${DELUGEUI_START}" = "true" ] ; then |
78 |
ebegin "Starting Deluge" |
79 |
start-stop-daemon --start --background --pidfile \ |
80 |
/var/run/deluge.pid --make-pidfile \ |
81 |
@@ -62,7 +62,7 @@ |
82 |
eend $? |
83 |
|
84 |
|
85 |
- if [[ "${DELUGEUI_START}" == "true" ]] ; then |
86 |
+ if [ "${DELUGEUI_START}" = "true" ] ; then |
87 |
ebegin "Stopping Deluge" |
88 |
start-stop-daemon --stop --user "${DELUGED_USER}" \ |
89 |
--name deluge --pidfile /var/run/deluge.pid |