Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Pro forma LSB compliance for the init script - Prepare a systemd service - Actually read /etc/default/transmission-daemon (It wasn't before, it was just there) - Allow the RPC interface to listen on IPv6 - Rename the init script to "transmission-daemon", the daemon is called that way on any decent Linux distro Note: If you have any E2 plugin that starts/stops transmission-daemon, re-adjust it to the new initscript name, not the other way around! (I couldn't find any)
- Loading branch information
1 parent
6891475
commit 94f525b
Showing
9 changed files
with
225 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
...ctivity/transmission/transmission/allow_the_rpc_server_to_listen_on_an_ipv6_address.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
From 463b5424505e77e14dbbc35c3488adbf41122e27 Mon Sep 17 00:00:00 2001 | ||
From: Sebastiaan Lokhorst <sebastiaanlokhorst@gmail.com> | ||
Date: Sat, 28 Jan 2017 21:18:38 +0100 | ||
Subject: [PATCH] Allow the RPC server to listen on an IPv6 address | ||
|
||
--- | ||
daemon/daemon.c | 2 +- | ||
daemon/transmission-daemon.1 | 4 ++-- | ||
libtransmission/rpc-server.c | 15 ++++++--------- | ||
libtransmission/transmission.h | 2 +- | ||
4 files changed, 10 insertions(+), 13 deletions(-) | ||
|
||
diff --git a/daemon/daemon.c b/daemon/daemon.c | ||
index 96a56cd..649a20a 100644 | ||
--- a/daemon/daemon.c | ||
+++ b/daemon/daemon.c | ||
@@ -130,7 +130,7 @@ static const struct tr_option options[] = | ||
{ 912, "encryption-tolerated", "Prefer unencrypted peer connections", "et", 0, NULL }, | ||
{ 'i', "bind-address-ipv4", "Where to listen for peer connections", "i", 1, "<ipv4 addr>" }, | ||
{ 'I', "bind-address-ipv6", "Where to listen for peer connections", "I", 1, "<ipv6 addr>" }, | ||
- { 'r', "rpc-bind-address", "Where to listen for RPC connections", "r", 1, "<ipv4 addr>" }, | ||
+ { 'r', "rpc-bind-address", "Where to listen for RPC connections", "r", 1, "<ip addr>" }, | ||
{ 953, "global-seedratio", "All torrents, unless overridden by a per-torrent setting, should seed until a specific ratio", "gsr", 1, "ratio" }, | ||
{ 954, "no-global-seedratio", "All torrents, unless overridden by a per-torrent setting, should seed regardless of ratio", "GSR", 0, NULL }, | ||
{ 'x', "pid-file", "Enable PID file", "x", 1, "<pid-file>" }, | ||
diff --git a/daemon/transmission-daemon.1 b/daemon/transmission-daemon.1 | ||
index 0a32ae6..9043b8e 100644 | ||
--- a/daemon/transmission-daemon.1 | ||
+++ b/daemon/transmission-daemon.1 | ||
@@ -41,7 +41,7 @@ via RPC commands from transmission's web interface or | ||
.It Fl a Fl -allowed Ar x.x.x.x,... | ||
Allow RPC access to a comma-delimited whitelist of IP addresses. | ||
Wildcards can be specified in an address by using '*'. | ||
-Default: "127.0.0.1" | ||
+Default: "127.0.0.1,::1" | ||
Example: "127.0.0.*,192.168.1.*" | ||
.It Fl b Fl -blocklist | ||
Enable peer blocklists. Transmission understands the bluetack blocklist file format. | ||
@@ -84,7 +84,7 @@ Listen for IPv4 BitTorrent connections on a specific address. Only one IPv4 list | ||
.It Fl I Fl -bind-address-ipv6 | ||
Listen for IPv6 BitTorrent connections on a specific address. Only one IPv6 listening address is allowed. Default: :: (All addresses) | ||
.It Fl r Fl -rpc-bind-address | ||
-Listen for RPC connections on a specific address. This must be an IPv4 address. Only one RPC listening address is allowed. Default: 0.0.0.0 (All addresses) | ||
+Listen for RPC connections on a specific address. This must be an IPv4 or IPv6 address. Only one RPC listening address is allowed. Default: 0.0.0.0 (All IPv4 addresses) | ||
.It Fl -paused | ||
Pause all torrents on startup | ||
.It Fl L Fl -peerlimit-global Ar limit | ||
diff --git a/libtransmission/rpc-server.c b/libtransmission/rpc-server.c | ||
index e86a4a3..d0c21d7 100644 | ||
--- a/libtransmission/rpc-server.c | ||
+++ b/libtransmission/rpc-server.c | ||
@@ -54,7 +54,7 @@ struct tr_rpc_server | ||
bool isWhitelistEnabled; | ||
tr_port port; | ||
char * url; | ||
- struct in_addr bindAddress; | ||
+ struct tr_address bindAddress; | ||
struct evhttp * httpd; | ||
struct event * start_retry_timer; | ||
int start_retry_counter; | ||
@@ -959,10 +959,7 @@ tr_rpcIsPasswordEnabled (const tr_rpc_server * server) | ||
const char * | ||
tr_rpcGetBindAddress (const tr_rpc_server * server) | ||
{ | ||
- tr_address addr; | ||
- addr.type = TR_AF_INET; | ||
- addr.addr.addr4 = server->bindAddress; | ||
- return tr_address_to_string (&addr); | ||
+ return tr_address_to_string (&server->bindAddress); | ||
} | ||
|
||
/**** | ||
@@ -1073,16 +1070,16 @@ tr_rpcInit (tr_session * session, tr_variant * settings) | ||
tr_logAddNamedError (MY_NAME, _("%s is not a valid address"), str); | ||
address = tr_inaddr_any; | ||
} | ||
- else if (address.type != TR_AF_INET) | ||
+ else if (address.type != TR_AF_INET && address.type != TR_AF_INET6) | ||
{ | ||
- tr_logAddNamedError (MY_NAME, _("%s is not an IPv4 address. RPC listeners must be IPv4"), str); | ||
+ tr_logAddNamedError (MY_NAME, _("%s is not an IPv4 or IPv6 address. RPC listeners must be IPv4 or IPv6"), str); | ||
address = tr_inaddr_any; | ||
} | ||
- s->bindAddress = address.addr.addr4; | ||
+ s->bindAddress = address; | ||
|
||
if (s->isEnabled) | ||
{ | ||
- tr_logAddNamedInfo (MY_NAME, _("Serving RPC and Web requests on port 127.0.0.1:%d%s"), (int) s->port, s->url); | ||
+ tr_logAddNamedInfo (MY_NAME, _("Serving RPC and Web requests on port %d%s"), (int) s->port, s->url); | ||
tr_runInEventThread (session, startServer, s); | ||
|
||
if (s->isWhitelistEnabled) | ||
diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h | ||
index dd8add8..6683873 100644 | ||
--- a/libtransmission/transmission.h | ||
+++ b/libtransmission/transmission.h | ||
@@ -128,7 +128,7 @@ const char* tr_getDefaultDownloadDir (void); | ||
|
||
#define TR_DEFAULT_BIND_ADDRESS_IPV4 "0.0.0.0" | ||
#define TR_DEFAULT_BIND_ADDRESS_IPV6 "::" | ||
-#define TR_DEFAULT_RPC_WHITELIST "127.0.0.1" | ||
+#define TR_DEFAULT_RPC_WHITELIST "127.0.0.1,::1" | ||
#define TR_DEFAULT_RPC_PORT_STR "9091" | ||
#define TR_DEFAULT_RPC_URL_STR "/transmission/" | ||
#define TR_DEFAULT_PEER_PORT_STR "51413" |
14 changes: 10 additions & 4 deletions
14
meta-oe/recipes-connectivity/transmission/transmission/config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
# Default values for transmission daemon | ||
# please fill in and enable service. | ||
# Username and password for the RPC interface | ||
USER="root" | ||
PASSWORD="enigma2" | ||
RPC_PORT=9091 | ||
|
||
# Various directories | ||
#DIRECTORY="/media/hdd/transmission" | ||
#DOWNLOAD_DIR="${DIRECTORY}/download" | ||
#CONFIG_DIR="${DIRECTORY}/config" | ||
|
||
# Set DAEMON_USER to run under different credentials | ||
DAEMON_ENABLED="YES" | ||
DAEMON_USER="" | ||
DAEMON_GROUP="" | ||
DOWNLOAD_DIR="/media/hdd/torrents/" | ||
CONFIG_DIR="/var/lib/transmission-daemon" | ||
|
13 changes: 13 additions & 0 deletions
13
meta-oe/recipes-connectivity/transmission/transmission/configure-allow-local-network.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Index: transmission-2.73/libtransmission/transmission.h | ||
=================================================================== | ||
--- transmission-2.73.orig/libtransmission/transmission.h | ||
+++ transmission-2.73/libtransmission/transmission.h | ||
@@ -148,7 +148,7 @@ const char* tr_getDefaultDownloadDir( vo | ||
|
||
#define TR_DEFAULT_BIND_ADDRESS_IPV4 "0.0.0.0" | ||
#define TR_DEFAULT_BIND_ADDRESS_IPV6 "::" | ||
-#define TR_DEFAULT_RPC_WHITELIST "127.0.0.1,::1" | ||
+#define TR_DEFAULT_RPC_WHITELIST "127.0.0.1,::1,10.*.*.*,192.168.*.*" | ||
#define TR_DEFAULT_RPC_PORT_STR "9091" | ||
#define TR_DEFAULT_RPC_URL_STR "/transmission/" | ||
#define TR_DEFAULT_PEER_PORT_STR "51413" |
96 changes: 46 additions & 50 deletions
96
meta-oe/recipes-connectivity/transmission/transmission/init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,71 @@ | ||
#!/bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: transmission-daemon | ||
# Required-Start: networking | ||
# Required-Stop: networking | ||
# Default-Start: 2 3 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: Start the transmission BitTorrent daemon client. | ||
### END INIT INFO | ||
|
||
# ----- CONFIGURATION ----- | ||
|
||
LINE="--------------------------------------" | ||
TRANSMISSION_ON=0 | ||
NAME="transmission-daemon" | ||
DAEMON="/usr/bin/transmission-daemon" | ||
DIRECTORY="/hdd/transmission" | ||
DIRECTORY="/media/hdd/transmission" | ||
DOWNLOAD_DIR="${DIRECTORY}/download" | ||
CONFIG_DIR="${DIRECTORY}/config" | ||
WATCH_DIR="${DIRECTORY}/watch" | ||
RPC_PORT=9091 | ||
DOWNLOAD_DIR="/hdd/transmission/download" | ||
CONFIG_DIR="/hdd/transmission/config" | ||
WATCH_DIR="/hdd/transmission/watch" | ||
USER="root" | ||
PASSWORD="dreambox" | ||
ARGS="-c $WATCH_DIR -g $CONFIG_DIR -a *.*.*.* -w $DOWNLOAD_DIR -p $RPC_PORT -t -u $USER -v $PASSWORD" | ||
INET_ADDR=`awk '/address/{print$2}' /etc/network/interfaces` | ||
PATH=/usr/sbin:/usr/bin:/sbin:/bin | ||
TRANSMISSION_WEB_HOME="/usr/share/transmission/web/" | ||
PASSWORD="enigma2" | ||
ALLOWED="*.*.*.*,*:*:*:*:*:*:*:*" | ||
[ -f /etc/default/transmission-daemon ] && . /etc/default/transmission-daemon | ||
NAME="transmission-daemon" | ||
DAEMON="/bin/nice -n 9 /usr/bin/transmission-daemon" | ||
ARGS="-c $WATCH_DIR -g $CONFIG_DIR -r :: -a $ALLOWED -w $DOWNLOAD_DIR -p $RPC_PORT -t -u $USER -v $PASSWORD" | ||
|
||
[ -z "$DAEMON_USER" ] || SSDOPTIONS="--chuid $DAEMON_USER:$DAEMON_GROUP" | ||
|
||
# ----- END OF CONFIGURATION ----- | ||
PATH=/usr/sbin:/usr/bin:/sbin:/bin | ||
|
||
if [ ! -d $DIRECTORY ] ; then mkdir $DIRECTORY; fi | ||
if [ ! -d $DOWNLOAD_DIR ] ; then mkdir $DOWNLOAD_DIR; fi | ||
if [ ! -d $CONFIG_DIR ] ; then mkdir $CONFIG_DIR; fi | ||
if [ ! -d $WATCH_DIR ] ; then mkdir $WATCH_DIR; fi | ||
if [ ! -d $DOWNLOAD_DIR ] ; then mkdir -p $DOWNLOAD_DIR; fi | ||
if [ ! -d $CONFIG_DIR ] ; then mkdir -p $CONFIG_DIR; fi | ||
if [ ! -d $WATCH_DIR ] ; then mkdir -p $WATCH_DIR; fi | ||
|
||
|
||
case $1 in | ||
start) | ||
echo -n "starting $NAME... " | ||
echo | ||
start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS | ||
sleep 2 | ||
echo | ||
echo $LINE | ||
echo "Transmission Started !!!" | ||
echo "Open your browser at http://ip-from-box:9091" | ||
echo $LINE | ||
echo | ||
;; | ||
stop) | ||
echo | ||
echo -n "stopping $NAME... " | ||
killall $NAME | ||
echo "done." | ||
;; | ||
echo "Starting $NAME" | ||
start-stop-daemon $SSDOPTIONS -S -b -n $NAME -a $DAEMON -- $ARGS | ||
;; | ||
stop) | ||
echo "Stopping $NAME" | ||
start-stop-daemon --stop --quiet --exec /usr/bin/transmission-daemon | ||
;; | ||
restart) | ||
echo -n "Stopping $NAME" | ||
start-stop-daemon --stop --quiet --exec /usr/bin/transmission-daemon | ||
for i in 1 2 3 ; do | ||
sleep 1 | ||
echo -n "." | ||
done | ||
echo | ||
echo -n "restarting $NAME... " | ||
$0 stop | ||
sleep 5 | ||
$0 start | ||
echo | ||
;; | ||
echo "Restarting $NAME" | ||
start-stop-daemon $SSDOPTIONS -S -b -n $NAME -a $DAEMON -- $ARGS | ||
;; | ||
autostart | enable) | ||
echo | ||
update-rc.d transmissiond defaults 99 | ||
update-rc.d transmission-daemon defaults 60 | ||
sleep 2 | ||
echo | ||
;; | ||
;; | ||
noautostart | disable) | ||
echo | ||
update-rc.d -f transmissiond remove | ||
update-rc.d -f transmission-daemon remove | ||
sleep 2 | ||
echo | ||
;; | ||
;; | ||
|
||
*) | ||
echo " " | ||
echo "Options: $0 {start|restart|stop|enable|disable}" | ||
echo " " | ||
echo "Usage: $0 {start|restart|stop|enable|disable}" | ||
exit 1 | ||
esac | ||
|
||
exit 0 |
12 changes: 12 additions & 0 deletions
12
meta-oe/recipes-connectivity/transmission/transmission/service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Transmission BitTorrent Daemon | ||
After=network.target | ||
|
||
[Service] | ||
User=root | ||
Type=notify | ||
ExecStart=/usr/bin/transmission-daemon -c /media/hdd/transmission/watch -w /media/hdd/transmission/download -g /media/hdd/transmission/config -a :: -f --log-error | ||
ExecReload=/bin/kill -s HUP $MAINPID | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
19 changes: 0 additions & 19 deletions
19
meta-oe/recipes-connectivity/transmission/transmission_2.84.bb
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
meta-oe/recipes-connectivity/transmission/transmission_2.92.bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require transmission.inc | ||
|
||
SRC_URI[archive.md5sum] = "e4190f727dc1c14d1998693262eb693a" | ||
SRC_URI[archive.sha256sum] = "825474d1296061cec9642a4d677c7bb5ff0caad565e5edf916622ad614a15443" |
17 changes: 17 additions & 0 deletions
17
meta-oe/recipes-connectivity/transmission/transmission_2.92.bbappend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
SRC_URI += "\ | ||
file://configure-kill-intl-check.patch \ | ||
file://allow_the_rpc_server_to_listen_on_an_ipv6_address.patch \ | ||
file://configure-allow-local-network.patch \ | ||
" | ||
|
||
OE_EXTRACONF = "\ | ||
--disable-gtk --without-gtk \ | ||
--disable-nls --without-nls \ | ||
--disable-cli \ | ||
--disable-mac \ | ||
--disable-wx \ | ||
--disable-beos \ | ||
--enable-lightweight \ | ||
--enable-daemon \ | ||
CPPFLAGS=-DTR_EMBEDDED \ | ||
" |