Advertisement
Guest User

Untitled

a guest
Dec 13th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.37 KB | None | 0 0
  1. # For information on options, see the transmission-daemon(1) man page.
  2. #
  3. # The commented variables in this file are the defaults that are used
  4. # in the init-script.  You don't need to uncomment them except to
  5. # customize them to different values.
  6.  
  7. #
  8. # ----- MAIN CONFIGURATION -----
  9. #
  10.  
  11. # The folder where Transmission stores its config and .torrent files
  12. # TR_HOME=/var/transmission/config
  13.  
  14. # The folder where Transmission stores downloads
  15. # TR_DOWNLOAD=/var/transmission/downloads
  16.  
  17. # The port Transmission uses to connect to other peers
  18. # TR_PORT=54318
  19.  
  20. # The name of the user that runs transmission-daemon and owns the files
  21. # TR_USERNAME=nobody
  22.  
  23. # Login credentials for the Web- and the RPC-interface
  24. # - default: leave commented/empty to disable access authentication
  25. # REMOTE_USER=""
  26. # REMOTE_PASS=""
  27. # - alternative: set a user name and password
  28. # REMOTE_USER=admin
  29. # REMOTE_PASS=password
  30.  
  31. #
  32. # ----- ADVANCED OPTIONS -----
  33. #
  34.  
  35. # Acces control lists
  36. # (machines/networks allowed/denied to control transmission -- comma separated)
  37. # TR_ACL="+127.0.0.1"
  38. # or (for versions 1.4x -- different syntax)
  39. # TR_ACL="127.0.0.1"
  40.  
  41. # Enable use of block lists
  42. # (read the Wiki about what else needs to be done)
  43. # TR_BLOCK=no
  44.  
  45. # Control port used
  46. # only privileged users can use ports < 1024, this applies to TR_USERNAME
  47. # CTL_PORT=9091
  48.  
  49. # Initial speed limits (in K/s)
  50. # default: no limits? 100/100 seems to be the hardcoded default
  51. # TR_UP_SPEED=unlimited
  52. # TR_DN_SPEED=unlimited
  53.  
  54. # Peer exchange
  55. # TR_PX=no
  56.  
  57. # Port mapping using NAT/UPnP
  58. # TR_PMAP=no
  59.  
  60. # Encryption
  61. # Any of :
  62. # TR_ENCRYPT=tolerated
  63. # TR_ENCRYPT=prefered
  64. # TR_ENCRYPT=required
  65.  
  66. # Overall peer limit.
  67. # TR_PEERS=240
  68.  
  69. # Peer limit per torrent.
  70. # TR_PPT=60
  71. You can add extra dependencies to transmission by adding some variables to this file, for instance:
  72.  
  73. RC_NEED="nfs"
  74.  
  75. You'll have to create the directories used, if they don't exist (this is something the Gentoo installation should have done, but since it installs for transmission running as root, its not). Adjust paths as necessary to be the same as your configuration.
  76.  
  77. mkdir -p /var/transmission/config
  78. mkdir -p /var/transmission/downloads
  79. chown -R nobody:nogroup /var/transmission
  80. And the startup script, which uses automagically the options file:
  81.  
  82. /etc/init.d/transmission
  83.  
  84. #!/sbin/runscript
  85. #
  86.  
  87. # DO NOT EDIT!
  88. # ------------
  89. # All configurable options are set in /etc/conf.d/transmission
  90.  
  91. declare -a OPTIONS
  92. OPTIONS+=" -a ${TR_ACL:=127.0.0.1}"
  93. if [ -z "$TR_BLOCK" -o "$TR_BLOCK" = "no" ]; then
  94.    OPTIONS+=" -B"
  95. else
  96.    OPTIONS+=" -b"
  97. fi
  98. OPTIONS+=" -g ${TR_HOME:-/var/transmission/config}"
  99. OPTIONS+=" -l ${TR_PPT:-60}"
  100. OPTIONS+=" -L ${TR_PEERS:-240}"
  101. OPTIONS+=" -p ${CTL_PORT:-9091}"
  102. if [ -z "$REMOTE_USER" -o -z "$REMOTE_PASS" ]; then
  103.    OPTIONS+=" -T"
  104. else
  105.    OPTIONS+=" -t"
  106.    OPTIONS+=" -u $REMOTE_USER"
  107.    OPTIONS+=" -v $REMOTE_PASS"
  108. fi
  109. OPTIONS+=" -w ${TR_DOWNLOAD:-/var/transmission/downloads}"
  110. declare -a EXTRA_OPT
  111. if [ -z "$TR_UP_SPEED" -o "$TR_UP_SPEED" = "unlimited" ]; then
  112.    EXTRA_OPT+=" -U"
  113. else
  114.    EXTRA_OPT+=" -u $TR_UP_SPEED"
  115. fi
  116. if [ -z "$TR_DN_SPEED" -o "$TR_DN_SPEED" = "unlimited" ]; then
  117.    EXTRA_OPT+=" -D"
  118. else
  119.    EXTRA_OPT+=" -d $TR_DN_SPEED"
  120. fi
  121. if [ -z "$TR_PX" -o "$TR_PX" = "no" ]; then
  122.   EXTRA_OPT+=" -X"
  123. else
  124.   EXTRA_OPT+=" -x"
  125. fi
  126. if [ -z "$TR_PMAP" -o "$TR_PMAP" = "no" ]; then
  127.   EXTRA_OPT+=" -M"
  128. else
  129.   EXTRA_OPT+=" -m"
  130. fi
  131. if [ -z "$TR_ENCRYPT" -o "$TR_ENCRYPT" = "tolerated" ]; then
  132.   EXTRA_OPT+=" -et"
  133. elif [ "$TR_ENCRYPT" = "prefered" ]; then
  134.   EXTRA_OPT+=" -ep"
  135. elif [ "$TR_ENCRYPT" = "required" ]; then
  136.   EXTRA_OPT+=" -er"
  137. else
  138.   EXTRA_OPT+=" -et"
  139. fi
  140. E_MSG="ERROR starting transmission, check configuration."
  141.  
  142. depend() {
  143.    need net
  144. }
  145.  
  146. start() {
  147.    ebegin "Starting transmission daemon"
  148.    start-stop-daemon --start --quiet \
  149.       --chuid ${TR_USERNAME:-nobody} \
  150.       --exec /usr/bin/transmission-daemon -- ${OPTIONS[@]} \
  151.    || { eerror $E_MSG; eend 1; return 1; }
  152.    sleep 2
  153.    transmission-remote ${CTL_PORT:-9091} \
  154.       ${REMOTE_PASS:+-n $REMOTE_USER:$REMOTE_PASS} \
  155.       --port ${TR_PORT:-54318} ${EXTRA_OPT[@]} > /dev/null
  156.    eend $?
  157. }
  158.  
  159. stop() {
  160.    ebegin "Stopping transmission daemon"
  161.    start-stop-daemon --stop --quiet --retry=TERM/45/KILL/15 \
  162.       --exec /usr/bin/transmission-daemon
  163.    eend $?
  164. }
  165.  
  166. # vim: set ft=gentoo-init-d ts=3 sw=3 et:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement