Release
This commit is contained in:
18
README.md
Executable file
18
README.md
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
RuTorrent for Yunohost
|
||||||
|
============
|
||||||
|
|
||||||
|
Install ruTorrent + rtorrent
|
||||||
|
|
||||||
|
Official website: <http://libtorrent.rakshasa.no/>
|
||||||
|
|
||||||
|
Info
|
||||||
|
----
|
||||||
|
|
||||||
|
This package install only a shared instance of rutorrent/rtorrent.
|
||||||
|
|
||||||
|
Every user who has access to rutorrent sees all the torrents
|
||||||
|
|
||||||
|
Versions
|
||||||
|
--------
|
||||||
|
|
||||||
|
rtorrent v0.9.4 and libtorrent 0.13.4
|
||||||
46
manifest.json
Executable file
46
manifest.json
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "ruTorrent",
|
||||||
|
"id": "rutorrent",
|
||||||
|
"description": {
|
||||||
|
"en": "Torrent client",
|
||||||
|
"fr": "Client torrent"
|
||||||
|
},
|
||||||
|
"developer": {
|
||||||
|
"name": "Andrea Cotza",
|
||||||
|
"email": "andrea@cotza.me"
|
||||||
|
},
|
||||||
|
"multi_instance": "false",
|
||||||
|
"arguments": {
|
||||||
|
"install": [
|
||||||
|
{
|
||||||
|
"name": "domain",
|
||||||
|
"type": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a domain for ruTorrent",
|
||||||
|
"fr": "Choisissez un domaine pour ruTorrent"
|
||||||
|
},
|
||||||
|
"example": "domain.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"type": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for ruTorrent",
|
||||||
|
"fr": "Choisissez un chemin pour ruTorrent"
|
||||||
|
},
|
||||||
|
"example": "/rutorrent",
|
||||||
|
"default": "/rutorrent"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "data_dir",
|
||||||
|
"type": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a folder to store the downloads",
|
||||||
|
"fr": "Choisissez un dossier pour sauver les telechargements"
|
||||||
|
},
|
||||||
|
"example": "/mnt/disk1/torrents",
|
||||||
|
"default": "/home/rtorrent"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
134
scripts/install
Executable file
134
scripts/install
Executable file
@@ -0,0 +1,134 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$1
|
||||||
|
path=$2
|
||||||
|
data_dir=$3
|
||||||
|
current_dir=${PWD}
|
||||||
|
debian_version=$(lsb_release -c -s)
|
||||||
|
|
||||||
|
# Check domain/path availability
|
||||||
|
sudo yunohost app checkurl $domain$path -a rutorrent
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
echo "Error: domain/path not available"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install sources
|
||||||
|
if [ "$debian_version" = "jessie" ]; then
|
||||||
|
sudo apt-get install -y deb-multimedia-keyring
|
||||||
|
echo 'deb http://ftp2.fr.debian.org/debian/ jessie main non-free' | sudo tee -a /etc/apt/sources.list.d/rutorrent.list
|
||||||
|
echo 'deb-src http://ftp2.fr.debian.org/debian/ jessie main non-free' | sudo tee -a /etc/apt/sources.list.d/rutorrent.list
|
||||||
|
echo 'deb ftp://ftp.deb-multimedia.org jessie main non-free' | sudo tee -a /etc/apt/sources.list.d/rutorrent.list
|
||||||
|
else
|
||||||
|
echo 'deb http://ftp2.fr.debian.org/debian/ wheezy main non-free' | sudo tee -a /etc/apt/sources.list.d/rutorrent.list
|
||||||
|
echo 'deb-src http://ftp2.fr.debian.org/debian/ wheezy main non-free' | sudo tee -a /etc/apt/sources.list.d/rutorrent.list
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install de dependencies
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y htop automake libcppunit-dev libtool build-essential pkg-config libssl-dev libcurl4-openssl-dev libsigc++-2.0-dev libncurses5-dev screen subversion apache2-utils php5-cli php5-geoip unzip unrar rar zip ffmpeg buildtorrent mediainfo
|
||||||
|
|
||||||
|
# Build xmlrpc
|
||||||
|
cd /tmp
|
||||||
|
sudo svn checkout http://svn.code.sf.net/p/xmlrpc-c/code/stable xmlrpc-c
|
||||||
|
cd xmlrpc-c/
|
||||||
|
sudo ./configure
|
||||||
|
sudo make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
# Build libtorrent
|
||||||
|
cd /tmp
|
||||||
|
sudo git clone https://github.com/rakshasa/libtorrent.git
|
||||||
|
cd libtorrent
|
||||||
|
sudo git checkout 0.13.4
|
||||||
|
sudo ./autogen.sh
|
||||||
|
sudo ./configure
|
||||||
|
sudo make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
# Build rtorrent
|
||||||
|
cd /tmp
|
||||||
|
sudo git clone https://github.com/rakshasa/rtorrent.git
|
||||||
|
cd rtorrent
|
||||||
|
sudo git checkout 0.9.4
|
||||||
|
sudo ./autogen.sh
|
||||||
|
sudo ./configure --with-xmlrpc-c
|
||||||
|
sudo make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
sudo ldconfig
|
||||||
|
|
||||||
|
# Install rutorrent
|
||||||
|
sudo git clone https://github.com/Novik/ruTorrent.git /var/www/rutorrent
|
||||||
|
|
||||||
|
# Install rutorrent plugins
|
||||||
|
cd /var/www/rutorrent/plugins/
|
||||||
|
|
||||||
|
sudo git clone https://github.com/xombiemp/rutorrentMobile.git mobile
|
||||||
|
|
||||||
|
sudo svn checkout http://svn.rutorrent.org/svn/filemanager/trunk/filemanager
|
||||||
|
|
||||||
|
# Configure plugins
|
||||||
|
cd $current_dir
|
||||||
|
|
||||||
|
sudo rm /var/www/rutorrent/plugins/create/conf.php
|
||||||
|
sudo cp ../sources/plugins/create/conf.php /var/www/rutorrent/plugins/create/conf.php
|
||||||
|
|
||||||
|
sudo rm /var/www/rutorrent/plugins/filemanager/conf.php
|
||||||
|
sudo cp ../sources/plugins/filemanager/conf.php /var/www/rutorrent/plugins/filemanager/conf.php
|
||||||
|
|
||||||
|
sudo rm /var/www/rutorrent/plugins/mobile/init.js
|
||||||
|
sudo cp ../sources/plugins/mobile/init.js /var/www/rutorrent/plugins/mobile/init.js
|
||||||
|
|
||||||
|
# Configure nginx
|
||||||
|
sudo sed -i "s@PATHTOCHANGE@$path@g" ../sources/nginx/rutorrent.conf
|
||||||
|
sudo cp ../sources/nginx/rutorrent.conf /etc/nginx/conf.d/$domain.d/rutorrent.conf
|
||||||
|
|
||||||
|
# Create data dir
|
||||||
|
sudo mkdir $data_dir
|
||||||
|
sudo mkdir $data_dir/watch
|
||||||
|
sudo mkdir $data_dir/downloads
|
||||||
|
sudo mkdir $data_dir/.session
|
||||||
|
|
||||||
|
# Create rtorrent user
|
||||||
|
sudo useradd -p $(openssl passwd -1 rtorrent) -m rtorrent
|
||||||
|
|
||||||
|
# Add rtorrent config
|
||||||
|
sudo sed -i "s@DATA_DIR@$data_dir@g" ../sources/rtorrent/rtorrent.rc
|
||||||
|
sudo cp ../sources/rtorrent/rtorrent.rc /home/rtorrent/.rtorrent.rc
|
||||||
|
sudo chown -R rtorrent:www-data /home/rtorrent/.rtorrent.rc
|
||||||
|
|
||||||
|
sudo chown -R rtorrent:www-data $data_dir
|
||||||
|
sudo chmod 755 $data_dir
|
||||||
|
|
||||||
|
# Configure rutorrent
|
||||||
|
sudo sed -i "s@DATA_DIR@$data_dir@g" ../sources/rutorrent/config.php
|
||||||
|
sudo cp ../sources/rutorrent/config.php /var/www/rutorrent/conf/config.php
|
||||||
|
sudo chown -R www-data:www-data /var/www/rutorrent
|
||||||
|
|
||||||
|
# Check port availability
|
||||||
|
sudo yunohost app checkport 45069
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Open port in firewall
|
||||||
|
sudo yunohost firewall allow TCP 45069 > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Launch rtorrent on boot
|
||||||
|
sudo cp ../sources/init/rtorrent /etc/init.d/rtorrent
|
||||||
|
sudo chmod +x /etc/init.d/rtorrent
|
||||||
|
sudo update-rc.d rtorrent defaults
|
||||||
|
|
||||||
|
# Start rtorrent
|
||||||
|
sudo service rtorrent start
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
sudo service nginx reload
|
||||||
|
|
||||||
|
# Save config
|
||||||
|
sudo yunohost app setting rutorrent data_dir -v $data_dir
|
||||||
|
sudo yunohost app setting rutorrent path -v $path
|
||||||
|
|
||||||
|
# Register the service on yunohost
|
||||||
|
sudo yunohost service add rtorrent
|
||||||
26
scripts/remove
Executable file
26
scripts/remove
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
domain=$(sudo yunohost app setting rutorrent domain)
|
||||||
|
data_dir=$(sudo yunohost app setting rutorrent data_dir)
|
||||||
|
|
||||||
|
sudo service rtorrent stop
|
||||||
|
|
||||||
|
sudo rm -rf /var/www/rutorrent
|
||||||
|
sudo rm -rf $data_dir
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/rutorrent.conf
|
||||||
|
sudo rm -f /etc/init.d/rtorrent
|
||||||
|
|
||||||
|
# Remove the user
|
||||||
|
sudo userdel -f rtorrent
|
||||||
|
sudo rm -rf /home/rtorrent
|
||||||
|
|
||||||
|
# Remove the service
|
||||||
|
sudo yunohost service remove rtorrent
|
||||||
|
|
||||||
|
# Remove the sources
|
||||||
|
sudo rm -f /etc/apt/sources.list.d/rutorrent.list
|
||||||
|
|
||||||
|
# Remove rtorrent
|
||||||
|
sudo rm -f /usr/local/bin/rtorrent
|
||||||
|
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
sudo service nginx reload
|
||||||
0
scripts/upgrade
Normal file
0
scripts/upgrade
Normal file
36
sources/init/rtorrent
Normal file
36
sources/init/rtorrent
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Dépendance : screen, killall et rtorrent
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: <username>-rtorrent
|
||||||
|
# Required-Start: $syslog $network
|
||||||
|
# Required-Stop: $syslog $network
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Start daemon at boot time
|
||||||
|
# Description: Start-Stop rtorrent user session
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
## Début configuration ##
|
||||||
|
user="rtorrent"
|
||||||
|
## Fin configuration ##
|
||||||
|
|
||||||
|
rt_start() {
|
||||||
|
su --command="screen -dmS rtorrent rtorrent" "${user}"
|
||||||
|
}
|
||||||
|
|
||||||
|
rt_stop() {
|
||||||
|
killall --user "${user}" screen
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start) echo "Starting rtorrent..."; rt_start
|
||||||
|
;;
|
||||||
|
stop) echo "Stopping rtorrent..."; rt_stop
|
||||||
|
;;
|
||||||
|
restart) echo "Restart rtorrent..."; rt_stop; sleep 1; rt_start
|
||||||
|
;;
|
||||||
|
*) echo "Usage: $0 {start|stop|restart}"; exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
exit 0
|
||||||
27
sources/nginx/rutorrent.conf
Normal file
27
sources/nginx/rutorrent.conf
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
location PATHTOCHANGE {
|
||||||
|
alias /var/www/rutorrent;
|
||||||
|
|
||||||
|
if ($scheme = http) {
|
||||||
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
client_max_body_size 10G;
|
||||||
|
index index.html;
|
||||||
|
try_files $uri $uri/ index.html;
|
||||||
|
location ~ [^/]\.php(/|$) {
|
||||||
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
|
fastcgi_index index.html;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
location PATHTOCHANGE/RPC2 {
|
||||||
|
scgi_pass 127.0.0.1:5000;
|
||||||
|
include scgi_params;
|
||||||
|
scgi_param SCRIPT_NAME /RPC2;
|
||||||
|
}
|
||||||
13
sources/plugins/create/conf.php
Executable file
13
sources/plugins/create/conf.php
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
// configuration parameters
|
||||||
|
|
||||||
|
$useExternal = 'buildtorrent'; // Valid choices:
|
||||||
|
// false - use internal realization (may be too slow for large files)
|
||||||
|
// "transmissioncli" - use program transmissioncli (see http://www.transmissionbt.com/)
|
||||||
|
// "transmissioncreate" - use program transmissioncreate (see http://www.transmissionbt.com/)
|
||||||
|
// "createtorrent" - use program createtorrent (see http://www.createtorrent.com)
|
||||||
|
// "mktorrent" - use program createtorrent (see http://mktorrent.sourceforge.net)
|
||||||
|
// "buildtorrent" - use program buildtorrent (see http://claudiusmaximus.goto10.org/cm/torrent.html)
|
||||||
|
$pathToCreatetorrent = ''/usr/bin/buildtorrent'; // Something like /bin/createtorrent, or /bin/transmissioncli. If empty, program will be found in PATH.
|
||||||
|
|
||||||
|
$recentTrackersMaxCount = 15;
|
||||||
29
sources/plugins/filemanager/conf.php
Normal file
29
sources/plugins/filemanager/conf.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$fm['tempdir'] = '/tmp'; // path were to store temporary data ; must be writable
|
||||||
|
$fm['mkdperm'] = 755; // default permission to set to new created directories
|
||||||
|
|
||||||
|
// set with fullpath to binary or leave empty
|
||||||
|
$pathToExternals['rar'] = '/usr/bin/rar';
|
||||||
|
$pathToExternals['zip'] = '/usr/bin/zip';
|
||||||
|
$pathToExternals['unzip'] = '/usr/bin/unzip';
|
||||||
|
$pathToExternals['tar'] = '/bin/tar';
|
||||||
|
$pathToExternals['gzip'] = '/bin/gzip';
|
||||||
|
$pathToExternals['bzip2'] = '/bin/bzip2';
|
||||||
|
|
||||||
|
|
||||||
|
// archive mangling, see archiver man page before editing
|
||||||
|
|
||||||
|
$fm['archive']['types'] = array('rar', 'zip', 'tar', 'gzip', 'bzip2');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$fm['archive']['compress'][0] = range(0, 5);
|
||||||
|
$fm['archive']['compress'][1] = array('-0', '-1', '-9');
|
||||||
|
$fm['archive']['compress'][2] = $fm['archive']['compress'][3] = $fm['archive']['compress'][4] = array(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
1402
sources/plugins/mobile/init.js
Normal file
1402
sources/plugins/mobile/init.js
Normal file
File diff suppressed because it is too large
Load Diff
20
sources/rtorrent/rtorrent.rc
Normal file
20
sources/rtorrent/rtorrent.rc
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
scgi_port = 127.0.0.1:5000
|
||||||
|
encoding_list = UTF-8
|
||||||
|
port_range = 45069-45069
|
||||||
|
port_random = no
|
||||||
|
check_hash = no
|
||||||
|
directory = DATA_DIR/downloads
|
||||||
|
session = DATA_DIR/.session
|
||||||
|
encryption = allow_incoming, try_outgoing, enable_retry
|
||||||
|
schedule = watch_directory,1,1,"load_start=DATA_DIR/watch/*.torrent"
|
||||||
|
schedule = untied_directory,5,5,"stop_untied=DATA_DIR/watch/*.torrent"
|
||||||
|
use_udp_trackers = yes
|
||||||
|
dht = off
|
||||||
|
peer_exchange = no
|
||||||
|
min_peers = 40
|
||||||
|
max_peers = 100
|
||||||
|
min_peers_seed = 10
|
||||||
|
max_peers_seed = 50
|
||||||
|
max_uploads = 15
|
||||||
|
execute = {sh,-c,/usr/bin/php /var/www/rutorrent/php/initplugins.php &}
|
||||||
|
schedule = espace_disque_insuffisant,1,30,close_low_diskspace=500M
|
||||||
64
sources/rutorrent/config.php
Executable file
64
sources/rutorrent/config.php
Executable file
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
// configuration parameters
|
||||||
|
|
||||||
|
// for snoopy client
|
||||||
|
@define('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 6.0; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0', true);
|
||||||
|
@define('HTTP_TIME_OUT', 30, true); // in seconds
|
||||||
|
@define('HTTP_USE_GZIP', true, true);
|
||||||
|
$httpIP = null; // IP string. Or null for any.
|
||||||
|
|
||||||
|
@define('RPC_TIME_OUT', 5, true); // in seconds
|
||||||
|
|
||||||
|
@define('LOG_RPC_CALLS', false, true);
|
||||||
|
@define('LOG_RPC_FAULTS', true, true);
|
||||||
|
|
||||||
|
// for php
|
||||||
|
@define('PHP_USE_GZIP', false, true);
|
||||||
|
@define('PHP_GZIP_LEVEL', 2, true);
|
||||||
|
|
||||||
|
$schedule_rand = 10; // rand for schedulers start, +0..X seconds
|
||||||
|
|
||||||
|
$do_diagnostic = true;
|
||||||
|
$log_file = '/tmp/errors.log'; // path to log file (comment or leave blank to disable logging)
|
||||||
|
|
||||||
|
$saveUploadedTorrents = true; // Save uploaded torrents to profile/torrents directory or not
|
||||||
|
$overwriteUploadedTorrents = false; // Overwrite existing uploaded torrents in profile/torrents directory or make unique name
|
||||||
|
|
||||||
|
$topDirectory = 'DATA_DIR/downloads'; // Upper available directory. Absolute path with trail slash.
|
||||||
|
$forbidUserSettings = false;
|
||||||
|
|
||||||
|
$scgi_port = 5000;
|
||||||
|
$scgi_host = "127.0.0.1";
|
||||||
|
|
||||||
|
// For web->rtorrent link through unix domain socket
|
||||||
|
// (scgi_local in rtorrent conf file), change variables
|
||||||
|
// above to something like this:
|
||||||
|
//
|
||||||
|
// $scgi_port = 0;
|
||||||
|
// $scgi_host = "unix:///tmp/rpc.socket";
|
||||||
|
|
||||||
|
$XMLRPCMountPoint = "/RPC2"; // DO NOT DELETE THIS LINE!!! DO NOT COMMENT THIS LINE!!!
|
||||||
|
|
||||||
|
$pathToExternals = array(
|
||||||
|
"php" => '', // Something like /usr/bin/php. If empty, will be found in PATH.
|
||||||
|
"curl" => '/usr/bin/curl', // Something like /usr/bin/curl. If empty, will be found in PATH.
|
||||||
|
"gzip" => '', // Something like /usr/bin/gzip. If empty, will be found in PATH.
|
||||||
|
"id" => '', // Something like /usr/bin/id. If empty, will be found in PATH.
|
||||||
|
"stat" => '', // Something like /usr/bin/stat. If empty, will be found in PATH.
|
||||||
|
);
|
||||||
|
|
||||||
|
$localhosts = array( // list of local interfaces
|
||||||
|
"127.0.0.1",
|
||||||
|
"localhost",
|
||||||
|
);
|
||||||
|
|
||||||
|
$profilePath = '../share'; // Path to user profiles
|
||||||
|
$profileMask = 0777; // Mask for files and directory creation in user profiles.
|
||||||
|
// Both Webserver and rtorrent users must have read-write access to it.
|
||||||
|
// For example, if Webserver and rtorrent users are in the same group then the value may be 0770.
|
||||||
|
|
||||||
|
$tempDirectory = null; // Temp directory. Absolute path with trail slash. If null, then autodetect will be used.
|
||||||
|
|
||||||
|
$canUseXSendFile = true; // Use X-Sendfile feature if it exist
|
||||||
|
|
||||||
|
$locale = "UTF8";
|
||||||
Reference in New Issue
Block a user