diff options
author | Samuli Suominen <ssuominen@gentoo.org> | 2009-05-12 23:21:40 +0000 |
---|---|---|
committer | Samuli Suominen <ssuominen@gentoo.org> | 2009-05-12 23:21:40 +0000 |
commit | feed409214e96cae1bafb80e4ebd0d171450b305 (patch) | |
tree | c18c38aa95f07b88354f87ec953e89bdc57970c0 /net-p2p/transmission/files | |
parent | Version bump. (diff) | |
download | gentoo-2-feed409214e96cae1bafb80e4ebd0d171450b305.tar.gz gentoo-2-feed409214e96cae1bafb80e4ebd0d171450b305.tar.bz2 gentoo-2-feed409214e96cae1bafb80e4ebd0d171450b305.zip |
New init.d and conf.d files wrt #238260, thanks to Tom Hendrikx, René Berber, Sergey Dryabzhinsky and many others.
(Portage version: 2.1.6.13/cvs/Linux x86_64)
Diffstat (limited to 'net-p2p/transmission/files')
-rw-r--r-- | net-p2p/transmission/files/transmission-daemon.confd | 61 | ||||
-rw-r--r-- | net-p2p/transmission/files/transmission-daemon.initd | 121 |
2 files changed, 182 insertions, 0 deletions
diff --git a/net-p2p/transmission/files/transmission-daemon.confd b/net-p2p/transmission/files/transmission-daemon.confd new file mode 100644 index 000000000000..bb3e8edd4d8f --- /dev/null +++ b/net-p2p/transmission/files/transmission-daemon.confd @@ -0,0 +1,61 @@ +# This is the transmission-daemon config file +# Default settings are commented, uncomment and adapt as needed + +# Allowed IP addresses. +#allowed=127.0.0.1 + +# Enable peer blocklists (yes or no) +#blocklist=no + +# Directory to watch for new .torrent files (empty string to disable) +#watch_dir= + +# Where to look for configuration files +#config_dir=/var/transmission/config + +# RPC port +#port=9091 + +# Require authentication (yes or no) +#auth=no + +# Set username for authentication (only used when auth=yes) +#username= + +# Set password for authentication (only used when auth=yes) +#password= + +# Where to save downloaded data +#download_dir=/var/transmission/downloads + +# Port for incoming peers +#peerport=51413 + +# Enable portmapping via NAT-PMP or UPnP (yes or no) +#portmap=no + +# Maximum overall number of peers +#peerlimit_global=240 + +# Maximum number of peers per torrent +#peerlimit_torrent=60 + +# How to encrypt peer connections (required, preferred, tolerated) +#encryption=preferred + +# Where to listen for peer connections (ipv4) +#bind_address_ipv4= + +# Where to listen for peer connections (ipv6) +#bind_address_ipv6= + +# Where to listen for RPC connections +#rpc_bind_address= + +# Misc. settings + +# Location of pidfile +#pidfile=/var/run/transmission.pid + +# Run daemon as another user +#runas_user=root diff --git a/net-p2p/transmission/files/transmission-daemon.initd b/net-p2p/transmission/files/transmission-daemon.initd new file mode 100644 index 000000000000..09631c57911a --- /dev/null +++ b/net-p2p/transmission/files/transmission-daemon.initd @@ -0,0 +1,121 @@ +#!/sbin/runscript +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd,v 1.1 2009/05/12 23:21:40 ssuominen Exp $ + + +# Read options from conf.d file, or set sensible defaults +allowed=${allowed:-127.0.0.1} +blocklist=${blocklist:-no} +watch_dir=${watch_dir:-} +config_dir=${config_dir:-/var/transmission/config} +port=${port:-9091} +auth=${auth:-no} +username=${username:-} +password=${password:-} +download_dir=${download_dir:=/var/transmission/downloads} +peerport=${peerport:-51413} +portmap=${portmap:-no} +peerlimit_global=${peerlimit_global:-240} +peerlimit_torrent=${peerlimit_torrent:-60} +encryption=${encryption:-preferred} +bind_address_ipv4=${bind_address_ipv4:-} +bind_address_ipv6=${bind_address_ipv6:-} +rpc_bind_address=${rpc_bind_address:-} + +# Misc options +pidfile=${pidfile:-/var/run/transmission.pid} +runas_user=${runas_user:-root} + + +# Convert settings into stuff that transmission-daemon can grok as arguments +allowed_opt="--allowed ${allowed}" + +blocklist_opt="--no-blocklist" +if [ "x${blocklist}" = "xyes" ]; then + blocklist_opt="--blocklist" +fi + +watch_dir_opt="--no-watch-dir" +if [ -n "${watch_dir}" ]; then + watch_dir_opt="--watch-dir ${watch_dir}" +fi + +config_dir_opt="--config-dir ${config_dir}" + +port_opt="--port ${port}" + +auth_opt="--no-auth" +username_opt="" +password_opt="" +if [ "x${auth}" = "xyes" ]; then + auth_opt="--auth" + # Set username and password also + username_opt="--username ${username}" + password_opt="--password ${password}" +fi + +download_dir_opt="--download-dir ${download_dir}" + +peerport_opt="--peerport ${peerport}" + +portmap_opt="--no-portmap" +if [ "x${portmap}" = "xyes" ]; then + portmap_opt="--portmap" +fi + +peerlimit_global_opt="--peerlimit-global ${peerlimit_global}" + +peerlimit_torrent_opt="--peerlimit-torrent ${peerlimit_torrent}" + +case "${encryption}" in + 'required') encryption_opt="--encryption-required" ;; + 'tolerated') encryption_opt="--encryption-tolerated" ;; + *) encryption_opt="--encryption-preferred" ;; +esac + +bind_address_ipv4_opt="" +if [ -n "${bind_address_ipv4}" ]; then + bind_address_ipv4_opt="--bind-address-ipv4 ${bind_address_ipv4}" +fi + +bind_address_ipv6_opt="" +if [ -n "${bind_address_ipv6}" ]; then + bind_address_ipv6_opt="--bind-address-ipv6 ${bind_address_ipv6}" +fi + +rpc_bind_address_opt="" +if [ -n "${rpc_bind_address}" ]; then + rpc_bind_address_opt="--rpc_bind-address ${rpc_bind_address}" +fi + + +# Actual init script stuff below this line + +description="Transmission is a fast, easy and free bittorrent client" +description_start="Start transmission-daemon server and web interface" +description_start="Stop transmission-daemon server and web interface" + +depend() { + need net +} + +start() { + ebegin "Starting transmission daemon" + start-stop-daemon --start --quiet --background --make-pidfile \ + --pidfile ${pidfile} --user ${runas_user} --exec \ + /usr/bin/transmission-daemon -- --foreground ${allowed_opt} \ + ${blocklist_opt} ${watch_dir_opt} ${config_dir_opt} ${port_opt} \ + ${auth_opt} ${username_opt} ${password_opt} ${download_dir_opt} \ + ${peerport_opt} ${portmap_opt} ${peerlimit_global_opt} \ + ${peerlimit_torrent_opt} ${encryption_opt} \ + ${bind_address_ipv4_opt} ${bind_address_ipv6_opt} ${rpc_bind_address_opt} + eend $? +} + +stop() { + ebegin "Stopping transmission daemon" + start-stop-daemon --stop --quiet --retry TERM/45/QUIT/15 \ + --pidfile ${pidfile} + eend $? +} |