forked from artyuum/filemanager-install-script-for-rutorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilemanager.sh
76 lines (59 loc) · 2.4 KB
/
filemanager.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Link: https://github.com/ArtyumX/Filemanager-install-script-for-ruTorrent
# --------------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# * <[email protected]> wrote this file. As long as you retain this notice you
# * can do whatever you want with this stuff. If we meet some day, and you think
# * this stuff is worth it, you can buy me a beer in return Poul-Henning Kamp
# --------------------------------------------------------------------------------
clear
# Checking if user is root
if [ "$(id -u)" != "0" ]; then
echo
echo "Sorry, this script must be run as root." 1>&2
echo
exit 1
fi
# Asking for the ruTorrent path folder
read -p "Please type your ruTorrent path folder: " -e -i /var/www/rutorrent rutorrent_path
# Installing dependencies
apt-get install subversion zip
cd /tmp
if [ `getconf LONG_BIT` = "64" ]
then
wget -O rarlinux.tar.gz https://www.rarlab.com/rar/rarlinux-x64-5.8.0.tar.gz
else
wget -O rarlinux.tar.gz https://www.rarlab.com/rar/rarlinux-5.8.0.tar.gz
fi
tar -xzvf rarlinux.tar.gz
rm rarlinux.tar.gz
mv -v rar/rar /usr/local/bin/rar
chmod 755 /usr/local/bin/rar
# Installing and configuring filemanager plugin
cd $rutorrent_path/plugins/
svn co https://github.com/nelu/rutorrent-thirdparty-plugins/trunk/filemanager
cat > $rutorrent_path/plugins/filemanager/conf.php << EOF
<?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'] = '$(which rar)';
\$pathToExternals['zip'] = '$(which zip)';
\$pathToExternals['unzip'] = '$(which unzip)';
\$pathToExternals['tar'] = '$(which tar)';
\$pathToExternals['bzip2'] = '$(which 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);
?>
EOF
# Permissions for filemanager
chown -R www-data:www-data $rutorrent_path/plugins/filemanager
chmod -R 775 $rutorrent_path/plugins/filemanager/scripts
# End of the script
clear
echo
echo
echo -e "\033[0;32;148mInstallation done.\033[39m"