-
Notifications
You must be signed in to change notification settings - Fork 2
/
rutorrent3.7-Auto-Install.v2.1
1011 lines (895 loc) · 35.8 KB
/
rutorrent3.7-Auto-Install.v2.1
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# PLEASE DO NOT SET ANY OF THE VARIABLES, THEY WILL BE POPULATED IN THE MENU
# Stop when errors, do not place before #!/bin/bash
set -e
clear
# Formatting variables
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
GREEN=$(tput setaf 2)
LBLUE=$(tput setaf 6)
RED=$(tput setaf 1)
PURPLE=$(tput setaf 5)
# The system user rtorrent is going to run as
RTORRENT_USER=""
# The user that is going to log into rutorrent (htaccess)
WEB_USER=""
# Array with webusers including their hashed paswords
WEB_USER_ARRAY=()
# Temporary download folder for plugins
TEMP_PLUGIN_DIR="/tmp/rutorrentPlugins"
# Array of downloaded plugins
PLUGIN_ARRAY=()
#rTorrent users home dir.
HOMEDIR=""
# Function to check if running user is root
function CHECK_ROOT {
if [ "$(id -u)" != "0" ]; then
echo
echo "This script must be run as root." 1>&2
echo
exit 1
fi
}
# Checks for apache2-utils and unzip if it's installed. It's is needed to make the Web user
function APACHE_UTILS {
set +e
AP_UT_CHECK="$(dpkg-query -W -f='${Status}' apache2-utils 2>/dev/null | grep -c "ok installed")"
UNZIP_CHECK="$(dpkg-query -W -f='${Status}' unzip 2>/dev/null | grep -c "ok installed")"
CURL_CHECK="$(dpkg-query -W -f='${Status}' curl 2>/dev/null | grep -c "ok installed")"
set -e
if [ "$AP_UT_CHECK" -ne 1 ] || [ "$UNZIP_CHECK" -ne 1 ] || [ "$CURL_CHECK" -ne 1 ]; then
echo " One or more of the packages apache2-utils, unzip or curl is not installed and is needed for the setup."
read -p " Do you want to install it? [y/n] " -n 1
if [[ $REPLY =~ [Yy]$ ]]; then
clear
apt-get update
apt-get install apache2-utils unzip curl
else
clear
exit
fi
fi
}
# License
function LICENSE {
clear
echo "${BOLD}--------------------------------------------------------------------------------"
echo " THE BEER-WARE LICENSE (Revision 42):"
echo " <[email protected]> wrote this script. As long as you retain this notice you"
echo " can do whatever you want with this stuff. If we meet some day, and you think"
echo " this stuff is worth it, you can buy me a beer in return."
echo
echo " - ${LBLUE}Patrick Kerwood @ LinuxBloggen.dk${NORMAL}"
echo "${BOLD}--------------------------------------------------------------------------------${NORMAL}"
echo
read -p " Press any key to continue..." -n 1
echo
}
# Function to set the system user, rtorrent is going to run as
function SET_RTORRENT_USER {
con=0
while [ $con -eq 0 ]; do
echo -n "Please type a valid system user: "
read RTORRENT_USER
if [[ -z $(cat /etc/passwd | grep "^$RTORRENT_USER:") ]]; then
echo
echo "This user does not exist!"
elif [[ $(cat /etc/passwd | grep "^$RTORRENT_USER:" | cut -d: -f3) -lt 999 ]]; then
echo
echo "That user's UID is too low!"
elif [[ $RTORRENT_USER == nobody ]]; then
echo
echo "You cant use 'nobody' as user!"
else
HOMEDIR=$(cat /etc/passwd | grep "$RTORRENT_USER": | cut -d: -f6)
con=1
fi
done
}
# Function to create users for the webinterface
function SET_WEB_USER {
while true; do
echo -n "Please type the username for the webinterface, system user not required: "
read WEB_USER
USER=$(htpasswd -n $WEB_USER 2>/dev/null)
if [ $? = 0 ]; then
WEB_USER_ARRAY+=($USER)
break
else
echo
echo "${RED}Something went wrong!"
echo "You have entered an unusable username and/or different passwords.${NORMAL}"
echo
fi
done
}
# Function to list WebUI users in the menu
function LIST_WEB_USERS {
for i in ${WEB_USER_ARRAY[@]}; do
USER_CUT=$(echo $i | cut -d \: -f 1)
echo -n " $USER_CUT"
done
}
# Function to list plugins, downloaded, in the menu
function LIST_PLUGINS {
if [ ${#PLUGIN_ARRAY[@]} -eq 0 ]; then
echo " No plugins downloaded!"
else
for i in "${PLUGIN_ARRAY[@]}"; do
echo " - $i"
done
fi
}
# Header for the menu
function HEADER {
read -p " Press any key to continue..." -n 1
clear
echo "${BOLD}--------------------------------------------------------------------------------"
echo " Rtorrent + Rutorrent Auto Install"
echo " ${LBLUE}Patrick Kerwood @ LinuxBloggen.dk${NORMAL}"
echo "${BOLD}--------------------------------------------------------------------------------${NORMAL}"
echo
}
# Function for the Plugins download part.
function DOWNLOAD_PLUGIN {
echo
echo -e "$desc"
echo
read -p "Download ${LBLUE}$name${NORMAL} [y/n]: " -n 1
if [[ $REPLY =~ [Yy]$ ]]; then
echo
curl -L "$url" -o $file
$unpack
if [ $? -eq "0" ]; then
rm "$file"
echo
PLUGIN_ARRAY+=("${name}")
error="${GREEN}${BOLD}$name${NORMAL}${GREEN} downloaded, unpacked and moved to temporary plugins folder${NORMAL}"
return 0
else
echo
error="${RED}Something went wrong.. Error!${NORMAL}"
return 1
fi
else
return 1
fi
echo
}
function SELECT_PLUGINS {
if [ ! -d $TEMP_PLUGIN_DIR ]; then
mkdir $TEMP_PLUGIN_DIR
fi
clear
while true; do
echo
echo "${GREEN}--------------------------------------------------------------------------------${NORMAL}"
echo
echo "1 - Erase Data"
echo "2 - Create v3.6"
echo "3 - Traffic v3.6"
echo "4 - RSS v3.6"
echo "5 - Edit v3.6"
echo "6 - Retrackers v3.6"
echo "7 - Throttle v3.6"
echo "8 - Cookies v3.6"
echo "9 - Scheduler v3.6"
echo "10 - Auto Tools v3.6"
echo "11 - Data Dir v3.6"
echo "12 - Track Lables v3.6"
echo "13 - Geo IP v3.6"
echo "14 - Ratio v3.6"
echo "15 - Show Peers like wTorrent v3.6"
echo "16 - Seeding Time v3.6"
echo "17 - HTTPRPC v3.6"
echo "18 - Diskspace v3.6"
echo "19 - Unpack v3.6"
echo "20 - Get Dir v3.6"
echo "21 - Source v3.6"
echo "22 - Chunks v3.6"
echo "23 - Data v3.6"
echo "24 - CPU Load v3.6"
echo "25 - Extsearch v3.6"
echo "26 - Theme v3.6"
echo "27 - Login Mgr v3.6"
echo "28 - ruTorrent Label Management Suite v1.1"
echo "29 - NFO"
echo "30 - Chat v2.0"
echo "31 - Logoff v1.3"
echo "32 - Pause v1.2"
echo "33 - Instant Search v1.0"
echo "34 - File Drop v3.6 (FF > 3.6 & Chrome only)"
echo "35 - Check Port v3.6"
echo "36 - History v3.6"
echo "37 - iPad v3.6"
echo "38 - Extended Ratio v3.6"
echo "39 - Feeds v3.6"
echo "40 - Media Information v3.6"
echo "41 - RSS URL Rewrite v3.6"
echo "42 - Screenshot v3.6"
echo "43 - RPC v3.6"
echo "44 - Rutracker Check v3.6"
echo "45 - Noty v3.6"
echo "46 - Task v3.6"
echo "47 - All Plugins v3.6. More at https://github.com/Novik/ruTorrent/wiki/Plugins"
echo
echo "0 - Exit plugin installation"
echo
echo "${GREEN}--------------------------------------------------------------------------------${NORMAL}"
echo
echo -e $error1
unset error1
echo
echo -n "Choose plugin to see info: "
read -e plugin
case $plugin in
1)
name="Erase Data Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/erasedata-3.6.tar.gz"
file="erasedata-3.6.tar.gz"
desc=" This plugin adds a context menu item to the right click menu which allows you to delete data. \n http://code.google.com/p/rutorrent/wiki/PluginErasedata"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
2)
name="Create Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/create-3.6.tar.gz"
file="create-3.6.tar.gz"
desc="This plugin allows for the creation of new .torrent files from a file or directory full of files.\nhttp://code.google.com/p/rutorrent/wiki/PluginCreate"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
3)
name="Trafic Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/trafic-3.6.tar.gz"
file="trafic-3.6.tar.gz"
desc="The Trafic plugin is a subsystem for monitoring rtorrent traffic totals.\nIt tracks both system wide and per-tracker totals.\nThe plugin can display totals in three formats, hourly, daily, and mouthly.\nStatistics can be cleaned out at any time by clicking the 'Clear' button on the interface (see screenshot).\nhttp://code.google.com/p/rutorrent/wiki/PluginTrafic"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
4)
name="RSS Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/rss-3.6.tar.gz"
file="rss-3.6.tar.gz"
desc="This plugin is designed to fetch torrents via rss download links.\nIt has 2 main parts, one for entering feeds, the other for setting up filters.\nFor more information about rss, see http://en.wikipedia.org/wiki/RSS. \nhttp://code.google.com/p/rutorrent/wiki/PluginRSS"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
5)
name="Edit Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/edit-3.6.tar.gz"
file="edit-3.6.tar.gz"
desc="This plugin allows you to edit the list of trackers, and change the comment of the current torrent.\nAfter installation, a new context menu item will become available when you right click a torrent from the list, 'Edit Torrent...'\nSelecting this will open the 'Torrent Properties' menu.\nhttp://code.google.com/p/rutorrent/wiki/PluginEdit"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
6)
name="Retrackers Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/retrackers-3.6.tar.gz"
file="retrackers-3.6.tar.gz"
desc="This plug-in appends specified trackers to the trackers list of all newly added torrents.\nBy the way, torrents may be added by any way - not just via ruTorrent.\nhttp://code.google.com/p/rutorrent/wiki/PluginRetrackers"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
7)
name="Throttle Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/throttle-3.6.tar.gz"
file="throttle-3.6.tar.gz"
desc="In rTorrent version 0.8.5 and later it is possible to set limits of speed for groups of torrents.\nThrottle plug-in gives a convenient control over this possibility.\nAfter this plug-in is installed a new option "Channels" will appear in the Settings dialog.\nSpeed limits for some (by default - 10) channels can be set here.\nAssignment of channel number for a particular torrent or for a group of torrents can be made in it's contextual menu.\nNote - '0'-value, conventionally for rTorrent, means 'no limits', but not 'stop torrent'.\nSo the lowest possible limit is 1 Kbps.\nhttp://code.google.com/p/rutorrent/wiki/PluginThrottle"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
8)
name="Cookies Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/cookies-3.6.tar.gz"
file="cookies-3.6.tar.gz"
desc="Some trackers use cookies for the client authentication.\nIt is transparent to user who uses a browser to work with such servers - browser store these cookies and returns them to the server automatically.\nThe user just needs to enter login/password from time to time.\nBut when rTorrent is used to work with such trackers (e.g. adding a torrent via URL) it might be a problem because rTorrent does not understand cookies.\nSo the the information from cookies should be provided for rTorrent separately.\nhttp://code.google.com/p/rutorrent/wiki/PluginCookies"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
9)
name="Scheduler v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/scheduler-3.6.tar.gz"
file="scheduler-3.6.tar.gz"
desc="http://code.google.com/p/rutorrent/wiki/PluginScheduler"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
10)
name="Auto Tools Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/autotools-3.6.tar.gz"
file="autotools-3.6.tar.gz"
desc="The plug-in provides some possibilities on automation. Following functions are realized for now:\nAuto Label automatic creation of labels at addition of new torrent through the web interface.\nAuto Move automatic transferring of torrent data files to other directory on downloading completion.\nAuto Watch automatic adding torrents to rtorrent via nested set of watch directories.\nhttp://code.google.com/p/rutorrent/wiki/PluginAutotools"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
11)
name="Data Dir Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/datadir-3.6.tar.gz"
file="datadir-3.6.tar.gz"
desc="The plug-in is intended for replacement of the current torrent data directory on another.\nSuch operation is required, for example, if the torrent data directory has been moved manually.\nIt is also possible to move downloaded torrent's data.\nAfter plug-in installation there will be a new item 'Save to...' in the context menu of the downloading area which shows a dialogue 'Torrent data directory'.\nIn this dialogue you can specify a new path to the torrent data.\nhttp://code.google.com/p/rutorrent/wiki/PluginDataDir"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
12)
name="Track Lables Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/tracklabels-3.6.tar.gz"
file="tracklabels-3.6.tar.gz"
desc="The plug-in adds a set of labels on the category panel.\nThese labels are created automatically on the basis of torrents' trackers.\nhttp://code.google.com/p/rutorrent/wiki/PluginTracklabels"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
13)
name="Geo IP Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/geoip-3.6.tar.gz"
file="geoip-3.6.tar.gz"
desc="Packages 'GeoLiteCity' and 'php5-geoip' will be installed. http://code.google.com/p/rutorrent/wiki/PluginGeoIP"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
if DOWNLOAD_PLUGIN ; then
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
mkdir -v /usr/share/GeoIP
gunzip GeoLiteCity.dat.gz
mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
rm GeoLiteCity.dat.gz
apt-get install php5-geoip
fi
;;
14)
name="Ratio Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/ratio-3.6.tar.gz"
file="ratio-3.6.tar.gz"
desc="Since version 0.8.5 rTorrent has a capability to set ratio limits for groups of torrents.\nThe plug-in allows to manage it conveniently.\nWhen the plug-in is installed a new section 'Ratio groups' appears in the Settings dialog.\nHere user can define limits of ratio for some (by default - 8) groups.\nAssignation of group to one or several torrents is performed by selecting an appropriate option in the context menu of torrents.\nhttp://code.google.com/p/rutorrent/wiki/PluginRatio"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
15)
name="Show Peers like wTorrent Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/show_peers_like_wtorrent-3.6.tar.gz"
file="show_peers_like_wtorrent-3.6.tar.gz"
desc="The plug-in changes the format of values in columns 'Seeds' and 'Peers' in the torrents list.\nhttp://code.google.com/p/rutorrent/wiki/PluginShow_peers_like_wtorrent"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
16)
name="Seeding Time Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/seedingtime-3.6.tar.gz"
file="seedingtime-3.6.tar.gz"
desc="The plug-in adds the columns 'Finished' and 'Added' to the torrents list.\nThis columns contains the time when download of the torrent was completed and, accordingly, the time when torrent was added.\nhttp://code.google.com/p/rutorrent/wiki/PluginSeedingtime"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
17)
name="HTTPRPC Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/httprpc-3.6.tar.gz"
file="httprpc-3.6.tar.gz"
desc="This plugin is designed as a easy to use replacement for the mod_scgi (or similar) webserver module, with emphasis on extremely low bandwidth use.\nIf you install this plugin, you do not need to use mod_scgi or the RPC Plugin.\nNote: This plugin requires a faster server, and is not recommended for embedded systems, like a router or slow computer.\nhttp://code.google.com/p/rutorrent/wiki/PluginHTTPRPC"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
18)
name="Diskspace Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/diskspace-3.6.tar.gz"
file="diskspace-3.6.tar.gz"
desc="This plugin adds an easy to read disk meter to the bottom menu bar.\nhttp://code.google.com/p/rutorrent/wiki/PluginDiskspace"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
19)
name="Unpack Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/unpack-3.6.tar.gz"
file="unpack-3.6.tar.gz"
desc="This plugin is designed to manually or automatically unrar/unzip torrent data. Package 'unrar-free' will be installed. \nhttp://code.google.com/p/rutorrent/wiki/PluginUnpack"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
if DOWNLOAD_PLUGIN ; then
apt-get install unrar-free
fi
;;
20)
name="Get Dir Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/_getdir-3.6.tar.gz"
file="_getdir-3.6.tar.gz"
desc="The service plug-in _getdir gives to other plug-ins the possibility of comfortable navigation on a host file system.\nShows only directories to which rtorrent can write and which php can show.\nhttp://code.google.com/p/rutorrent/wiki/Plugin_getdir"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
21)
name="Source Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/source-3.6.tar.gz"
file="source-3.6.tar.gz"
desc="This plugin adds a 'Get .torrent' item to the right click context menu.\nAllowing you to download the original .torrent file from the server, to your local machine.\nhttp://code.google.com/p/rutorrent/wiki/PluginSource"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
22)
name="Chunks Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/chunks-3.6.tar.gz"
file="chunks-3.6.tar.gz"
desc="This plugin adds a new tab to the tab bar called 'chunks'.\nThe added tab allows you to monitor the download status of each individual torrent 'piece'\nhttp://code.google.com/p/rutorrent/wiki/PluginChunks"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
23)
name="Data Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/data-3.6.tar.gz"
file="data-3.6.tar.gz"
desc="This plugin adds the 'Get Data' item to the right click menu.\nThis allows you to download the file in question via http to your local machine.\nOn 32 bit systems, you can not download files larger than 2 GB, this is due to a php limitation\nhttp://code.google.com/p/rutorrent/wiki/PluginData"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
24)
name="CPU Load Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/cpuload-3.6.tar.gz"
file="cpuload-3.6.tar.gz"
desc="This plugin adds a CPU Load usage bar to the bottom toolbar.\nhttp://code.google.com/p/rutorrent/wiki/PluginCpuload"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
25)
name="Extsearch Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/extsearch-3.6.tar.gz"
file="extsearch-3.6.tar.gz"
desc="This plugin adds the ability to search many popular torrent sites for content without leaving the rutorrent url.\nhttp://code.google.com/p/rutorrent/wiki/PluginExtsearch"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
26)
name="Theme Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/theme-3.6.tar.gz"
file="theme-3.6.tar.gz"
desc="This plugin allows you to change the gui theme to one of several provided themes, or any your create,\nprovided they are placed in the proper directory within the plugin.\nhttp://code.google.com/p/rutorrent/wiki/PluginTheme"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
27)
name="Login Mgr v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/loginmgr-3.6.tar.gz"
file="loginmgr-3.6.tar.gz"
desc="This plugin is used to login to 3rd party torrent sites.\nIt's designed to be used in cased where cookies fail.\nIt is a support plugin used for RSS and ExtSearch.\nNOTE: This plugin saves passwords in plain text.\nhttp://code.google.com/p/rutorrent/wiki/PluginLoginMgr"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
28)
name="Loot At v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/lookat-3.6.tar.gz"
file="lookat-3.6.tar.gz"
desc="This plugin is intended for looking torrent's name in the external sources."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
29)
name="NFO Plugin"
url="http://srious.biz/nfo.tar.gz"
file="nfo.tar.gz"
desc="This plugin shows the contents of the .nfo file for a given torrent.\nhttp://code.google.com/p/rutorrent/wiki/PluginNFO"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
30)
name="Chat Plugin v2.0"
url="http://rutorrent-chat.googlecode.com/files/chat-2.0.tar.gz"
file="chat-2.0.tar.gz"
desc="This plugin adds a chatbox to multi-user rutorrent installs.\nNOTE: Currently this is a single server chat program only (if you have multiple servers, this will NOT allow your users to chat across them).\nhttp://code.google.com/p/rutorrent/wiki/PluginChat"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
31)
name="Logoff Plugin v1.3"
url="http://rutorrent-logoff.googlecode.com/files/logoff-1.3.tar.gz"
file="logoff-1.3.tar.gz"
desc="This plugin allows you to switch users or logoff on systems which use authentication.\nhttp://code.google.com/p/rutorrent-logoff/"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
32)
name="Pause Plugin v1.2"
url="http://rutorrent-pausewebui.googlecode.com/files/pausewebui.1.2.zip"
file="pausewebui.1.2.zip"
desc="Plugin to pause the refresh timer, and add a button to manually refresh the page.\nhttp://code.google.com/p/rutorrent/wiki/PluginPause"
unpack="unzip $file -d $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
33)
name="Instant Search Plugin v1.0"
url="http://rutorrent-instantsearch.googlecode.com/files/instantsearch.1.0.zip"
file="instantsearch.1.0.zip"
desc="This plugin lets you search for local torrents running in rutorrent, updating results as you type them.\nhttp://code.google.com/p/rutorrent/wiki/PluginInstantSearch"
unpack="unzip $file -d $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
34)
name="File Drop v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/filedrop-3.6.tar.gz"
file="filedrop-3.6.tar.gz"
desc="This plugin allows users to drag multiple torrents from desktop to the browser (FF > 3.6 & Chrome only)."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
35)
name="Check Port v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/check_port-3.6.tar.gz"
file="check_port-3.6.tar.gz"
desc="This plugin adds an incoming port status indicator to the bottom bar."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
36)
name="History v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/history-3.6.tar.gz"
file="history-3.6.tar.gz"
desc="This plugin is designed to log a history of torrents."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
37)
name="iPad Plugin v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/ipad-3.6.tar.gz"
file="ipad-3.6.tar.gz"
desc="This plugin allows ruTorrent to work properly on iPad-like devices."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
38)
name="Extended Ratio v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/extratio-3.6.tar.gz"
file="extratio-3.6.tar.gz"
desc="This plugin extends the functionality of the ratio plugin."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
39)
name="Feeds v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/feeds-3.6.tar.gz"
file="feeds-3.6.tar.gz"
desc="This plugin is intended for making RSS feeds with information of torrents. \nhttp://code.google.com/p/rutorrent/wiki/PluginFeeds"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
40)
name="Media Information v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/mediainfo-3.6.tar.gz"
file="mediainfo-3.6.tar.gz"
desc="This plugin is intended to display media file information."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
if DOWNLOAD_PLUGIN ; then
apt-get install libzen0 libmediainfo0 mediainfo
wget http://dl.bintray.com/novik65/generic/plugins/_task-3.6.tar.gz
tar -zxvf _task-3.6.tar.gz -C $TEMP_PLUGIN_DIR
rm _task-3.6.tar.gz
fi
;;
41)
name="RSS URL Rewrite v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/rssurlrewrite-3.6.tar.gz"
file="rssurlrewrite-3.6.tar.gz"
desc="This plugin extends the functionality of the RSS plugin. \nhttp://code.google.com/p/rutorrent/wiki/PluginRSSURLRewrite"
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
42)
name="Screenshot v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/screenshots-3.6.tar.gz"
file="screenshots-3.6.tar.gz"
desc="This plugin is intended to show screenshots from video files. Package 'ffmpeg' will be installed."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
if DOWNLOAD_PLUGIN ; then
INSTALL_FFMPEG
wget http://dl.bintray.com/novik65/generic/plugins/_task-3.6.tar.gz
tar -zxvf _task-3.6.tar.gz -C $TEMP_PLUGIN_DIR
rm _task-3.6.tar.gz
fi
;;
43)
name="RPC v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/rpc-3.6.tar.gz"
file="rpc-3.6.tar.gz"
desc="This plugin is a replacement for the mod_scgi webserver module."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
44)
name="Rutracker Check v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/rutracker_check-3.6.tar.gz"
file="rutracker_check-3.6.tar.gz"
desc="This plugin checks the rutracker.org tracker for updated/deleted torrents."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
45)
name="Noty v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/_noty-3.6.tar.gz"
file="_noty-3.6.tar.gz"
desc="This plugin provides the notification functionality for other plugins."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
46)
name="Task v3.6"
url="http://dl.bintray.com/novik65/generic/plugins/_task-3.6.tar.gz"
file="_task-3.6.tar.gz"
desc="This plugin provides the possibility of running various scripts on the host system."
unpack="tar -zxvf $file -C $TEMP_PLUGIN_DIR"
DOWNLOAD_PLUGIN
;;
47)
name="Plugins v3.6"
url="http://dl.bintray.com/novik65/generic/plugins-3.6.tar.gz"
file="plugins-3.6.tar.gz"
desc="This installs about 40+ plugins except plugins number 29 to 33 (NFO, Chat, Logoff, Pause and Instant Search).\nMore info at https://github.com/Novik/ruTorrent/wiki/Plugins \nAll dependencies will be installed. \n${RED}REMEBER TO REMOVE HTTPRPC AND RPC PLUGINS FOR LOGIN TO WORK AT FIRST RUN!${NORMAL}"
unpack="tar -zxvf $file -C /tmp/"
echo "${GREEN}DOWNLOAD_PLUGIN${NORMAL}"
if DOWNLOAD_PLUGIN ; then
mv /tmp/plugins/* $TEMP_PLUGIN_DIR
INSTALL_FFMPEG
apt-get install php5-geoip curl libzen0 libmediainfo0 mediainfo unrar-free
fi
;;
0)
break
;;
*)
echo
error1="${RED}Not a usable number!${NORMAL}"
echo
;;
esac
done
}
# Function for installing dependencies
function APT_DEPENDENCIES {
apt-get update
apt-get install openssl git apache2 apache2-utils build-essential libsigc++-2.0-dev \
libcurl4-openssl-dev automake libtool libcppunit-dev libncurses5-dev libapache2-mod-scgi \
php5 php5-curl php5-cli libapache2-mod-php5 tmux unzip libssl-dev curl
}
# Function for setting up xmlrpc, libtorrent and rtorrent
function INSTALL_RTORRENT {
# Use the temp folder for compiling
cd /tmp
# Download and install xmlrpc-c super-stable
curl -L http://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c%20Super%20Stable/1.33.18/xmlrpc-c-1.33.18.tgz/download -o xmlrpc-c.tgz
tar zxvf xmlrpc-c.tgz
mv xmlrpc-c-1.* xmlrpc
cd xmlrpc
./configure --disable-cplusplus
make
make install
make clean
cd ..
rm -rv xmlrpc*
mkdir rtorrent
cd rtorrent
# Download and install libtorrent
curl -L http://rtorrent.net/downloads/libtorrent-0.13.6.tar.gz -o libtorrent.tar.gz
tar -zxvf libtorrent.tar.gz
cd libtorrent-0.13.6
./autogen.sh
./configure
make
make install
make clean
cd ..
# Download and install rtorrent
curl -L http://rtorrent.net/downloads/rtorrent-0.9.6.tar.gz -o rtorrent.tar.gz
tar -zxvf rtorrent.tar.gz
cd rtorrent-0.9.6
./autogen.sh
./configure --with-xmlrpc-c
make
make install
make clean
cd ../..
rm -rv rtorrent
ldconfig
# Creating session directory
if [ ! -d "$HOMEDIR"/.rtorrent-session ]; then
mkdir "$HOMEDIR"/.rtorrent-session
chown "$RTORRENT_USER"."$RTORRENT_USER" "$HOMEDIR"/.rtorrent-session
else
chown "$RTORRENT_USER"."$RTORRENT_USER" "$HOMEDIR"/.rtorrent-session
fi
# Creating downloads folder
if [ ! -d "$HOMEDIR"/Downloads ]; then
mkdir "$HOMEDIR"/Downloads
chown "$RTORRENT_USER"."$RTORRENT_USER" "$HOMEDIR"/Downloads
else
chown "$RTORRENT_USER"."$RTORRENT_USER" "$HOMEDIR"/Downloads
fi
# Downloading rtorrent.rc file.
wget -O $HOMEDIR/.rtorrent.rc https://raw.github.com/Kerwood/rtorrent.auto.install/master/Files/rtorrent.rc
chown "$RTORRENT_USER"."$RTORRENT_USER" $HOMEDIR/.rtorrent.rc
sed -i "s@HOMEDIRHERE@$HOMEDIR@g" $HOMEDIR/.rtorrent.rc
}
# Function for installing rutorrent and plugins
function INSTALL_RUTORRENT {
# Installing rutorrent.
# curl -L http://dl.bintray.com/novik65/generic/rutorrent-3.6.tar.gz -o rutorrent-3.6.tar.gz
# tar -zxvf rutorrent-3.6.tar.gz
curl -L http://dl.bintray.com/novik65/generic/ruTorrent-3.7.zip -o ruTorrent-3.7.zip
unzip ruTorrent-3.7.zip -d ruTorrent-3.7
if [ -d /var/www/html/rutorrent.old ]; then
rm -r /var/www/html/rutorrent.old
fi
if [ -d /var/www/html/rutorrent ]; then
# rm -r /var/www/html/rutorrent
mv /var/www/html/rutorrent /var/www/html/rutorrent.old
fi
mv ruTorrent-3.7/ruTorrent-master rutorrent
# Changeing SCGI mount point in rutorrent config.
sed -i "s/\/RPC2/\/rutorrent\/RPC2/g" ./rutorrent/conf/config.php
mv -f rutorrent /var/www/html/
# rm -v rutorrent-3.6.tar.gz
rm -v ruTorrent-3.7.zip
if [ -d "$TEMP_PLUGIN_DIR" ]; then
mv -fv "$TEMP_PLUGIN_DIR"/* /var/www/html/rutorrent/plugins
fi
# Changing permissions for rutorrent and plugins.
chown -R www-data.www-data /var/www/html/rutorrent
chmod -R 775 /var/www/html/rutorrent
}
# Function for configuring apache
function CONFIGURE_APACHE {
# Creating symlink for scgi.load
if [ ! -h /etc/apache2/mods-enabled/scgi.load ]; then
ln -s /etc/apache2/mods-available/scgi.load /etc/apache2/mods-enabled/scgi.load
fi
# Check if apache2 has port 80 enabled
if ! grep --quiet "^Listen 80$" /etc/apache2/ports.conf; then
echo "Listen 80" >> /etc/apache2/ports.conf;
fi
# Adding ServerName localhost to apache2.conf
if ! grep --quiet "^ServerName$" /etc/apache2/apache2.conf; then
echo "ServerName localhost" >> /etc/apache2/apache2.conf;
fi
# Creating Apache virtual host
if [ ! -f /etc/apache2/sites-available/001-default-rutorrent.conf ]; then
cat > /etc/apache2/sites-available/001-default-rutorrent.conf << EOF
<VirtualHost *:80>
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
CustomLog /var/log/apache2/rutorrent.log vhost_combined
ErrorLog /var/log/apache2/rutorrent_error.log
SCGIMount /rutorrent/RPC2 127.0.0.1:5000
<Directory "/var/www/html/rutorrent">
AuthName "Tits or GTFO"
AuthType Basic
Require valid-user
AuthUserFile /var/www/html/rutorrent/.htpasswd
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
EOF
a2ensite 001-default-rutorrent.conf
a2dissite 000-default.conf
systemctl restart apache2.service
fi
# Creating .htaccess file
printf "%s\n" "${WEB_USER_ARRAY[@]}" > /var/www/html/rutorrent/.htpasswd
}
function INSTALL_FFMPEG {
printf "\n# ffpmeg mirror\ndeb http://www.deb-multimedia.org jessie main non-free\n" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring
apt-get update
apt-get install ffmpeg
}
# Function for showing the end result when install is complete
function INSTALL_COMPLETE {
rm -rf $TEMP_PLUGIN_DIR
HEADER
echo "${GREEN}Installation is complete.${NORMAL}"
echo
echo
echo "${RED}Your default Apache2 vhost file has been disabled and replaced with a new one.${NORMAL}"
echo "${RED}If you were using it, combine the default and rutorrent vhost file and enable it again.${NORMAL}"
echo
echo "${PURPLE}Your downloads folder is in ${LBLUE}$HOMEDIR/Downloads${NORMAL}"
echo "${PURPLE}Sessions data is ${LBLUE}$HOMEDIR/.rtorrent-session${NORMAL}"
echo "${PURPLE}rtorrent's configuration file is ${LBLUE}$HOMEDIR/.rtorrent.rc${NORMAL}"
echo
echo "${PURPLE}If you want to change settings for rtorrent, such as download folder, etc.,"
echo "you need to edit the '.rtorrent.rc' file. E.g. 'nano $HOMEDIR/.rtorrent.rc'${NORMAL}"
echo
echo "Rtorrent can be started without rebooting with 'sudo systemctl start rtorrent.service'."
# The IPv6 local address, is not very used for now, anyway if needed, just change 'inet' to 'inet6'
lcl=$(ip addr | grep 'inet ' | awk '{print $2}' | cut -d/ -f1 | grep -v "127." | head -n 1)
ext=$(curl -s http://icanhazip.com)
if [[ ! -z "$lcl" ]] && [[ ! -z "$ext" ]]; then
echo "${LBLUE}LOCAL IP:${NORMAL} http://$lcl/rutorrent"
echo "${LBLUE}EXTERNAL IP:${NORMAL} http://$ext/rutorrent"
echo
echo "Visit rutorrent through the above address."
echo
else
if [[ -z "$lcl" ]]; then
echo "Can't detect the local IP address"
echo "Try visit rutorrent at http://127.0.0.1/rutorrent"
echo
elif [[ -z "$ext" ]]; then
echo "${LBLUE}LOCAL:${NORMAL} http://$lcl/rutorrent"
echo "Visit rutorrent through your local network"
else
echo "Can't detect the IP address"
echo "Try visit rutorrent at http://127.0.0.1/rutorrent"
echo
fi
fi
}
function INSTALL_SYSTEMD_SERVICE {
cat > "/etc/systemd/system/rtorrent.service" <<-EOF
[Unit]
Description=rtorrent (in tmux)
[Service]
Type=oneshot
RemainAfterExit=yes
User=$RTORRENT_USER
ExecStart=/usr/bin/tmux -2 new-session -d -s rtorrent rtorrent
ExecStop=/usr/bin/tmux kill-session -t rtorrent
[Install]
WantedBy=default.target
EOF
systemctl enable rtorrent.service
}
function START_RTORRENT {
systemctl start rtorrent.service
}
CHECK_ROOT
LICENSE
APACHE_UTILS
rm -rf $TEMP_PLUGIN_DIR
HEADER
SET_RTORRENT_USER
SET_WEB_USER
# NOTICE: Change lib, rtorrent, rutorrent versions on upgrades.
while true; do
HEADER
echo " ${BOLD}rTorrent version:${NORMAL} ${RED}0.9.4${NORMAL}"
echo " ${BOLD}libTorrent version:${NORMAL} ${RED}0.13.4${NORMAL}"
echo " ${BOLD}ruTorrent version:${NORMAL} ${RED}3.6${NORMAL}"
echo
echo " ${BOLD}rTorrent user:${NORMAL}${GREEN} $RTORRENT_USER${NORMAL}"
echo
echo -n " ${BOLD}ruTorrent user(s):${NORMAL}${GREEN}"
LIST_WEB_USERS
echo
echo
echo " ${NORMAL}${BOLD}ruTorrent plugins:${NORMAL}${GREEN}"
LIST_PLUGINS
echo
echo " ${NORMAL}[1] - Change rTorrent user"
echo " [2] - Add another ruTorrent user"
echo " [3] - Download plugins"
echo
echo " [0] - Start installation"
echo " [q] - Quit"
echo
echo -n "${GREEN}>>${NORMAL} "
read case
case "$case" in
1)
SET_RTORRENT_USER
;;
2)
SET_WEB_USER
;;
3)
SELECT_PLUGINS
;;
0)
# APT_DEPENDENCIES
# INSTALL_RTORRENT
INSTALL_RUTORRENT