From 70b375114e9909ac93b4a94da224a6652c1d7928 Mon Sep 17 00:00:00 2001 From: Kload Date: Tue, 29 Oct 2013 13:14:27 +0000 Subject: [PATCH] Init --- .gitignore | 2 ++ README.md | 4 +++ conf/nginx.conf | 6 ++++ conf/settings.json | 70 ++++++++++++++++++++++++++++++++++++++++++++++ manifest.json | 30 ++++++++++++++++++++ scripts/install | 38 +++++++++++++++++++++++++ 6 files changed, 150 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 conf/nginx.conf create mode 100644 conf/settings.json create mode 100644 manifest.json create mode 100644 scripts/install diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3819313 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.swp +*.swo diff --git a/README.md b/README.md new file mode 100644 index 0000000..dee03ea --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +Transmission for YunoHost +------------------------- + +http://www.transmissionbt.com/ diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..25ff34d --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1,6 @@ +location PATHTOCHANGE/transmission { + proxy_pass http://127.0.0.1:9091PATHTOCHANGE/transmission; +} +location PATHTOCHANGE { + proxy_pass http://127.0.0.1:9091/; +} diff --git a/conf/settings.json b/conf/settings.json new file mode 100644 index 0000000..c581aab --- /dev/null +++ b/conf/settings.json @@ -0,0 +1,70 @@ +{ + "alt-speed-down": 50, + "alt-speed-enabled": false, + "alt-speed-time-begin": 540, + "alt-speed-time-day": 127, + "alt-speed-time-enabled": false, + "alt-speed-time-end": 1020, + "alt-speed-up": 50, + "bind-address-ipv4": "0.0.0.0", + "bind-address-ipv6": "::", + "blocklist-enabled": false, + "blocklist-url": "http://www.example.com/blocklist", + "cache-size-mb": 4, + "dht-enabled": true, + "download-dir": "/home/yunohost.transmission/completed", + "download-limit": 100, + "download-limit-enabled": 0, + "download-queue-enabled": true, + "download-queue-size": 5, + "encryption": 1, + "idle-seeding-limit": 30, + "idle-seeding-limit-enabled": false, + "incomplete-dir": "/home/yunohost.transmission/progress", + "incomplete-dir-enabled": true, + "lpd-enabled": false, + "max-peers-global": 200, + "message-level": 2, + "peer-congestion-algorithm": "", + "peer-limit-global": 240, + "peer-limit-per-torrent": 60, + "peer-port": 51413, + "peer-port-random-high": 65535, + "peer-port-random-low": 49152, + "peer-port-random-on-start": false, + "peer-socket-tos": "default", + "pex-enabled": true, + "port-forwarding-enabled": false, + "preallocation": 1, + "prefetch-enabled": 1, + "queue-stalled-enabled": true, + "queue-stalled-minutes": 30, + "ratio-limit": 2, + "ratio-limit-enabled": false, + "rename-partial-files": true, + "rpc-authentication-required": false, + "rpc-bind-address": "0.0.0.0", + "rpc-enabled": true, + "rpc-password": "{22ef1abe361f619946cf9ce68c442d27f73512d5lL3qJ6bY", + "rpc-port": 9091, + "rpc-url": "PATHTOCHANGE/transmission/", + "rpc-username": "transmission", + "rpc-whitelist": "127.0.0.1", + "rpc-whitelist-enabled": false, + "scrape-paused-torrents-enabled": true, + "script-torrent-done-enabled": false, + "script-torrent-done-filename": "", + "seed-queue-enabled": false, + "seed-queue-size": 10, + "speed-limit-down": 100, + "speed-limit-down-enabled": false, + "speed-limit-up": 100, + "speed-limit-up-enabled": false, + "start-added-torrents": true, + "trash-original-torrent-files": false, + "umask": 18, + "upload-limit": 100, + "upload-limit-enabled": 0, + "upload-slots-per-torrent": 14, + "utp-enabled": true +} diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..1b419ce --- /dev/null +++ b/manifest.json @@ -0,0 +1,30 @@ +{ + "name": "Transmission", + "id": "transmission", + "description": { + "en": "A Fast, Easy, and Free BitTorrent Client", + "fr": "Un client BitTorrent libre et rapide" + }, + "developer": { + "name": "kload", + "email": "kload@kload.fr", + "url": "http://kload.fr" + }, + "multi_instance": "false", + "arguments": { + "install": [ + { + "name": "domain", + "ask": { + "en": "Choose a domain for Transmission (i.e. mydomain.org)" + } + }, + { + "name": "path", + "ask": { + "en": "Choose a path for Transmission (i.e. /torrent)" + } + } + ] + } +} diff --git a/scripts/install b/scripts/install new file mode 100644 index 0000000..871dd0f --- /dev/null +++ b/scripts/install @@ -0,0 +1,38 @@ +#!/bin/bash + +# Retrieve arguments +domain=$1 +path=$2 + +sudo yunohost app checkurl $domain$path -a transmission +if [[ ! $? -eq 0 ]]; then exit 1 fi + +# Remove trailing "/" for next commands +path=${path%/} + +# Check port availability +sudo yunohost app checkport 9091 +if [[ ! $? -eq 0 ]]; then exit 1 fi +sudo yunohost app checkport 51413 +if [[ ! $? -eq 0 ]]; then exit 1 fi + +# Install official debian package +sudo apt-get install transmission-daemon -y -qq + +# Make directories and set rights +sudo mkdir -p /home/yunohost.transmission/{progress,completed} +sudo chgrp debian-transmission /home/yunohost.transmission/{progress,completed} +sudo chmod 770 -R /home/yunohost.transmission/{progress,completed} + +# Configure Transmission and reload +sed -i "s@/PATHTOCHANGE@$path@g" ../conf/settings.json +sudo cp ../conf/settings.json /etc/transmission-daemon/settings.json +sudo service transmission-daemon reload + +# Open port in firewall +sudo yunohost firewall allow TCP 51413 + +# Configure Nginx and reload +sed -i "s@/PATHTOCHANGE@$path@g" ../conf/nginx.conf +sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/transmission.conf +sudo service nginx reload