diff --git a/net/transmission/Makefile b/net/transmission/Makefile index 37d6398a..77fb4249 100644 --- a/net/transmission/Makefile +++ b/net/transmission/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=transmission -PKG_VERSION:=3.00 -PKG_RELEASE:=4 +PKG_VERSION:=2.94 +PKG_RELEASE:=8 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@GITHUB/transmission/transmission-releases/master -PKG_HASH:=9144652fe742f7f7dd6657716e378da60b751aaeda8bef8344b3eefc4db255f2 +PKG_HASH:=35442cc849f91f8df982c3d0d479d650c6ca19310a994eccdaa79a4af3916b7d PKG_MAINTAINER:=Rosen Penev PKG_LICENSE:=GPL-2.0-or-later @@ -24,7 +24,6 @@ PKG_INSTALL:=1 PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk -include $(INCLUDE_DIR)/package-seccomp.mk define Package/transmission/template SUBMENU:=BitTorrent @@ -85,7 +84,7 @@ endef define Package/transmission-web $(call Package/transmission/template) TITLE+= (webinterface) - DEPENDS:=@(PACKAGE_transmission-daemon-openssl||PACKAGE_transmission-daemon-mbedtls) + DEPENDS:=+transmission-daemon-openssl PKGARCH:=all endef @@ -151,7 +150,6 @@ define Package/transmission-daemon-openssl/install $(INSTALL_CONF) files/transmission.config $(1)/etc/config/transmission $(INSTALL_DIR) $(1)/etc/sysctl.d/ $(INSTALL_CONF) files/transmission.sysctl $(1)/etc/sysctl.d/20-transmission.conf - $(call InstallSeccomp,$(1),./files/transmission-daemon.json) endef Package/transmission-daemon-mbedtls/install = $(Package/transmission-daemon-openssl/install) @@ -177,9 +175,9 @@ define Package/transmission-web/install endef $(eval $(call BuildPackage,transmission-daemon-openssl)) -$(eval $(call BuildPackage,transmission-daemon-mbedtls)) +#$(eval $(call BuildPackage,transmission-daemon-mbedtls)) $(eval $(call BuildPackage,transmission-cli-openssl)) -$(eval $(call BuildPackage,transmission-cli-mbedtls)) +#$(eval $(call BuildPackage,transmission-cli-mbedtls)) $(eval $(call BuildPackage,transmission-remote-openssl)) -$(eval $(call BuildPackage,transmission-remote-mbedtls)) +#$(eval $(call BuildPackage,transmission-remote-mbedtls)) $(eval $(call BuildPackage,transmission-web)) diff --git a/net/transmission/files/transmission-daemon.json b/net/transmission/files/transmission-daemon.json deleted file mode 100644 index 08fbdc35..00000000 --- a/net/transmission/files/transmission-daemon.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "whitelist": [ - "accept", - "accept4", - "access", - "arm_fadvise64_64", - "bind", - "brk", - "clock_gettime", - "clone", - "close", - "connect", - "epoll_create1", - "epoll_ctl", - "epoll_pwait", - "exit", - "exit_group", - "fadvise64", - "fallocate", - "fcntl", - "fcntl64", - "fstat", - "fstat64", - "fsync", - "futex", - "getdents64", - "getpeername", - "getpid", - "getsockname", - "getsockopt", - "getuid32", - "ioctl", - "listen", - "_llseek", - "lseek", - "madvise", - "membarrier", - "mkdir", - "mmap", - "mmap2", - "mprotect", - "mremap", - "munmap", - "nanosleep", - "_newselect", - "open", - "pipe", - "pipe2", - "poll", - "pread64", - "prlimit64", - "pwrite64", - "quotactl", - "read", - "readlink", - "readv", - "recvfrom", - "rename", - "rmdir", - "rt_sigaction", - "rt_sigprocmask", - "rt_sigreturn", - "select", - "sendto", - "setsockopt", - "shutdown", - "sigreturn", - "socket", - "stat", - "stat64", - "socketpair", - "umask", - "uname", - "unlink", - "statfs64", - "umask", - "write", - "writev" - ], - "policy": 1 -} diff --git a/net/transmission/files/transmission.config b/net/transmission/files/transmission.config index 770908c7..4edc4a56 100644 --- a/net/transmission/files/transmission.config +++ b/net/transmission/files/transmission.config @@ -1,8 +1,8 @@ config transmission option enabled 0 - option config_dir '/tmp/transmission' + option config_dir '/opt/transmission' option config_overwrite '1' - option user 'transmission' + option user 'root' option group 'transmission' option mem_percentage 50 option nice 10 @@ -18,15 +18,15 @@ config transmission option bind_address_ipv6 '::' option blocklist_enabled false option blocklist_url '' - option cache_size_mb 2 + option cache_size_mb 64 option dht_enabled true - option download_dir '/tmp/transmission/done' + option download_dir '/opt/transmission/download' option download_queue_enabled true option download_queue_size 4 option encryption 1 option idle_seeding_limit 30 option idle_seeding_limit_enabled false - option incomplete_dir '/tmp/transmission/incomplete' + option incomplete_dir '/opt/transmission/incomplete' option incomplete_dir_enabled false option lazy_bitfield_enabled true option lpd_enabled false diff --git a/net/transmission/files/transmission.init b/net/transmission/files/transmission.init index 24215727..1d57db5e 100644 --- a/net/transmission/files/transmission.init +++ b/net/transmission/files/transmission.init @@ -2,105 +2,86 @@ # Copyright (C) 2010-2015 OpenWrt.org START=99 -STOP=10 USE_PROCD=1 -PROG="/usr/bin/transmission-daemon" LIST_SEP=" " append_params() { local p; local v; local s="$1"; shift - IFS="$LIST_SEP" for p in "$@"; do config_get v "$s" "$p" + IFS="$LIST_SEP" for v in $v; do - [ -n "$v" ] && echo "\"$p\": $v," | sed -e 's|_|-|g' + [ -n "$v" ] && ( + echo "\"$p\": $v," | sed -e 's|_|-|g' + ) >> "$config_file" done + unset IFS done - unset IFS } append_params_quotes() { local p; local v; local s="$1"; shift - IFS="$LIST_SEP" for p in "$@"; do config_get v "$s" "$p" + IFS="$LIST_SEP" for v in $v; do - [ -n "$v" ] && { + [ -n "$v" ] && ( printf "\"%s" "$p" | sed -e 's|/|\\/|g;s|_|-|g'; \ echo "\": \"$v\"," - } + ) >> "$config_file" done + unset IFS done - unset IFS +} + +section_enabled() { + config_get_bool enabled "$1" enabled 0 + [ $enabled -gt 0 ] } transmission() { local cfg="$1" + local USE - local enabled - config_get_bool enabled "$cfg" enabled 0 - [ "$enabled" -gt 0 ] || { - echo "Transmission not enabled. Please enable in /etc/config/transmission" - logger -t "transmission" -p "daemon.info" "Transmission not enabled. Please enable in /etc/config/transmission" - return 1 - } - - local config_dir - config_get config_dir "$cfg" 'config_dir' '/var/etc/transmission' local user - config_get user "$cfg" 'user' local group - config_get group "$cfg" 'group' - local download_dir - config_get download_dir "$cfg" 'download_dir' '/var/etc/transmission' - local incomplete_dir - config_get incomplete_dir "$cfg" 'incomplete_dir' '/var/etc/transmission' - local incomplete_dir_enabled - config_get incomplete_dir_enabled "$cfg" 'incomplete_dir_enabled' 0 - local mem_percentage - config_get mem_percentage "$cfg" 'mem_percentage' '50' local config_overwrite - config_get config_overwrite "$cfg" config_overwrite 1 + local download_dir config_dir + local mem_percentage local nice - config_get nice "$cfg" nice 0 local web_home + + section_enabled "$section" || return 1 + + config_get config_dir "$cfg" 'config_dir' '/var/etc/transmission' + config_get user "$cfg" 'user' + config_get group "$cfg" 'group' + config_get download_dir "$cfg" 'download_dir' '/var/etc/transmission' + config_get mem_percentage "$cfg" 'mem_percentage' '50' + config_get config_overwrite "$cfg" config_overwrite 1 + config_get nice "$cfg" nice 0 config_get web_home "$cfg" 'web_home' - local seccomp_path local MEM + MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo) - local USE - [ "$MEM" -gt 1 ] && USE=$((MEM * mem_percentage * 10)) + if test "$MEM" -gt 1;then + USE=$((MEM * mem_percentage * 10)) + fi config_file="$config_dir/settings.json" [ -d "$config_dir" ] || { mkdir -p "$config_dir" chmod 0755 "$config_dir" touch "$config_file" - mkdir -p "$config_dir/resume" - mkdir -p "$config_dir/torrents" - mkdir -p "$config_dir/blocklists" - [ -e "$config_dir/stats.json" ] || touch "$config_dir/stats.json" [ -z "$user" ] || chown -R "$user:$group" "$config_dir" } - [ -d "$download_dir" ] || { - mkdir -p "$download_dir" - chmod 0755 "$download_dir" - [ -z "$user" ] || chown -R "$user:$group" "$download_dir" - } - - [ "$incomplete_dir_enabled" = "0" ] || [ -d "$incomplete_dir" ] || { - mkdir -p "$incomplete_dir" - chmod 0755 "$incomplete_dir" - [ -z "$user" ] || chown -R "$user:$group" "$incomplete_dir" - } - [ "$config_overwrite" = 0 ] || { - echo "{" + echo "{" > "$config_file" append_params "$cfg" \ alt_speed_down alt_speed_enabled alt_speed_time_begin alt_speed_time_day \ @@ -108,7 +89,7 @@ transmission() { cache_size_mb download_queue_enabled download_queue_size \ dht_enabled encryption idle_seeding_limit idle_seeding_limit_enabled \ incomplete_dir_enabled lazy_bitfield_enabled lpd_enabled message_level \ - peer_id_ttl_hours peer_limit_global peer_limit_per_torrent peer_port \ + peer_limit_global peer_limit_per_torrent peer_port \ peer_port_random_high peer_port_random_low peer_port_random_on_start \ pex_enabled port_forwarding_enabled preallocation prefetch_enabled \ ratio_limit ratio_limit_enabled rename_partial_files rpc_authentication_required \ @@ -117,7 +98,7 @@ transmission() { seed_queue_enabled seed_queue_size \ speed_limit_down speed_limit_down_enabled speed_limit_up \ speed_limit_up_enabled start_added_torrents trash_original_torrent_files \ - umask upload_slots_per_torrent utp_enabled \ + umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \ watch_dir_enabled rpc_host_whitelist_enabled append_params_quotes "$cfg" \ @@ -125,25 +106,21 @@ transmission() { peer_congestion_algorithm peer_socket_tos rpc_bind_address rpc_password rpc_url \ rpc_username rpc_host_whitelist rpc_whitelist script_torrent_done_filename watch_dir + { echo "\"invalid-key\": false" echo "}" - - } > "$config_file" + } >> "$config_file" + } procd_open_instance - procd_set_param command "$PROG" - procd_append_param command -f -g "$config_dir" + procd_set_param command "/usr/bin/transmission-daemon" + procd_append_param command -f --log-error -g "$config_dir" procd_set_param user "$user" procd_set_param group "$group" procd_set_param nice "$nice" procd_set_param stderr 1 procd_set_param respawn - seccomp_path="/etc/seccomp/transmission-daemon.json" - if [ -f "$seccomp_path" ]; then - procd_set_param seccomp "$seccomp_path" - fi - if [ -z "$USE" ]; then procd_set_param limits core="0 0" else @@ -151,16 +128,13 @@ transmission() { logger -t transmission "Starting with $USE virt mem" fi - [ -d "$web_home" ] && procd_set_param env TRANSMISSION_WEB_HOME="$web_home" + if test -d "$web_home"; then + procd_set_param env TRANSMISSION_WEB_HOME="$web_home" + fi procd_add_jail transmission log procd_add_jail_mount "$config_file" - procd_add_jail_mount_rw "$config_dir/resume" - procd_add_jail_mount_rw "$config_dir/torrents" - procd_add_jail_mount_rw "$config_dir/blocklists" - procd_add_jail_mount_rw "$config_dir/stats.json" procd_add_jail_mount_rw "$download_dir" - [ -d "$web_home" ] && procd_add_jail_mount_rw "$web_home" procd_close_instance } @@ -169,10 +143,3 @@ start_service() { config_foreach transmission 'transmission' } -reload_service() { - procd_send_signal "$PROG" -} - -service_triggers() { - procd_add_reload_trigger "transmission" -} diff --git a/net/transmission/patches/010-fix-port-test.patch b/net/transmission/patches/010-fix-port-test.patch new file mode 100644 index 00000000..b9802413 --- /dev/null +++ b/net/transmission/patches/010-fix-port-test.patch @@ -0,0 +1,30 @@ +From d6655cca7db1b960456811b8206ce222700e010d Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Tue, 30 Jan 2018 13:19:58 -0800 +Subject: [PATCH] Remove compressed responses from web servers. + +While zlib is mandatory for transmission, it is not mandatory for curl. + +A libcurl that has been compiled with no support for zlib will return no data if compressed responses are set to on. + +Signed-off-by: Rosen Penev +--- + libtransmission/web.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libtransmission/web.c b/libtransmission/web.c +index c7f0627..db34976 100644 +--- a/libtransmission/web.c ++++ b/libtransmission/web.c +@@ -180,7 +180,7 @@ createEasy (tr_session * s, struct tr_web * web, struct tr_web_task * task) + task->timeout_secs = getTimeoutFromURL (task); + + curl_easy_setopt (e, CURLOPT_AUTOREFERER, 1L); +- curl_easy_setopt (e, CURLOPT_ENCODING, "gzip;q=1.0, deflate, identity"); ++ curl_easy_setopt (e, CURLOPT_ENCODING, ""); + curl_easy_setopt (e, CURLOPT_FOLLOWLOCATION, 1L); + curl_easy_setopt (e, CURLOPT_MAXREDIRS, -1L); + curl_easy_setopt (e, CURLOPT_NOSIGNAL, 1L); +-- +2.7.4 + diff --git a/net/transmission/patches/020-fix-safari.patch b/net/transmission/patches/020-fix-safari.patch new file mode 100644 index 00000000..6feaefe0 --- /dev/null +++ b/net/transmission/patches/020-fix-safari.patch @@ -0,0 +1,26 @@ +From 405d768bfea661c418e2c75686a7bac95e4bb17b Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Thu, 1 Mar 2018 11:25:15 -0800 +Subject: [PATCH] fix web interface with Safari. + +Backport of bcfe147e6a41ce7774f569ede6179a7ed2c7f560 +--- + web/javascript/common.js | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/web/javascript/common.js b/web/javascript/common.js +index 7162d3f82..77bf96857 100644 +--- a/web/javascript/common.js ++++ b/web/javascript/common.js +@@ -61,7 +61,7 @@ $(document).ready(function() { + // Fix min height for isMobileDevice when run in full screen mode from home screen + // so the footer appears in the right place + $('body div#torrent_container').css('min-height', '338px'); +- $("label[for=torrent_upload_url]").text("URL: "); ++ $("label[for=torrent_upload_url]").text = "URL: "; + } else { + // Fix for non-Safari-3 browsers: dark borders to replace shadows. + $('div.dialog_container div.dialog_window').css('border', '1px solid #777'); +-- +2.14.3 + diff --git a/net/transmission/patches/030-fix-dht-memory-leak.patch b/net/transmission/patches/030-fix-dht-memory-leak.patch new file mode 100644 index 00000000..c584d3f4 --- /dev/null +++ b/net/transmission/patches/030-fix-dht-memory-leak.patch @@ -0,0 +1,31 @@ +From df03e037c69ebd74dd2db77d034b65980f0dc2d0 Mon Sep 17 00:00:00 2001 +From: Mike Gelfand +Date: Tue, 23 Jan 2018 21:20:30 +0300 +Subject: [PATCH] Fix memory leak in `tr_dhtInit` in failure condition + +Fixes: #482 +--- + libtransmission/tr-dht.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/libtransmission/tr-dht.c b/libtransmission/tr-dht.c +index 243429f64..df56542bc 100644 +--- a/libtransmission/tr-dht.c ++++ b/libtransmission/tr-dht.c +@@ -333,8 +333,11 @@ tr_dhtInit (tr_session *ss) + + return 1; + +- fail: +- tr_logAddNamedDbg ("DHT", "DHT initialization failed (errno = %d)", errno); ++fail: ++ tr_free(nodes6); ++ tr_free(nodes); ++ ++ tr_logAddNamedDbg("DHT", "DHT initialization failed (errno = %d)", errno); + session = NULL; + return -1; + } +-- +2.17.0 + diff --git a/net/transmission/patches/040-fix-curl.patch b/net/transmission/patches/040-fix-curl.patch new file mode 100644 index 00000000..00448507 --- /dev/null +++ b/net/transmission/patches/040-fix-curl.patch @@ -0,0 +1,29 @@ +From 4fa98f0b0b493ebbef616404dbc03ba5fe811997 Mon Sep 17 00:00:00 2001 +From: userwithuid +Date: Sun, 27 May 2018 12:47:15 -0700 +Subject: [PATCH] fix logic for setting the curl ca bundle file + +we do not want to delete the system default by setting this to NULL... +--- + libtransmission/web.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/libtransmission/web.c b/libtransmission/web.c +index db349760b..997a151b5 100644 +--- a/libtransmission/web.c ++++ b/libtransmission/web.c +@@ -191,7 +191,10 @@ createEasy (tr_session * s, struct tr_web * web, struct tr_web_task * task) + #endif + if (web->curl_ssl_verify) + { +- curl_easy_setopt (e, CURLOPT_CAINFO, web->curl_ca_bundle); ++ if (web->curl_ca_bundle != NULL) ++ { ++ curl_easy_setopt (e, CURLOPT_CAINFO, web->curl_ca_bundle); ++ } + } + else + { +-- +2.17.0 + diff --git a/net/transmission/patches/070-uClibc-ng-since-1.0.18-has-sys-quota.h-synced-with-G.patch b/net/transmission/patches/070-uClibc-ng-since-1.0.18-has-sys-quota.h-synced-with-G.patch new file mode 100644 index 00000000..5dfd20f8 --- /dev/null +++ b/net/transmission/patches/070-uClibc-ng-since-1.0.18-has-sys-quota.h-synced-with-G.patch @@ -0,0 +1,25 @@ +From e24f7c6653ec385c8af7eb6499d924994e78e42d Mon Sep 17 00:00:00 2001 +From: Waldemar Brodkorb +Date: Wed, 19 Oct 2016 19:33:35 +0200 +Subject: [PATCH] uClibc-ng since 1.0.18 has sys/quota.h synced with GNU libc + +--- + libtransmission/platform-quota.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libtransmission/platform-quota.c b/libtransmission/platform-quota.c +index e7d1f6d4f..bb1f9d9b9 100644 +--- a/libtransmission/platform-quota.c ++++ b/libtransmission/platform-quota.c +@@ -285,7 +285,7 @@ getquota (const char * device) + spaceused = (int64_t) dq.dqb_curblocks >> 1; + #elif defined(__APPLE__) + spaceused = (int64_t) dq.dqb_curbytes; +-#elif defined(__UCLIBC__) ++#elif defined (__UCLIBC__) && !TR_UCLIBC_CHECK_VERSION (1, 0, 18) + spaceused = (int64_t) btodb(dq.dqb_curblocks); + #elif defined(__sun) || (defined(_LINUX_QUOTA_VERSION) && _LINUX_QUOTA_VERSION < 2) + spaceused = (int64_t) dq.dqb_curblocks >> 1; +-- +2.17.1 + diff --git a/net/transmission/patches/080-disable-webseeding.patch b/net/transmission/patches/080-disable-webseeding.patch deleted file mode 100644 index a850b356..00000000 --- a/net/transmission/patches/080-disable-webseeding.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/libtransmission/webseed.c -+++ b/libtransmission/webseed.c -@@ -510,8 +510,6 @@ static void webseed_timer_func(evutil_socket_t foo UNUSED, short bar UNUSED, voi - ++w->retry_tickcount; - } - -- on_idle(w); -- - tr_timerAddMsec(w->timer, TR_IDLE_TIMER_MSEC); - } -