|
@@ -47,8 +47,10 @@ transmission() {
|
47
|
47
|
local USE
|
48
|
48
|
|
49
|
49
|
local user
|
50
|
|
- local download_dir
|
|
50
|
+ local download_dir config_dir
|
51
|
51
|
local mem_percentage
|
|
52
|
+ local config_overwrite nice ionice_flags
|
|
53
|
+ local cmdline
|
52
|
54
|
|
53
|
55
|
section_enabled "$section" || return 1
|
54
|
56
|
|
|
@@ -56,6 +58,10 @@ transmission() {
|
56
|
58
|
config_get user "$cfg" 'user'
|
57
|
59
|
config_get download_dir "$cfg" 'download_dir' '/var/etc/transmission'
|
58
|
60
|
config_get mem_percentage "$cfg" 'mem_percentage' '50'
|
|
61
|
+ config_get config_overwrite "$cfg" config_overwrite 1
|
|
62
|
+ config_get nice "$cfg" nice 0
|
|
63
|
+ config_get ionice_flags "$cfg" ionice_flags ''
|
|
64
|
+ which ionice > /dev/null || ionice_flags=''
|
59
|
65
|
|
60
|
66
|
local MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo)
|
61
|
67
|
if test "$MEM" -gt 1;then
|
|
@@ -69,38 +75,45 @@ transmission() {
|
69
|
75
|
[ -z "$user" ] || chown -R $user $config_dir
|
70
|
76
|
}
|
71
|
77
|
|
72
|
|
- echo "{" > $config_file
|
73
|
|
-
|
74
|
|
- append_params "$cfg" \
|
75
|
|
- alt_speed_down alt_speed_enabled alt_speed_time_begin alt_speed_time_day \
|
76
|
|
- alt_speed_time_enabled alt_speed_time_end alt_speed_up blocklist_enabled \
|
77
|
|
- cache_size_mb download_queue_enabled download_queue_size \
|
78
|
|
- dht_enabled encryption idle_seeding_limit idle_seeding_limit_enabled \
|
79
|
|
- incomplete_dir_enabled lazy_bitfield_enabled lpd_enabled message_level \
|
80
|
|
- peer_limit_global peer_limit_per_torrent peer_port \
|
81
|
|
- peer_port_random_high peer_port_random_low peer_port_random_on_start \
|
82
|
|
- pex_enabled port_forwarding_enabled preallocation prefetch_enabled \
|
83
|
|
- ratio_limit ratio_limit_enabled rename_partial_files rpc_authentication_required \
|
84
|
|
- rpc_enabled rpc_port rpc_whitelist_enabled queue_stalled_enabled \
|
85
|
|
- queue_stalled_minutes scrape_paused_torrents_enabled script_torrent_done_enabled \
|
86
|
|
- seed_queue_enabled seed_queue_size \
|
87
|
|
- speed_limit_down speed_limit_down_enabled speed_limit_up \
|
88
|
|
- speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
|
89
|
|
- umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \
|
90
|
|
- watch_dir_enabled
|
91
|
|
-
|
92
|
|
- append_params_quotes "$cfg" \
|
93
|
|
- blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
|
94
|
|
- peer_congestion_algorithm peer_socket_tos rpc_bind_address rpc_password rpc_url \
|
95
|
|
- rpc_username rpc_whitelist script_torrent_done_filename watch_dir
|
96
|
|
-
|
97
|
|
- echo "\""invalid-key"\": false" >> $config_file
|
98
|
|
- echo "}" >> $config_file
|
|
78
|
+ [ "$config_overwrite" == 0 ] || {
|
|
79
|
+
|
|
80
|
+ echo "{" > $config_file
|
|
81
|
+
|
|
82
|
+ append_params "$cfg" \
|
|
83
|
+ alt_speed_down alt_speed_enabled alt_speed_time_begin alt_speed_time_day \
|
|
84
|
+ alt_speed_time_enabled alt_speed_time_end alt_speed_up blocklist_enabled \
|
|
85
|
+ cache_size_mb download_queue_enabled download_queue_size \
|
|
86
|
+ dht_enabled encryption idle_seeding_limit idle_seeding_limit_enabled \
|
|
87
|
+ incomplete_dir_enabled lazy_bitfield_enabled lpd_enabled message_level \
|
|
88
|
+ peer_limit_global peer_limit_per_torrent peer_port \
|
|
89
|
+ peer_port_random_high peer_port_random_low peer_port_random_on_start \
|
|
90
|
+ pex_enabled port_forwarding_enabled preallocation prefetch_enabled \
|
|
91
|
+ ratio_limit ratio_limit_enabled rename_partial_files rpc_authentication_required \
|
|
92
|
+ rpc_enabled rpc_port rpc_whitelist_enabled queue_stalled_enabled \
|
|
93
|
+ queue_stalled_minutes scrape_paused_torrents_enabled script_torrent_done_enabled \
|
|
94
|
+ seed_queue_enabled seed_queue_size \
|
|
95
|
+ speed_limit_down speed_limit_down_enabled speed_limit_up \
|
|
96
|
+ speed_limit_up_enabled start_added_torrents trash_original_torrent_files \
|
|
97
|
+ umask upload_slots_per_torrent utp_enabled scrape_paused_torrents \
|
|
98
|
+ watch_dir_enabled
|
|
99
|
+
|
|
100
|
+ append_params_quotes "$cfg" \
|
|
101
|
+ blocklist_url bind_address_ipv4 bind_address_ipv6 download_dir incomplete_dir \
|
|
102
|
+ peer_congestion_algorithm peer_socket_tos rpc_bind_address rpc_password rpc_url \
|
|
103
|
+ rpc_username rpc_whitelist script_torrent_done_filename watch_dir
|
|
104
|
+
|
|
105
|
+ echo "\""invalid-key"\": false" >> $config_file
|
|
106
|
+ echo "}" >> $config_file
|
99
|
107
|
|
|
108
|
+ }
|
|
109
|
+
|
|
110
|
+ cmdline="/usr/bin/transmission-daemon -g $config_dir -f"
|
|
111
|
+ [ "$ionice_flags" ] && cmdline="ionice $ionice_flags $cmdline"
|
100
|
112
|
procd_open_instance
|
101
|
|
- procd_set_param command /usr/bin/transmission-daemon -g $config_dir -f
|
|
113
|
+ procd_set_param command $cmdline
|
102
|
114
|
procd_set_param respawn retry=60
|
103
|
115
|
procd_set_param user "$user"
|
|
116
|
+ procd_set_param nice "$nice"
|
104
|
117
|
if test -z "$USE";then
|
105
|
118
|
procd_set_param limits core="0 0"
|
106
|
119
|
else
|