1 |
ssuominen 09/06/20 12:55:37 |
2 |
|
3 |
Added: transmission-daemon.initd.2 |
4 |
Removed: transmission-daemon.confd transmission-daemon.initd |
5 |
transmission-daemon.initd.1 |
6 |
Log: |
7 |
Fix all transmission bugs, see ChangeLog for details. |
8 |
(Portage version: 2.2_rc33/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 net-p2p/transmission/files/transmission-daemon.initd.2 |
12 |
|
13 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd.2?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd.2?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: transmission-daemon.initd.2 |
17 |
=================================================================== |
18 |
#!/sbin/runscript |
19 |
# Copyright 1999-2009 Gentoo Foundation |
20 |
# Distributed under the terms of the GNU General Public License v2 |
21 |
# $Header: /var/cvsroot/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd.2,v 1.1 2009/06/20 12:55:37 ssuominen Exp $ |
22 |
|
23 |
# Read options from conf.d file, or set sensible defaults |
24 |
allowed=${allowed:-127.0.0.1} |
25 |
blocklist=${blocklist:-no} |
26 |
watch_dir=${watch_dir:-} |
27 |
config_dir=${config_dir:-/var/transmission/config} |
28 |
port=${port:-9091} |
29 |
auth=${auth:-no} |
30 |
username=${username:-} |
31 |
password=${password:-} |
32 |
download_dir=${download_dir:=/var/transmission/downloads} |
33 |
peerport=${peerport:-51413} |
34 |
portmap=${portmap:-no} |
35 |
peerlimit_global=${peerlimit_global:-240} |
36 |
peerlimit_torrent=${peerlimit_torrent:-60} |
37 |
encryption=${encryption:-preferred} |
38 |
bind_address_ipv4=${bind_address_ipv4:-} |
39 |
bind_address_ipv6=${bind_address_ipv6:-} |
40 |
rpc_bind_address=${rpc_bind_address:-} |
41 |
|
42 |
# Misc options |
43 |
pidfile=${pidfile:-/var/run/transmission.pid} |
44 |
logfile=${logfile:-} |
45 |
runas_user=${runas_user:-} |
46 |
|
47 |
|
48 |
# Convert settings into stuff that transmission-daemon can grok as arguments |
49 |
allowed_opt="--allowed ${allowed}" |
50 |
|
51 |
blocklist_opt="--no-blocklist" |
52 |
if [ "x${blocklist}" = "xyes" ]; then |
53 |
blocklist_opt="--blocklist" |
54 |
fi |
55 |
|
56 |
watch_dir_opt="--no-watch-dir" |
57 |
if [ -n "${watch_dir}" ]; then |
58 |
watch_dir_opt="--watch-dir ${watch_dir}" |
59 |
fi |
60 |
|
61 |
config_dir_opt="--config-dir ${config_dir}" |
62 |
|
63 |
port_opt="--port ${port}" |
64 |
|
65 |
auth_opt="--no-auth" |
66 |
username_opt="" |
67 |
password_opt="" |
68 |
if [ "x${auth}" = "xyes" ]; then |
69 |
auth_opt="--auth" |
70 |
# Set username and password also |
71 |
username_opt="--username ${username}" |
72 |
password_opt="--password ${password}" |
73 |
fi |
74 |
|
75 |
download_dir_opt="--download-dir ${download_dir}" |
76 |
|
77 |
peerport_opt="--peerport ${peerport}" |
78 |
|
79 |
portmap_opt="--no-portmap" |
80 |
if [ "x${portmap}" = "xyes" ]; then |
81 |
portmap_opt="--portmap" |
82 |
fi |
83 |
|
84 |
peerlimit_global_opt="--peerlimit-global ${peerlimit_global}" |
85 |
|
86 |
peerlimit_torrent_opt="--peerlimit-torrent ${peerlimit_torrent}" |
87 |
|
88 |
case "${encryption}" in |
89 |
'required') encryption_opt="--encryption-required" ;; |
90 |
'tolerated') encryption_opt="--encryption-tolerated" ;; |
91 |
*) encryption_opt="--encryption-preferred" ;; |
92 |
esac |
93 |
|
94 |
bind_address_ipv4_opt="" |
95 |
if [ -n "${bind_address_ipv4}" ]; then |
96 |
bind_address_ipv4_opt="--bind-address-ipv4 ${bind_address_ipv4}" |
97 |
fi |
98 |
|
99 |
bind_address_ipv6_opt="" |
100 |
if [ -n "${bind_address_ipv6}" ]; then |
101 |
bind_address_ipv6_opt="--bind-address-ipv6 ${bind_address_ipv6}" |
102 |
fi |
103 |
|
104 |
rpc_bind_address_opt="" |
105 |
if [ -n "${rpc_bind_address}" ]; then |
106 |
rpc_bind_address_opt="--rpc-bind-address ${rpc_bind_address}" |
107 |
fi |
108 |
|
109 |
# Note: works only on systems with sys-apps/openrc |
110 |
logfile_opt="" |
111 |
if [ -n "${logfile}" ]; then |
112 |
logfile_opt="--stdout ${logfile} --stderr ${logfile}" |
113 |
fi |
114 |
|
115 |
# Note: works only on systems with sys-apps/openrc |
116 |
# This could be done in baselayout-1 with --chuid, but since |
117 |
# openrc detection is vague at best (b.g.o #270646), just ignore it. |
118 |
runas_user_opt="" |
119 |
if [ -n "${runas_user}" ]; then |
120 |
runas_user_opt="--user ${runas_user}" |
121 |
fi |
122 |
|
123 |
# Actual init script stuff below this line |
124 |
|
125 |
opts="start stop" |
126 |
description="Transmission is a fast, easy and free bittorrent client" |
127 |
description_start="Start transmission-daemon server and web interface" |
128 |
description_stop="Stop transmission-daemon server and web interface" |
129 |
|
130 |
depend() { |
131 |
need net |
132 |
} |
133 |
|
134 |
start() { |
135 |
ebegin "Starting transmission daemon" |
136 |
start-stop-daemon --start --quiet --background --make-pidfile \ |
137 |
--pidfile ${pidfile} ${runas_user_opt} \ |
138 |
${logfile_opt} --exec \ |
139 |
/usr/bin/transmission-daemon -- --foreground ${allowed_opt} \ |
140 |
${blocklist_opt} ${watch_dir_opt} ${config_dir_opt} ${port_opt} \ |
141 |
${auth_opt} ${username_opt} ${password_opt} ${download_dir_opt} \ |
142 |
${peerport_opt} ${portmap_opt} ${peerlimit_global_opt} \ |
143 |
${peerlimit_torrent_opt} ${encryption_opt} \ |
144 |
${bind_address_ipv4_opt} ${bind_address_ipv6_opt} ${rpc_bind_address_opt} |
145 |
eend $? |
146 |
} |
147 |
|
148 |
stop() { |
149 |
ebegin "Stopping transmission daemon" |
150 |
start-stop-daemon --stop --quiet --retry TERM/45/QUIT/15 \ |
151 |
--pidfile ${pidfile} |
152 |
eend $? |
153 |
} |