Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 363559 - net-p2p/transmission init.d script change proposal
Summary: net-p2p/transmission init.d script change proposal
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Peter Volkov (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-14 08:05 UTC by Oleg Gawriloff
Modified: 2011-06-16 09:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
full init.d file (transmission-daemon,2.18 KB, text/plain)
2011-04-14 08:06 UTC, Oleg Gawriloff
Details
transmission-daemon.initd.8.patch (transmission-daemon.initd.8.patch,1.49 KB, patch)
2011-04-29 06:13 UTC, Peter Volkov (RETIRED)
Details | Diff
transmission-daemon.initd.8.patch (transmission-daemon.initd.8.patch,1.49 KB, patch)
2011-04-29 09:44 UTC, Peter Volkov (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Gawriloff 2011-04-14 08:05:54 UTC
It would be nice to introduce following changes to init.d startup script to allow multiple transmission instances through symlinked transmission init.d script and different conf.d files:


run_dir=${rundir:-/var/run/transmission}
pidfile=${pidfile:-${run_dir}/transmission.pid}
download_dir=${download_dir:-/var/transmission/downloads}

check_config() {
        if [ ! -d ${run_dir} ]; then
                mkdir ${run_dir}
                if [ -n "${runas_user}" ]; then
                        chown -R ${runas_user} ${run_dir}
                fi
        fi



Reproducible: Always
Comment 1 Oleg Gawriloff 2011-04-14 08:06:53 UTC
Created attachment 269905 [details]
full init.d file
Comment 2 Peter Volkov (RETIRED) gentoo-dev 2011-04-29 06:13:18 UTC
Created attachment 271535 [details, diff]
transmission-daemon.initd.8.patch

Thank you for report Oleg! Why do you need this? In any case...

Here is updated patch: it allows to change config_dir too. I think it's not good idea for two instances of transmission-daemon share same config dir - it's quite possible that they'll start to overwrites each other settings. Do you agree?

Could you please:
1. test this patch.
2. check that the following instructions are correct.

# It's possible to run multiple instances of transmission daemon with different
# settings. For that copy init.d script and corresponding conf.d configuration.
# In each custom conf.d configuration uncomment and customize following lines:
# transmission_prefix=/var/run/transmission
# run_dir=${transmission_prefix}/rundir
# config_dir=${transmission_prefix}/config
# download_dir=${transmission_prefix}/download

TIA
Comment 3 Oleg Gawriloff 2011-04-29 09:36:26 UTC
(In reply to comment #2)
> Created attachment 271535 [details, diff]
> transmission-daemon.initd.8.patch


Suggested patch contains followin error:
+run_dir=${rundir:-/var/run/transmission}
Here you define run_dir variable.
>+	if [ ! -d "${rundir}" ]; then
>+		mkdir "${rundir}"
but here used value of rundir, which in case when rundir is not defined in conf.d lead to create of undefined catalog.
So it must be like:
+	if [ ! -d "${run_dir}" ]; then
+		mkdir "${run_dir}"

We use multiple copies of transmission because we have couple of different purpose transmission copies on one server with different limits and passwords.
Comment 4 Peter Volkov (RETIRED) gentoo-dev 2011-04-29 09:39:36 UTC
Comment on attachment 271535 [details, diff]
transmission-daemon.initd.8.patch

>--- /usr/portage/net-p2p/transmission/files/transmission-daemon.initd.7	2011-04-06 20:29:15.000000000 +0400
>+++ transmission-daemon.initd.8	2011-04-29 09:57:50.368031378 +0400
>@@ -1,7 +1,7 @@
> #!/sbin/runscript
> # Copyright 1999-2011 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.7,v 1.1 2011/04/06 16:29:15 pva Exp $
>+# $Header: /var/cvsroot/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd.6,v 1.1 2011/02/12 01:47:49 pva Exp $
> 
> opts="start stop reload"
> description="Transmission is a fast, easy and free bittorrent client"
>@@ -9,9 +9,10 @@
> description_stop="Stop transmission-daemon server and web interface"
> description_reload="Reload transmission-daemon settings"
> 
>-pidfile=/var/run/transmission/transmission.pid
>-config_dir=/var/transmission/config
>-download_dir=/var/transmission/downloads
>+rundir=${rundir:-/var/run/transmission}
>+pidfile=${pidfile:-${run_dir}/transmission.pid}
>+config_dir=${config_dir:-/var/transmission/config}
>+download_dir=${download_dir:-/var/transmission/downloads}
> logfile=${logfile:-/var/log/transmission/transmission.log}
> runas_user=${runas_user:-transmission:transmission}
> 
>@@ -22,8 +23,8 @@
> }
> 
> check_config() {
>-	if [ ! -d /var/run/transmission/ ]; then
>-		mkdir /var/run/transmission/
>+	if [ ! -d "${rundir}" ]; then
>+		mkdir "${rundir}"
> 		if [ -n "${runas_user}" ]; then
> 			chown -R ${runas_user} /var/run/transmission/
> 		fi
Comment 5 Peter Volkov (RETIRED) gentoo-dev 2011-04-29 09:44:38 UTC
Created attachment 271543 [details, diff]
transmission-daemon.initd.8.patch

(In reply to comment #3) 
> Suggested patch contains followin error:
> +run_dir=${rundir:-/var/run/transmission}

Err, fixed (run_dir -> rundir) in this attachment (and ignore previous post, I've tried to fix attachment through web interface...

> We use multiple copies of transmission because we have couple of different
> purpose transmission copies on one server with different limits and passwords.

Ok, I see. Thanks. I'll commit these changes with next version/revision bump. BTW, I still interested in positive test results )
Comment 6 Oleg Gawriloff 2011-06-15 07:48:28 UTC
Sorry for long wait.
1.
+rundir=${rundir:-/var/run/transmission}
+pidfile=${pidfile:-${run_dir}/transmission.pid}

${run_dir} in pid file is not defined

2. 		if [ -n "${runas_user}" ]; then
 			chown -R ${runas_user} /var/run/transmission/
Here must be chown -R ${runas_user} ${rundir}

Tested with this changes, all works well.
Comment 7 Peter Volkov (RETIRED) gentoo-dev 2011-06-16 09:13:48 UTC
Thank you Oleg. Init script was added in 2.31-r1.