Compare commits

...
95 Commits
Author SHA1 Message Date
arakasi72 ac23d1d943 Develop (#346)
* Update rtinst

* Update rtupdate

* Update rtsetup

* Update rtsetup

* Update rtsetup

* Update rtsetup

* Update rtupdate

* Update rtinst

* Update rtupdate
2018-06-28 12:34:59 +01:00
arakasi72 fa2be075e8 Update rtinst 2018-06-08 15:33:30 +01:00
arakasi72 ccf634fe8e Update rtupdate 2018-06-06 19:33:15 +01:00
arakasi72 3cb4ce6e4b Update rtinst (#334) 2018-05-25 16:59:30 +01:00
arakasi72 4e4f248596 Develop (#325)
* Update rtinst

* Update rtupdate

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update README.md

* Update rtinst
2018-04-27 22:36:54 +01:00
arakasi72 65aa469f04 Update rtinst 2018-04-02 10:02:14 +01:00
arakasi72 7161f7d44f Update rtinst 2018-04-02 09:46:39 +01:00
arakasi72 fd0f31f932 Update rtinst 2018-04-02 09:29:38 +01:00
arakasi72 e1d80618ab Update rtinst 2018-04-02 09:24:50 +01:00
arakasi72 723035d98b Update rtinst 2018-04-02 09:14:29 +01:00
arakasi72 f31d00686f Update rtinst 2018-03-29 00:35:08 +01:00
arakasi72 ec28d3745a Update rtinst 2018-03-05 17:52:01 +00:00
arakasi72 e3ee61442a Update rtinst 2018-03-05 17:40:27 +00:00
arakasi72 e1fe902647 Update rtinst 2018-03-05 17:31:51 +00:00
arakasi72 d1553f2313 Develop (#310)
* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtinst
2018-03-05 00:48:21 +00:00
arakasi72 3390c0a997 Update rtupdate 2018-03-05 00:00:39 +00:00
arakasi72 04e306b8c4 Update rtinst 2018-03-04 21:24:58 +00:00
arakasi72 ebb87d3a59 Update rtinst 2018-03-04 20:24:47 +00:00
arakasi72 3d89e7038d Update rtupdate 2018-03-04 20:24:00 +00:00
arakasi72 c1ada21ca2 Update rtupdate 2018-03-04 19:55:36 +00:00
arakasi72 81b3f33320 Update rtupdate 2018-03-04 19:51:27 +00:00
arakasi72 163e070c74 Update rtupdate 2018-03-04 19:51:04 +00:00
arakasi72 e73d0409fe Update rtupdate 2018-03-04 19:49:42 +00:00
arakasi72 fc14ed4c26 Update rtupdate 2018-03-04 19:48:07 +00:00
arakasi72 17a179cc96 Update rtupdate 2018-03-04 19:44:22 +00:00
arakasi72 38d592a394 Update rtupdate 2018-03-04 19:29:57 +00:00
arakasi72 5d5f11aad5 Update rtinst 2018-03-04 19:28:56 +00:00
arakasi72 1f9cbb58fe Update rtupdate 2018-03-02 16:14:57 +00:00
arakasi72 ed1e19a12e Update rtinst 2018-03-02 16:14:09 +00:00
arakasi72 b8492ca3dc Update rtinst 2018-03-02 16:06:44 +00:00
arakasi72 832ba598c6 Update rtupdate 2018-03-02 16:04:17 +00:00
arakasi72 e3a7cf69fe Update rtupdate 2018-03-02 16:00:35 +00:00
arakasi72 9b8cf7966a Update rtinst 2018-03-02 15:59:16 +00:00
arakasi72 cfafd8eab3 Update rtupdate 2018-03-02 15:58:36 +00:00
arakasi72 21f9a0fa82 Update rtupdate 2018-02-25 19:11:50 +00:00
arakasi72 6cd5ca7e6a Update rtinst 2018-02-25 10:17:47 +00:00
arakasi72 847517d461 Update rtinst 2018-02-18 23:38:48 +00:00
arakasi72 4238aa85ed Update README.md 2018-02-03 00:11:05 +00:00
arakasi72 50c66e7c95 Update rtupdate 2018-01-28 21:54:07 +00:00
arakasi72 a9231a2397 Update README.md 2018-01-28 13:03:31 +00:00
arakasi72 ce5a0f6b49 Update rtinst 2018-01-16 15:05:22 +00:00
arakasi72 a76779622f Update rtinst 2018-01-15 18:38:40 +00:00
arakasi72 96a3725d06 Update rtinst 2017-12-11 20:55:05 +00:00
arakasi72 b1cc07f104 Update README.md 2017-10-22 15:46:23 +01:00
arakasi72 43a00f560e Update rtupdate (#275) 2017-10-22 12:33:33 +01:00
arakasi72 7e380adf3a Update rtadduser 2017-10-21 15:58:15 +01:00
arakasi72 7b9b88e1ec Develop (#272)
* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst
2017-10-21 00:23:43 +01:00
arakasi72 5e4f088f04 Update rtinst (#271) 2017-10-20 14:37:46 +01:00
arakasi72 825b381d2a Update README.md 2017-10-20 14:36:50 +01:00
arakasi72 713432d8a4 Develop (#267)
* Update rtinst

* Update rtinst

* Update rtinst

* Update rtadduser

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtadduser
2017-10-13 17:55:35 +01:00
arakasi72 0ebf8f8335 Update rtsslcert 2017-10-03 02:00:26 +01:00
arakasi72 aa00760898 Update rtinst 2017-10-03 01:57:23 +01:00
arakasi72 9c06c11ba8 Update nginxsite 2017-09-25 08:29:01 +01:00
arakasi72 494b387e15 Update rutupgrade 2017-09-10 10:35:20 +01:00
arakasi72 c41f7ab6a0 Update rutupgrade 2017-09-10 10:31:55 +01:00
arakasi72 cdf523c5e1 Update rutupgrade 2017-09-10 10:26:14 +01:00
arakasi72 e711362f7e Update rutupgrade 2017-09-10 10:25:11 +01:00
arakasi72 48b010c6aa Develop (#254)
* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rutupgrade

* Update rutupgrade

* Update rutupgrade

* Update rutupgrade

* Update rutupgrade

* Update rutupgrade

* Update rtinst

* Update rutupgrade

* Update rutupgrade

* Update rutupgrade

* Update rutupgrade

* Update rutupgrade

* Update rutupgrade
2017-09-08 13:00:36 +01:00
arakasi72 29a1be1673 Update rtinst 2017-08-28 22:00:53 +01:00
arakasi72 939f7c4d6f Update rtadmin 2017-08-17 11:18:23 +01:00
arakasi72 0a511bdbfe Develop (#249)
* Update rtsetup

* Update rtsetup

* Update rtsetup

* Update rtsetup

* Delete rtgetscripts

* Update rtversion

* Update rtinst

* Update rtsetup

* Update rtsetup

* Update rtsetup
2017-08-17 11:08:18 +01:00
arakasi72 cf266ca2d9 Update rtinst 2017-07-31 21:50:19 +01:00
arakasi72 83d014435d Update README.md 2017-07-23 21:58:14 +01:00
arakasi72 a3699251a2 Update rtinst 2017-07-18 18:21:29 +01:00
arakasi72 0b063374a2 Develop (#242)
* Update rtinst

* Update rtinst

* Update rtinst

* Update rtadduser

* Update rtinst

* Update rtadduser

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst
2017-07-18 09:30:01 +01:00
arakasi72 8816cfd9b6 Develop (#236)
* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtadduser

* Update rtadduser
2017-07-08 21:19:54 +01:00
arakasi72 4b50d9d2c9 Update rtinst 2017-07-02 15:15:54 +01:00
arakasi72 3a6231db3b Develop (#234)
* Update rtinst

* Update rtinst

* Update rtupdate

* Update rtversion

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst
2017-07-02 14:50:46 +01:00
arakasi72 08ce46c103 Develop (#233)
* Update rtwebmin

* Update rtversion

* Update rtversion

* Update rtversion

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtinst

* Update rtinst

* Update rtsslcert

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtupdate

* Update rutupgrade
2017-07-01 15:18:21 +01:00
arakasi72 e23007496b Update rutupgrade 2017-06-27 03:34:07 +01:00
arakasi72 b2dcb9e99e Update rutupgrade 2017-06-27 03:24:06 +01:00
arakasi72 1a0dc76635 Develop (#228)
* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtsslcert

* Update rtinst
2017-06-26 16:40:26 +01:00
arakasi72 5a50f5059b Develop (#227)
* Update README.md

* Update rtupdate

* Update rtinst

* Update rtinst

* Update rtinst
2017-06-26 01:39:58 +01:00
arakasi72 666235dfd2 Develop (#226)
* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtinst
2017-06-25 17:39:21 +01:00
arakasi72 7a7c827bab Merge pull request #225 from arakasi72/develop
Develop
2017-06-25 12:11:10 +01:00
root c5f7625d9d Update rtupdate 2017-06-25 06:27:54 +01:00
arakasi72 75bd5b4dc9 Update rtgetscripts 2017-06-24 21:39:41 +01:00
arakasi72 5bef4334a7 Update rtsetup 2017-06-24 21:33:40 +01:00
arakasi72 071aab4d44 Update rtsetup 2017-06-24 21:31:46 +01:00
arakasi72 84a5cfca46 Update rtsetup 2017-06-24 21:29:46 +01:00
arakasi72 c22820cf7d Update rtsetup 2017-06-24 21:25:54 +01:00
arakasi72 83289d49a9 Update rtupdate 2017-06-24 19:31:24 +01:00
arakasi72 ad1568b912 Update rtupdate 2017-06-24 19:11:41 +01:00
arakasi72 0399ebfd4b Update rtinst 2017-06-24 18:54:12 +01:00
arakasi72 c1e6bef8a8 Update rtinst 2017-06-24 18:09:28 +01:00
arakasi72 1a97951253 Update rtsetup 2017-06-24 11:09:13 +01:00
arakasi72 3f89cf28ad Update README.md 2017-06-24 11:07:33 +01:00
arakasi72 127a5da748 Update README 2017-06-24 11:03:09 +01:00
arakasi72 8c48e91017 Update rtversion 2017-06-24 08:54:05 +01:00
arakasi72 43190791d2 Changing file permissions 2017-06-24 08:35:17 +01:00
arakasi72 26ebdd7568 Create rtversion 2017-06-24 08:33:21 +01:00
arakasi72 75c426f285 Update rtgetscripts 2017-06-24 08:20:27 +01:00
arakasi72 4cbda5906b Update README.md 2017-06-24 00:06:43 +01:00
arakasi72 780612e532 Merge pull request #224 from arakasi72/develop
Develop
2017-06-23 22:36:31 +01:00
arakasi72 e677e8b701 Update rtsslcert 2017-06-23 22:25:38 +01:00
12 changed files with 813 additions and 384 deletions
+9 -8
View File
@@ -1,16 +1,12 @@
## rtinst ## rtinst
### NOTE: Please note there are some minor changes to how the script is installed and run.
If you are familiar with rtinst please check the guide to avoid any confusion
#### 30 Second Guide #### 30 Second Guide
Ubuntu and Debian Seedbox Installation Ubuntu and Debian Seedbox Installation
Download and run setup (if logged in as root, do not need to use sudo) Download and run setup (if logged in directly as root, do not need to use sudo)
wget --no-check-certificate https://raw.githubusercontent.com/arakasi72/rtinst/master/rtsetup sudo bash -c "$(wget --no-check-certificate -qO - https://raw.githubusercontent.com/arakasi72/rtinst/master/rtsetup)"
sudo bash rtsetup
and then to run the main script, ([check the options you can use](https://github.com/arakasi72/rtinst/wiki/Guide#21-main-script-options)): and then to run the main script, ([check the options you can use](https://github.com/arakasi72/rtinst/wiki/Guide#21-main-script-options)):
@@ -18,7 +14,9 @@ and then to run the main script, ([check the options you can use](https://github
It takes about 10 minutes to run, depending on your server setup. After you have run the script and everything is working, I suggest a reboot, the script does not automate this reboot, you need to do it manually using the reboot command. It takes about 10 minutes to run, depending on your server setup. After you have run the script and everything is working, I suggest a reboot, the script does not automate this reboot, you need to do it manually using the reboot command.
[A detailed installation guide](https://github.com/arakasi72/rtinst/wiki/Guide) [A detailed installation guide](https://github.com/arakasi72/rtinst/wiki/Installing-rtinst)
[A detailed user guide](https://github.com/arakasi72/rtinst/wiki/Guide)
**IMPORTANT: NOTE THE NEW SSH PORT AND MAKE SURE YOU CAN SSH INTO YOUR SERVER BEFORE CLOSING THE EXISTING SESSION** **IMPORTANT: NOTE THE NEW SSH PORT AND MAKE SURE YOU CAN SSH INTO YOUR SERVER BEFORE CLOSING THE EXISTING SESSION**
@@ -31,6 +29,7 @@ It has been tested with clean installs of:
Ubuntu 15 Ubuntu 15
Ubuntu 16 Ubuntu 16
Ubuntu 17 Ubuntu 17
Ubuntu 18
Debian 7 "Wheezy" (unsupported) Debian 7 "Wheezy" (unsupported)
Debian 8 "Jessie" Debian 8 "Jessie"
Debian 9 "Stretch" Debian 9 "Stretch"
@@ -45,7 +44,9 @@ Services that will be installed and configured are
6. webmin (optional see section 3.7 in main guide) 6. webmin (optional see section 3.7 in main guide)
[A detailed installation guide, and additional information on all the features](https://github.com/arakasi72/rtinst/wiki/Guide) [rtinst installation guide](https://github.com/arakasi72/rtinst/wiki/Installing-rtinst)
[Additional information on all the features](https://github.com/arakasi72/rtinst/wiki/Guide)
For older unssuported OS listed above see the [Older OS Installation Guide](https://github.com/arakasi72/rtinst/wiki/Installing-on-Older-OS) For older unssuported OS listed above see the [Older OS Installation Guide](https://github.com/arakasi72/rtinst/wiki/Installing-on-Older-OS)
+2 -1
View File
@@ -1,5 +1,6 @@
server { server {
listen 80; listen 80;
#server_name <Domain Name>;
root /var/www; root /var/www;
index index.html index.php index.htm; index index.html index.php index.htm;
@@ -35,7 +36,7 @@ server {
server { server {
listen 443 ssl; listen 443 ssl;
#server_name <Domain Name>;
root /var/www; root /var/www;
index index.html index.php index.htm; index index.html index.php index.htm;
+46 -1
View File
@@ -13,11 +13,38 @@ PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
rundir=$(dirname $(readlink -f $0)) rundir=$(dirname $(readlink -f $0))
branch=$1 branch=$1
# function to ask user for y/n response
ask_user(){
local answer
while true
do
read answer
case $answer in [Yy]* ) return 0 ;;
[Nn]* ) return 1 ;;
* ) echo "Enter y or n";;
esac
done
}
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
echo "Must be run as root, directly or with sudo" echo "Must be run as root, directly or with sudo"
exit 1 exit 1
fi fi
# kill apt-daily.service if running
if [[ $(systemctl list-units --all apt-daily.service | fgrep -c apt-daily.service) -gt 0 ]]; then
systemctl stop apt-daily.service > /dev/null 2>&1
systemctl kill --kill-who=all apt-daily.service > /dev/null 2>&1
# wait until `apt-get updated` has been killed
while ! (systemctl list-units --all apt-daily.service | fgrep -q dead)
do
sleep 1;
done
fi
apt-get -qq update
if [ $(dpkg-query -W -f='${Status}' git 2>/dev/null | grep -c "ok installed") -eq 0 ]; then if [ $(dpkg-query -W -f='${Status}' git 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Installing git" echo "Installing git"
apt-get -yqq install git 2>&1 >> /dev/null apt-get -yqq install git 2>&1 >> /dev/null
@@ -34,6 +61,19 @@ if [ -d /etc/rtinst ] && [ -z $branch ]; then
branch=$(basename "$(git symbolic-ref -q HEAD)") branch=$(basename "$(git symbolic-ref -q HEAD)")
if [ -z $branch ]; then if [ -z $branch ]; then
branch=$(git describe --tags --exact-match) branch=$(git describe --tags --exact-match)
if [ ${branch:0:1} = v ]; then
latest=$(basename "$(git ls-remote --tags https://github.com/arakasi72/rtinst.git | grep -o 'refs/tags/v.*' | sort -V | tail -1)")
if [ $branch != $latest ]; then
echo "Updating from $branch to $latest"
branch=$latest
else
echo "Already using the latest version, rtinst $branch"
echo -n "Do you wish to reinstall rtinst y/n? "
if ! ask_user; then
exit
fi
fi
fi
fi fi
if [ $(git ls-remote --tags --heads https://github.com/arakasi72/rtinst.git $branch | wc -l) -eq 0 ]; then if [ $(git ls-remote --tags --heads https://github.com/arakasi72/rtinst.git $branch | wc -l) -eq 0 ]; then
echo "$branch has been deleted, using latest numbered release instead" echo "$branch has been deleted, using latest numbered release instead"
@@ -54,15 +94,20 @@ if [ $(git ls-remote --tags --heads https://github.com/arakasi72/rtinst.git $bra
exit exit
fi fi
echo "Installing rtinst $branch"
cd cd
rm -fr /etc/rtinst rm -fr /etc/rtinst
git clone -q https://github.com/arakasi72/rtinst.git /etc/rtinst git clone -q https://github.com/arakasi72/rtinst.git /etc/rtinst
cd /etc/rtinst cd /etc/rtinst
git checkout $branch git checkout $branch > /dev/null 2>&1
cd cd
ln -sf /etc/rtinst/scripts/* /usr/local/bin ln -sf /etc/rtinst/scripts/* /usr/local/bin
ln -sf /etc/rtinst/rtsetup /usr/local/bin ln -sf /etc/rtinst/rtsetup /usr/local/bin
echo "Installation complete"
echo
echo "You can now run rtinst and the additional supporting scripts"
if [ "$rundir" != "/etc/rtinst" ]; then if [ "$rundir" != "/etc/rtinst" ]; then
rm -f $rundir/rtsetup rm -f $rundir/rtsetup
fi fi
+26 -8
View File
@@ -287,11 +287,13 @@ if ! [ -d "$home/rtorrent/watch" ]; then
mkdir $home/rtorrent/watch mkdir $home/rtorrent/watch
fi fi
if [ -z "$webpass" ]; then if [ -z "$webpass" ] && [ -z $(grep -s $user $passfile) ]; then
webpass=$(genpasswd) webpass=$(genpasswd)
fi fi
htpasswd -b $passfile $user $webpass if [ ! -z "$webpass" ]; then
htpasswd -b $passfile $user $webpass
fi
cp -f /etc/rtinst/conf/rtorrent.rc $home/.rtorrent.rc cp -f /etc/rtinst/conf/rtorrent.rc $home/.rtorrent.rc
@@ -321,7 +323,6 @@ unzip -o autodl-irssi.zip >> /dev/null 2>&1
rm autodl-irssi.zip rm autodl-irssi.zip
cp autodl-irssi.pl autorun/ cp autodl-irssi.pl autorun/
mkdir -p $home/.autodl mkdir -p $home/.autodl
touch $home/.autodl/autodl.cfg && touch $home/.autodl/autodl2.cfg
echo "<?php" > /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php echo "<?php" > /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
echo >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php echo >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
@@ -331,13 +332,25 @@ echo >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
echo "?>" >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php echo "?>" >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
cd $home/.autodl cd $home/.autodl
echo "[options]" > autodl2.cfg
echo "gui-server-port = $adlport" >> autodl2.cfg if [ -f "autodl.cfg" ]; then
echo "gui-server-password = $adlpass" >> autodl2.cfg if (grep -sq gui-server-port autodl.cfg) && (grep -sq gui-server-password autodl.cfg); then
sed -i "/gui-server-port/ c\gui-server-port = $adlport" autodl.cfg
sed -i "/gui-server-password/ c\gui-server-password = $adlpass" autodl.cfg
else
sed -i '/gui-server-port/ d' autodl.cfg
sed -i '/gui-server-password/ d' autodl.cfg
echo >> autodl.cfg
sed -i "1s/^/[options]\ngui-server-port = $adlport\ngui-server-password = $adlpass\n/" autodl.cfg
fi
else
echo "[options]" > autodl.cfg
echo "gui-server-port = $adlport" >> autodl.cfg
echo "gui-server-password = $adlpass" >> autodl.cfg
fi
chown -R $user:$user $home chown -R $user:$user $home
chown -R www-data:www-data /var/www/rutorrent chown -R www-data:www-data /var/www/rutorrent
chmod -R 755 /var/www/rutorrent
if [ -z "$(crontab -u $user -l | grep "$cronline1")" ]; then if [ -z "$(crontab -u $user -l | grep "$cronline1")" ]; then
(crontab -u $user -l; echo "$cronline1" ) | crontab -u $user - (crontab -u $user -l; echo "$cronline1" ) | crontab -u $user -
@@ -371,6 +384,7 @@ echo
### WRITE RTINST.INFO ### ### WRITE RTINST.INFO ###
############################### ###############################
echo > $home/rtinst.info
if groups $user | grep -q -E ' sshuser(\s|$)' || groups $user | grep -q -E ' sudo(\s|$)'; then if groups $user | grep -q -E ' sshuser(\s|$)' || groups $user | grep -q -E ' sudo(\s|$)'; then
echo "$user has SSH access on port $sshport" | tee -a $home/rtinst.info echo "$user has SSH access on port $sshport" | tee -a $home/rtinst.info
echo echo
@@ -382,7 +396,11 @@ echo "https downloads can be accessed at https://$serverip/download/$user" | tee
echo echo
fi fi
echo "rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info echo "rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info
echo "rutorrent password set to $webpass" | tee -a $home/rtinst.info if [ -z $webpass ]; then
echo "rutorrent password has not been changed" | tee -a $home/rtinst.info
else
echo "rutorrent password set to $webpass" | tee -a $home/rtinst.info
fi
echo "to change rutorrent password enter: rtpass" | tee -a $home/rtinst.info echo "to change rutorrent password enter: rtpass" | tee -a $home/rtinst.info
echo echo
echo "The above info is stored at $home/rtinst.info" echo "The above info is stored at $home/rtinst.info"
+2 -2
View File
@@ -16,7 +16,7 @@ select_task(){
while true while true
do do
read answer read answer
case $answer in [1] ) rtgetscripts && return 0 ;; case $answer in [1] ) rtsetup && return 0 ;;
[2] ) rtadduser && return 0 ;; [2] ) rtadduser && return 0 ;;
[3] ) rtremove && return 0 ;; [3] ) rtremove && return 0 ;;
[4] ) rtdload $rtdaction && return 0 ;; [4] ) rtdload $rtdaction && return 0 ;;
@@ -46,7 +46,7 @@ clear
echo "For more information go to:" echo "For more information go to:"
echo "https://github.com/arakasi72/rtinst/blob/master/README.md" echo "https://github.com/arakasi72/rtinst/blob/master/README.md"
echo "Select from the following options:" echo "Select from the following options:"
echo "1.) rtgetscripts - update the rtinst scripts" echo "1.) rtsetup - update the rtinst scripts"
echo "2.) rtadduser - add new user" echo "2.) rtadduser - add new user"
echo "3.) rtremove - delete a user" echo "3.) rtremove - delete a user"
echo "4.) rtdload $rtdaction - $rtdaction http downloads" echo "4.) rtdload $rtdaction - $rtdaction http downloads"
-66
View File
@@ -1,66 +0,0 @@
#!/bin/bash
######################################################################
#
# Copyright (c) 2015 arakasi72 (https://github.com/arakasi72)
#
# --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
#
######################################################################
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
if [ "$(id -u)" != "0" ]; then
echo "Must be run as root, directly or with sudo"
exit 1
fi
if [ ! -d /etc/rtinst ]; then
git clone https://github.com/arakasi72/rtinst.git /etc/rtinst
fi
cd /etc/rtinst
branch=$(basename "$(git symbolic-ref -q HEAD)")
# if branch is empty then it is a tag
if [ -z $branch ]; then
branch=$(git describe --tags --exact-match)
if [ ${branch:0:1} = v ]; then
git fetch origin
latest=$(git tag | sort -V | grep ^v | tail -1)
if [ $branch = $latest ]; then
echo "Already using the latest release: $branch"
exit
fi
# update to latest release
echo "rtinst updating from $branch to $latest"
cd
rm -fr /etc/rtinst
git clone -q https://github.com/arakasi72/rtinst.git /etc/rtinst
cd /etc/rtinst
git checkout -q $latest
branch=$(git describe --tags --exact-match)
echo "rtinst $branch installed"
cd
ln -sf /etc/rtinst/scripts/* /usr/local/bin
ln -sf /etc/rtinst/rtsetup /usr/local/bin
exit
else
echo "$branch is not a branch, or a numbered release"
echo "Run rtsetup if you want to switch to another build"
exit
fi
fi
if [ $(git ls-remote --heads https://github.com/arakasi72/rtinst.git $branch | wc -l) -eq 0 ]; then
echo "$branch no longer appears to exist"
echo "run rtsetup to reset branch"
else
git fetch --all
git reset --hard origin/$branch 2>&1 >> /dev/null
git pull origin $branch
ln -sf /etc/rtinst/scripts/* /usr/local/bin
ln -sf /etc/rtinst/rtsetup /usr/local/bin
fi
+401 -207
View File
@@ -14,11 +14,17 @@
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
rtorrentrel='0.9.6' # if left blank will install latest version of rtorrent, or set to a specific release E.G. '0.9.6' to install that release
libtorrentrel='0.13.6' rtorrentrel=''
rtorrentloc='http://rtorrent.net/downloads/rtorrent-'$rtorrentrel'.tar.gz'
libtorrentloc='http://rtorrent.net/downloads/libtorrent-'$libtorrentrel'.tar.gz' #url's of the major components
xmlrpcloc='https://svn.code.sf.net/p/xmlrpc-c/code/stable' rt_url="http://rtorrent.net/downloads/"
xmlrpc_url="https://svn.code.sf.net/p/xmlrpc-c/code/stable/"
xmlrpc_url_alt="https://github.com/mirror/xmlrpc-c"
ru_url="https://github.com/Novik/ruTorrent/"
adl_url="https://github.com/autodl-community/"
if [ $(dpkg-query -W -f='${Status}' lsb-release 2>/dev/null | grep -c "ok installed") -eq 0 ]; then if [ $(dpkg-query -W -f='${Status}' lsb-release 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Installing lsb-release" echo "Installing lsb-release"
@@ -29,48 +35,63 @@ fullrel=$(lsb_release -sd)
osname=$(lsb_release -si) osname=$(lsb_release -si)
relno=$(lsb_release -sr | cut -d. -f1) relno=$(lsb_release -sr | cut -d. -f1)
phpver=php5
phploc=/etc/php5
geoipver=php5-geoip
libcver=libcurl3
if [ "$relno" = "16" ] || [ "$relno" = "17" ] || [ "$relno" = "9" ]; then if [ "$relno" = "16" ] || [ "$relno" = "17" ] || [ "$relno" = "9" ]; then
phpver=php7.0 phpver=php7.0
phploc=/etc/php/7.0 phploc=/etc/php/7.0
geoipver=php-geoip geoipver=php-geoip
else
phpver=php5
phploc=/etc/php5
geoipver=php5-geoip
fi fi
serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}') if [ $(lsb_release -sr) = "17.10" ]; then
phpver=php7.1
phploc=/etc/php/7.1
geoipver=php-geoip
fi
if [ "$relno" = "18" ]; then
phpver=php7.2
phploc=/etc/php/7.2
geoipver=php-geoip
libcver=libcurl4
fi
export serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
export logfile="/dev/null"
webpass='' webpass=''
cronline1="@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent" cronline1="@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent"
cronline2="*/10 * * * * /usr/local/bin/rtcheck irssi rtorrent" cronline2="*/10 * * * * /usr/local/bin/rtcheck irssi rtorrent"
dlflag=1 dlflag=1
portdefault=1 portdefault=1
logfile="/dev/null"
install_rt=0 skip_rt=1
sshport='' sshport=''
rudevflag=0 rudevflag=1
rurelease=master
passfile='/etc/nginx/.htpasswd' passfile='/etc/nginx/.htpasswd'
package_list="sudo nano autoconf build-essential ca-certificates comerr-dev curl cfv dtach htop irssi libcloog-ppl-dev libcppunit-dev libcurl3 libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev libtool libxml2-dev ncurses-base ncurses-term ntp patch pkg-config $phpver-fpm $phpver $phpver-cli $phpver-dev $phpver-curl $geoipver $phpver-mcrypt $phpver-xmlrpc python-scgi screen subversion texinfo unzip zlib1g-dev libcurl4-openssl-dev mediainfo python-software-properties software-properties-common aptitude $phpver-json nginx-full apache2-utils git libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libjson-rpc-perl libarchive-zip-perl" package_list="sudo nano autoconf build-essential ca-certificates comerr-dev curl cfv dtach htop irssi libcloog-ppl-dev libcppunit-dev $libcver libncurses5-dev libterm-readline-gnu-perl libsigc++-2.0-dev libperl-dev libtool libxml2-dev ncurses-base ncurses-term ntp patch pkg-config $phpver-fpm $phpver $phpver-cli $phpver-dev $phpver-curl $geoipver $phpver-xmlrpc python-scgi screen subversion texinfo unzip zlib1g-dev libcurl4-openssl-dev mediainfo software-properties-common aptitude $phpver-json nginx-full apache2-utils git libarchive-zip-perl libnet-ssleay-perl libhtml-parser-perl libxml-libxml-perl libjson-perl libjson-xs-perl libxml-libxslt-perl libjson-rpc-perl libarchive-zip-perl"
Install_list="" Install_list=""
unixpass="" unixpass=""
passflag=0 passflag=0
forceyes=1 forceyes=1
selfsign=1
rut_add_users=1
############################### ###############################
### FUNCTIONS ### ### FUNCTIONS ###
############################### ###############################
#exit on error function #function to check if a web site is reachable
error_exit() { check_url() {
echo "Error: $1" if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then return 0; else return 1; fi
echo "This is most likely a network error, if your network is working, then it is likely a temporary issue with the relevant file server" }
echo "Run 'bash rtinst.sh -l' for detailed output to rtinst.log"
echo "Once issue is resolved the script can be run again to complete installation" # checks if an application is installed
if ! [ -z "$sshport" ]; then installed() {
echo "SSH Port was set before script was stopped to $sshport" hash $1 2>/dev/null
echo "make sure you can login before closing this session"
fi
exit 1
} }
#function to check if string is valid format for an ip address #function to check if string is valid format for an ip address
@@ -97,6 +118,25 @@ local genln=$1
tr -dc A-Za-z0-9 < /dev/urandom | head -c ${genln} | xargs tr -dc A-Za-z0-9 < /dev/urandom | head -c ${genln} | xargs
} }
#function executed if the script finishes early
early_exit() {
echo "Installation is incomplete. Run rtinst again to complete"
echo
if hash rtorrent >> /dev/null 2>&1; then
rt_current=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
echo "rtorrent $rt_current installed"
else
echo "rtorrent was not installed"
fi
echo
echo "FTP Port set to $ftpport"
echo
echo "IMPORTANT - SSH Port has been set to: $sshport"
echo "IMPORTANT - SSH Port has been set to: $sshport"
echo "IMPORTANT - SSH Port has been set to: $sshport"
exit 1
}
#function to set a user input password #function to set a user input password
set_pass() { set_pass() {
local localpass local localpass
@@ -205,7 +245,7 @@ else
fi fi
# get options # get options
OPTS=$(getopt -n "$0" -o dltryu:p:w: --long "dload,log,ssh-default,rutorrent-stable,force-yes,user:,password:,webpass:" -- "$@") OPTS=$(getopt -n "$0" -o dltrmysu:p:w: --long "dload,log,ssh-default,rutorrent-stable,rutorrent-master,force-yes,self-signed,user:,password:,webpass:" -- "$@")
eval set -- "$OPTS" eval set -- "$OPTS"
@@ -215,7 +255,9 @@ while true; do
-l | --log ) logfile="$HOME/rtinst.log"; shift ;; -l | --log ) logfile="$HOME/rtinst.log"; shift ;;
-t | --ssh-default ) portdefault=0; shift;; -t | --ssh-default ) portdefault=0; shift;;
-r | --rutorrent-stable ) rudevflag=1; shift;; -r | --rutorrent-stable ) rudevflag=1; shift;;
-m | --rutorrent-master ) rudevflag=0; shift;;
-y | --force-yes ) forceyes=0; shift;; -y | --force-yes ) forceyes=0; shift;;
-s | --self-signed ) selfsign=0; shift;;
-u | --user ) user="$2"; shift; shift;; -u | --user ) user="$2"; shift; shift;;
-p | --password ) unixpass="$2"; shift; shift;; -p | --password ) unixpass="$2"; shift; shift;;
-w | --webpass ) webpass="$2"; shift; shift;; -w | --webpass ) webpass="$2"; shift; shift;;
@@ -230,6 +272,46 @@ if [ $# -gt 0 ]; then
exit 1 exit 1
fi fi
# check required web repos are accessible
os_repo=0
major_repo=0
sed -i "s/\/debian\s/\/debian\/ /g" /etc/apt/sources.list
echo
echo "Checking the web sites we will need are accessible"
echo "Checking $osname mirrors"
for i in $(cat /etc/apt/sources.list | grep "^deb http" | cut -d' ' -f2 | uniq ); do
echo -n $i": "
check_url $i && echo "OK" || { echo "FAIL"; os_repo=1; }
done
echo
echo "Checking major 3rd party components"
echo -n "Rtorrent: "; check_url $rt_url && echo "OK" || { echo "FAIL"; major_repo=1; }
echo -n "xmlrpc-c: "; check_url $xmlrpc_url && echo "OK" || xmlrpc_repo=1
if [[ $xmlrpc_repo = 1 ]]; then
xmlrpc_url=$xmlrpc_url_alt
check_url $xmlrpc_url && echo "OK" || { echo "FAIL"; major_repo=1; }
fi
echo -n "RuTorrent: ";check_url $ru_url && echo "OK" || { echo "FAIL"; major_repo=1; }
echo -n "Autodl-irssi: "; check_url $adl_url && echo "OK" || { echo "FAIL"; major_repo=1; }
if [ $os_repo = 1 ]; then
echo "Some of your $osname mirrors are down, try again later"
exit 1
fi
if [ $major_repo = 1 ]; then
echo "Some of the repositories we need are not currently available."
echo "We will continue for now, but may not be able to finish"
echo "You can rerun rtinst later to complete the installation if needed"
fi
echo
# check IP Address # check IP Address
[ $forceyes = 1 ] && enter_ip [ $forceyes = 1 ] && enter_ip
@@ -244,22 +326,21 @@ else
fi fi
#check rtorrent installation #check rtorrent installation
if hash rtorrent >> /dev/null 2>&1; then if installed rtorrent; then
rtorrent_current=$(rtorrent -h | grep -m 1 'version') rt_current=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
rtorrent_current=${rtorrent_current#*version }
if [ $forceyes = 1 ]; then if [ $forceyes = 1 ]; then
echo "rtorrent $rtorrent_current has been detected." echo "rtorrent $rt_current has been detected."
echo -n "Do you wish to skip rtorrent compilation? " echo -n "Do you wish to skip rtorrent compilation? "
if ask_user; then if ask_user; then
install_rt=1 skip_rt=0
echo "rtorrent installation will be skipped." echo "rtorrent installation will be skipped."
else else
install_rt=0 skip_rt=1
echo "rtorrent will be re-installed" echo "rtorrent will be re-installed"
fi fi
else else
install_rt=1 skip_rt=0
echo "rtorrent $rtorrent_current has been detected." echo "rtorrent $rt_current has been detected."
echo "rtorrent installation will be skipped." echo "rtorrent installation will be skipped."
fi fi
fi fi
@@ -270,7 +351,7 @@ fi
# set and prepare user # set and prepare user
if [ -z "$user" ]; then if [ -z "$user" ]; then
if [ -z "$SUDO_USER" ]; then if [ "$SUDO_USER" = "root" ] || [ -z "$SUDO_USER" ]; then
echo "Enter the name of the user to install to" echo "Enter the name of the user to install to"
echo "This will be your primary user" echo "This will be your primary user"
echo "It can be an existing user or a new user" echo "It can be an existing user or a new user"
@@ -309,14 +390,57 @@ home=$(eval echo "~$user")
#set password for rutorrent #set password for rutorrent
if [ -z "$webpass" ] && [ $forceyes = 0 ]; then if [ -z "$webpass" ] && [ $forceyes = 0 ]; then
webpass=$(genpasswd) if [ -z $(grep -s $user $passfile) ]; then
passflag=1 webpass=$(genpasswd)
passflag=1
else
passflag=2
fi
fi fi
if [ -z "$webpass" ]; then
echo "Set Password for RuTorrent web client"
webpass=$(set_pass) if [ -z "$webpass" ] && [ $passflag != 2 ]; then
passflag=$? if [ ! -z $(grep -s $user $passfile) ]; then
echo "There is an existing RuTorrent password for $user"
echo -n "Use existing password y/n ? "
if ask_user; then
passflag=2
fi
fi
if [ $passflag != 2 ]; then
echo "Set Password for RuTorrent web client"
webpass=$(set_pass)
passflag=$?
fi
fi
rut_user_list=$(ls /var/www/rutorrent/conf/users 2>/dev/null | sed "s/$user//g")
for rut_user in $rut_user_list; do
if ! id -u $rut_user >/dev/null 2>&1; then
rut_user_list=$(echo $rut_user_list | sed "s/$rut_user//g")
fi
done
if [ -z "$rut_user_list" ]; then
echo "No additional users to add"
else
echo "These users have been detected:"
for rut_user in $rut_user_list; do
echo $rut_user
done
if [ $forceyes = 0 ]; then
echo "Users will be added"
rut_add_users=0
else
echo -n "Add them to rutorrent y/n ? "
if ask_user; then
rut_add_users=0
fi
fi
fi fi
#Interaction ended message #Interaction ended message
@@ -325,18 +449,28 @@ echo "No more user input required, you can complete unattended"
echo "It will take approx 10 minutes for the script to complete" echo "It will take approx 10 minutes for the script to complete"
echo echo
# kill apt-daily.service if running
if [[ $(systemctl list-units --all apt-daily.service | fgrep -c apt-daily.service) -gt 0 ]]; then
systemctl stop apt-daily.service >> $logfile 2>&1
systemctl kill --kill-who=all apt-daily.service >> $logfile 2>&1
# wait until `apt-get updated` has been killed
while ! (systemctl list-units --all apt-daily.service | fgrep -q dead)
do
sleep 1;
done
fi
#update amd upgrade system #update amd upgrade system
echo "Updating package lists" | tee $logfile echo "Updating package lists" | tee $logfile
apt-get update 2>&1 >>$logfile | tee -a $logfile apt-get -qq update | tee -a $logfile
if ! [ $? = 0 ]; then
error_exit "Problem updating packages."
fi
echo "Upgrading packages" | tee -a $logfile echo "Upgrading packages" | tee -a $logfile
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
apt-get -y upgrade 2>&1 >>$logfile | tee -a $logfile apt-get -qq upgrade >> $logfile 2>&1
if ! [ $? = 0 ]; then if ! [ $? = 0 ]; then
error_exit "Problem upgrading packages." echo "Problem upgrading packages. Run 'apt-get upgrade' successfully and rerun the script" && exit
fi fi
apt-get clean && apt-get autoclean >> $logfile 2>&1 apt-get clean && apt-get autoclean >> $logfile 2>&1
@@ -354,20 +488,31 @@ for package_name in $package_list
fi fi
done done
test -z "$install_list" || apt-get -y install $install_list 2>&1 >>$logfile | tee -a $logfile test -z "$install_list" || apt-get -qq install $install_list >> $logfile 2>&1
if ! [ $? = 0 ]; then
echo "Problem installing packages. Check log and rerun once it is resolved" && exit
fi
if [[ $phpver =~ php7.[0-9] ]]; then
apt-get -qq install $phpver-mbstring >> $logfile 2>&1
fi
#install unrar package #install unrar package
if [ $osname = "Debian" ] && ! hash unrar >> /dev/null 2>&1; then if [ $osname = "Debian" ] && ! installed unrar; then
echo "Installing rar/unrar" echo "Installing rar/unrar"
cd $home cd $home
attempts=0 attempts=0
until [ -d rar ] || [ $attempts -gt 5 ] until [ -d rar ] || [ $attempts -gt 5 ]
do do
attempts=$(( $attempts + 1 )) attempts=$(( $attempts + 1 ))
if [ "$(uname -m)" = "x86_64" ]; then if [ "$(uname -m)" = "x86_64" ]; then
curl -s --connect-timeout 10 http://www.rarlab.com/rar/rarlinux-x64-5.4.0.tar.gz | tar xz 2>/dev/null wget http://www.rarlab.com/rar/rarlinux-x64-5.5.0.tar.gz >> $logfile 2>&1
tar xvzf rarlinux-x64-5.5.0.tar.gz >> $logfile 2>&1
rm rarlinux-x64-5.5.0.tar.gz
elif [ "$(uname -m)" = "x86_32" ]; then elif [ "$(uname -m)" = "x86_32" ]; then
curl -s --connect-timeout 10 http://www.rarlab.com/rar/rarlinux-5.4.0.tar.gz | tar xz 2>/dev/null wget http://www.rarlab.com/rar/rarlinux-5.5.0.tar.gz >> $logfile 2>&1
tar xvzf rarlinux-5.5.0.tar.gz >> $logfile 2>&1
rm rarlinux-5.5.0.tar.gz
fi fi
done done
if [ -d rar ]; then if [ -d rar ]; then
@@ -376,10 +521,10 @@ if [ $osname = "Debian" ] && ! hash unrar >> /dev/null 2>&1; then
rm -r $home/rar rm -r $home/rar
fi fi
elif [ $osname = "Ubuntu" ]; then elif [ $osname = "Ubuntu" ]; then
apt-get -y install unrar >> $logfile 2>&1 apt-get -qq install unrar >> $logfile 2>&1
fi fi
if hash unrar >> /dev/null 2>&1; then if installed unrar; then
echo "rar/unrar installed" echo "rar/unrar installed"
else else
echo "rar/unrar install failed" echo "rar/unrar install failed"
@@ -389,16 +534,17 @@ fi
if ! [ $osname = "Raspbian" ] && [ $(dpkg-query -W -f='${Status}' "ffmpeg" 2>/dev/null | grep -c "ok installed") = 0 ]; then if ! [ $osname = "Raspbian" ] && [ $(dpkg-query -W -f='${Status}' "ffmpeg" 2>/dev/null | grep -c "ok installed") = 0 ]; then
echo "Installing ffmpeg" echo "Installing ffmpeg"
if [ $relno = 14 ]; then if [ $relno = 14 ]; then
apt-add-repository -y ppa:mc3man/trusty-media >> $logfile 2>&1 || error_exit "Problem adding to repository from - https://launchpad.net/~mc3man/+archive/ubuntu/ppa" apt-add-repository -y ppa:mc3man/trusty-media >> $logfile 2>&1
apt-get update >> $logfile 2>&1 || error_exit "problem updating package lists" apt-get -qq update >> $logfile 2>&1
apt-get -y install ffmpeg >> $logfile 2>&1 apt-get -qq install ffmpeg >> $logfile 2>&1
elif [ $relno = 8 ]; then elif [ $relno = 8 ]; then
grep "deb http://www.deb-multimedia.org jessie main" /etc/apt/sources.list >> /dev/null || echo "deb http://www.deb-multimedia.org jessie main" >> /etc/apt/sources.list grep "deb http://www.deb-multimedia.org jessie main" /etc/apt/sources.list >> /dev/null || echo "deb http://www.deb-multimedia.org jessie main" >> /etc/apt/sources.list
apt-get update >> $logfile 2>&1 || error_exit "problem updating package lists" apt-get -qq update >> $logfile 2>&1
apt-get -y --force-yes install deb-multimedia-keyring >> $logfile 2>&1 apt-get -qq --force-yes install deb-multimedia-keyring >> $logfile 2>&1
apt-get -y --force-yes install ffmpeg >> $logfile 2>&1 apt-get -qq update >> $logfile 2>&1
apt-get -qq --force-yes install ffmpeg >> $logfile 2>&1
else else
apt-get -y install ffmpeg >> $logfile 2>&1 apt-get -qq install ffmpeg >> $logfile 2>&1
fi fi
fi fi
@@ -440,6 +586,7 @@ sed -i "/^\(\s\|#\)*X11Forwarding /c\X11Forwarding no" /etc/ssh/sshd_config
sed -i '/^\s*PermitRootLogin/ c\PermitRootLogin no' /etc/ssh/sshd_config sed -i '/^\s*PermitRootLogin/ c\PermitRootLogin no' /etc/ssh/sshd_config
sed -i '/^\s*PasswordAuthentication no/ c\#PasswordAuthentication no' /etc/ssh/sshd_config sed -i '/^\s*PasswordAuthentication no/ c\#PasswordAuthentication no' /etc/ssh/sshd_config
echo >> /etc/ssh/sshd_config
grep -Pq "^[#\s]*UsePAM" /etc/ssh/sshd_config && sed -i '/^\(\s\|#\)*UsePAM/ c\UsePAM yes' /etc/ssh/sshd_config || echo "UsePAM yes" >> /etc/ssh/sshd_config grep -Pq "^[#\s]*UsePAM" /etc/ssh/sshd_config && sed -i '/^\(\s\|#\)*UsePAM/ c\UsePAM yes' /etc/ssh/sshd_config || echo "UsePAM yes" >> /etc/ssh/sshd_config
grep -Pq "^[#\s]*UseDNS" /etc/ssh/sshd_config && sed -i '/^\(\s\|#\)*UseDNS/ c\UseDNS no' /etc/ssh/sshd_config || echo "UseDNS no" >> /etc/ssh/sshd_config grep -Pq "^[#\s]*UseDNS" /etc/ssh/sshd_config && sed -i '/^\(\s\|#\)*UseDNS/ c\UseDNS no' /etc/ssh/sshd_config || echo "UseDNS no" >> /etc/ssh/sshd_config
@@ -467,7 +614,8 @@ echo "SSH port set to $sshport"
### SSL CERTIFICATES ### ### SSL CERTIFICATES ###
############################### ###############################
rtsslcert -d $serverip # calls the script rtsslcert to generate the ssl certificated for vsftpd and nginx
rtsslcert -d
############################### ###############################
### INSTALL FTP ### ### INSTALL FTP ###
@@ -492,6 +640,12 @@ sed -i 's/^\s*listen_ipv6/#listen_ipv6/g' /etc/vsftpd.conf
grep ^listen_port /etc/vsftpd.conf > /dev/null || echo "listen_port=$ftpport" >> /etc/vsftpd.conf grep ^listen_port /etc/vsftpd.conf > /dev/null || echo "listen_port=$ftpport" >> /etc/vsftpd.conf
if [[ $LANG =~ .*[Uu][Tt][Ff]-?8.* ]]; then
grep -Pq "utf8_filesystem=" /etc/vsftpd.conf && sed -i '/^\(\s\|#\)*utf8_filesystem=/ c\utf8_filesystem=YES' /etc/vsftpd.conf || echo "utf8_filesystem=YES" >> /etc/vsftpd.conf
fi
grep -Pq "use_sendfile=" /etc/vsftpd.conf && sed -i '/^\(\s\|#\)*use_sendfile=/ c\use_sendfile=NO' /etc/vsftpd.conf || echo "use_sendfile=NO" >> /etc/vsftpd.conf
grep -Pq "^\s*ssl_enable" /etc/vsftpd.conf && sed -i '/^\s*ssl_enable/ c\ssl_enable=YES' /etc/vsftpd.conf || echo "ssl_enable=YES" >> /etc/vsftpd.conf grep -Pq "^\s*ssl_enable" /etc/vsftpd.conf && sed -i '/^\s*ssl_enable/ c\ssl_enable=YES' /etc/vsftpd.conf || echo "ssl_enable=YES" >> /etc/vsftpd.conf
grep -Pq "^\s*chroot_local_user" /etc/vsftpd.conf && sed -i '/^\s*chroot_local_user/ c\chroot_local_user=YES' /etc/vsftpd.conf || echo "chroot_local_user=YES" >> /etc/vsftpd.conf grep -Pq "^\s*chroot_local_user" /etc/vsftpd.conf && sed -i '/^\s*chroot_local_user/ c\chroot_local_user=YES' /etc/vsftpd.conf || echo "chroot_local_user=YES" >> /etc/vsftpd.conf
grep -Pq "^\s*allow_writeable_chroot" /etc/vsftpd.conf && sed -i '/^\s*allow_writeable_chroot/ c\allow_writeable_chroot=YES' /etc/vsftpd.conf || echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf grep -Pq "^\s*allow_writeable_chroot" /etc/vsftpd.conf && sed -i '/^\s*allow_writeable_chroot/ c\allow_writeable_chroot=YES' /etc/vsftpd.conf || echo "allow_writeable_chroot=YES" >> /etc/vsftpd.conf
@@ -509,53 +663,93 @@ service vsftpd restart 1>> $logfile
ftpport=$(grep 'listen_port=' /etc/vsftpd.conf | sed 's/[^0-9]*//g') ftpport=$(grep 'listen_port=' /etc/vsftpd.conf | sed 's/[^0-9]*//g')
echo "FTP port set to $ftpport" echo "FTP port set to $ftpport"
###############################
### INSTALL NGINX ###
###############################
cd $home
if [ -f "/etc/apache2/ports.conf" ]; then
echo "Detected apache2. Changing apache2 port to 81 in /etc/apache2/ports.conf" | tee -a $logfile
sed -i "s/Listen 80/Listen 81/g" /etc/apache2/ports.conf
service apache2 stop >> $logfile 2>&1
fi
echo "Installing nginx" | tee -a $logfile
if [ $passflag != 2 ]; then
if [ -f $passfile ]; then
htpasswd -b $passfile $user $webpass >> $logfile 2>&1
else
htpasswd -c -b $passfile $user $webpass >> $logfile 2>&1
fi
fi
chown www-data:www-data $passfile
chmod 640 $passfile
sed -i "s/user www-data;/user www-data www-data;/g" /etc/nginx/nginx.conf
sed -i "s/worker_processes 4;/worker_processes 1;/g" /etc/nginx/nginx.conf
sed -i "s/pid \/run\/nginx\.pid;/pid \/var\/run\/nginx\.pid;/g" /etc/nginx/nginx.conf
sed -i "s/# server_tokens off;/server_tokens off;/g" /etc/nginx/nginx.conf
sed -i "s/access_log \/var\/log\/nginx\/access\.log;/access_log off;/g" /etc/nginx/nginx.conf
sed -i "s/error\.log;/error\.log crit;/g" /etc/nginx/nginx.conf
grep client_max_body_size /etc/nginx/nginx.conf > /dev/null 2>&1 || sed -i "/server_tokens off;/ a\ client_max_body_size 40m;\n" /etc/nginx/nginx.conf
sed -i "/upload_max_filesize/ c\upload_max_filesize = 40M" $phploc/fpm/php.ini
sed -i '/^;\?listen.owner/ c\listen.owner = www-data' $phploc/fpm/pool.d/www.conf
sed -i '/^;\?listen.group/ c\listen.group = www-data' $phploc/fpm/pool.d/www.conf
sed -i '/^;\?listen.mode/ c\listen.mode = 0660' $phploc/fpm/pool.d/www.conf
mkdir -p /var/www
if [ -d "/usr/share/nginx/www" ]; then
cp /usr/share/nginx/www/* /var/www
elif [ -d "/usr/share/nginx/html" ]; then
cp /usr/share/nginx/html/* /var/www
fi
mv -n /etc/nginx/sites-available/default /etc/nginx/sites-available/default.original
cp -f /etc/rtinst/conf/nginxsite /etc/nginx/sites-available/default
cp -f /etc/rtinst/conf/nginxsitedl /etc/nginx/sites-available/dload-loc
echo "location ~ \.php$ {" > /etc/nginx/conf.d/php
echo " fastcgi_split_path_info ^(.+\.php)(/.+)$;" >> /etc/nginx/conf.d/php
if [ "$phpver" = "php5" ]; then
echo " fastcgi_pass unix:/var/run/php5-fpm.sock;" >> /etc/nginx/conf.d/php
else
echo " fastcgi_pass unix:/var/run/php/$phpver-fpm.sock;" >> /etc/nginx/conf.d/php
fi
echo " fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;" >> /etc/nginx/conf.d/php
echo " fastcgi_index index.php;" >> /etc/nginx/conf.d/php
echo " include fastcgi_params;" >> /etc/nginx/conf.d/php
echo "}" >> /etc/nginx/conf.d/php
echo "location ~* \.(jpg|jpeg|gif|css|png|js|woff|ttf|svg|eot)$ {" > /etc/nginx/conf.d/cache
echo " expires 30d;" >> /etc/nginx/conf.d/cache
echo "}" >> /etc/nginx/conf.d/cache
service nginx restart && service $phpver-fpm restart
if [ $dlflag = 0 ]; then
rtdload enable
fi
############################### ###############################
### INSTALL RTORRENT ### ### INSTALL RTORRENT ###
############################### ###############################
if [ $install_rt = 0 ]; then if [ $skip_rt = 1 ]; then
cd $home if [ -z $rtorrentrel ]; then
mkdir -p source rtorrentrel='latest'
cd source
echo "Downloading rtorrent source files" | tee -a $logfile
rm -rf xmlrpc libtorrent-$libtorrentrel rtorrent-$rtorrentrel
svn co $xmlrpcloc xmlrpc >> $logfile 2>&1 || error_exit "Unable to download xmlrpc source files from https://svn.code.sf.net/p/xmlrpc-c/code/stable"
if [ $relno -eq 9 ]; then
git clone -q -b feature-bind --single-branch https://github.com/rakshasa/libtorrent.git libtorrent-$libtorrentrel
git clone -q -b feature-bind --single-branch https://github.com/rakshasa/rtorrent.git rtorrent-$rtorrentrel
else
curl -# $libtorrentloc | tar xz >> $logfile 2>&1 || error_exit "Unable to download libtorrent source files from http://libtorrent.rakshasa.no/downloads"
curl -# $rtorrentloc | tar xz >> $logfile 2>&1 || error_exit "Unable to download rtorrent source files from http://libtorrent.rakshasa.no/downloads"
fi fi
export home
cd xmlrpc # call the script rtupdate to install lib/rtorrent
echo "Installing xmlrpc" | tee -a $logfile rtupdate $rtorrentrel || early_exit
./configure --prefix=/usr --disable-cplusplus >> $logfile 2>&1 export -n home
make >> $logfile 2>&1
make install >> $logfile 2>&1
cd ../libtorrent-$libtorrentrel
echo "Installing libtorrent" | tee -a $logfile
./autogen.sh >> $logfile 2>&1
if [ $osname = "Raspbian" ]; then
./configure --prefix=/usr --disable-instrumentation >> $logfile 2>&1
else
./configure --prefix=/usr >> $logfile 2>&1
fi
make -j2 >> $logfile 2>&1
make install >> $logfile 2>&1
cd ../rtorrent-$rtorrentrel
echo "Installing rtorrent" | tee -a $logfile
./autogen.sh >> $logfile 2>&1
./configure --prefix=/usr --with-xmlrpc-c >> $logfile 2>&1
make -j2 >> $logfile 2>&1
make install >> $logfile 2>&1
ldconfig >> $logfile 2>&1
else else
echo "skiping rtorrent installation" | tee -a $logfile echo "skiping rtorrent installation" | tee -a $logfile
fi fi
echo "Configuring rtorrent" | tee -a $logfile echo "Configuring rtorrent" | tee -a $logfile
@@ -576,24 +770,21 @@ sed -i "s/<user name>/$user/g" $home/.rtorrent.rc
mkdir -p /var/www mkdir -p /var/www
cd /var/www cd /var/www
echo -n "RuTorrent: "; check_url $ru_url && echo "OK" || { echo "FAIL"; early_exit; }
if [ -d "/var/www/rutorrent" ]; then if [ -d "/var/www/rutorrent" ]; then
rm -r /var/www/rutorrent rm -r /var/www/rutorrent
fi fi
if [ $rudevflag = 1 ]; then if [ $rudevflag = 1 ]; then
echo "Installing Rutorrent (stable)" | tee -a $logfile rurelease=$(git ls-remote -t https://github.com/Novik/ruTorrent v\* | cut -d/ -f3 | sort -V | tail -1)
wget --no-check-certificate https://bintray.com/artifact/download/novik65/generic/rutorrent-3.6.tar.gz >> $logfile 2>&1 || error_exit "Unable to download rutorrent files from https://bintray.com/artifact/download/novik65/generic/rutorrent-3.6.tar.gz" fi
wget --no-check-certificate https://bintray.com/artifact/download/novik65/generic/plugins-3.6.tar.gz >> $logfile 2>&1 || error_exit "Unable to download rutorrent plugin files from https://bintray.com/artifact/download/novik65/generic/plugins-3.6.tar.gz"
tar -xzf rutorrent-3.6.tar.gz echo "Installing Rutorrent ($rurelease)" | tee -a $logfile
tar -xzf plugins-3.6.tar.gz wget -q https://github.com/Novik/ruTorrent/archive/$rurelease.tar.gz | tee -a $logfile
rm rutorrent-3.6.tar.gz tar -xzf $rurelease.tar.gz
rm plugins-3.6.tar.gz mv $(tar -tzf $rurelease.tar.gz | head -1) rutorrent
rm -r rutorrent/plugins rm $rurelease.tar.gz
mv plugins rutorrent
else
echo "Installing Rutorrent (latest build)" | tee -a $logfile
git clone https://github.com/Novik/ruTorrent.git rutorrent >> $logfile 2>&1
fi
echo "Configuring Rutorrent" | tee -a $logfile echo "Configuring Rutorrent" | tee -a $logfile
rm rutorrent/conf/config.php rm rutorrent/conf/config.php
@@ -619,71 +810,6 @@ if [ $osname = "Raspbian" ]; then
echo 'enabled = no' >> /var/www/rutorrent/conf/plugins.ini echo 'enabled = no' >> /var/www/rutorrent/conf/plugins.ini
fi fi
###############################
### INSTALL NGINX ###
###############################
cd $home
if [ -f "/etc/apache2/ports.conf" ]; then
echo "Detected apache2. Changing apache2 port to 81 in /etc/apache2/ports.conf" | tee -a $logfile
sed -i "s/Listen 80/Listen 81/g" /etc/apache2/ports.conf
service apache2 stop >> $logfile 2>&1
fi
echo "Installing nginx" | tee -a $logfile
htpasswd -c -b $passfile $user $webpass >> $logfile 2>&1
chown www-data:www-data $passfile
chmod 640 $passfile
sed -i "s/user www-data;/user www-data www-data;/g" /etc/nginx/nginx.conf
sed -i "s/worker_processes 4;/worker_processes 1;/g" /etc/nginx/nginx.conf
sed -i "s/pid \/run\/nginx\.pid;/pid \/var\/run\/nginx\.pid;/g" /etc/nginx/nginx.conf
sed -i "s/# server_tokens off;/server_tokens off;/g" /etc/nginx/nginx.conf
sed -i "s/access_log \/var\/log\/nginx\/access\.log;/access_log off;/g" /etc/nginx/nginx.conf
sed -i "s/error\.log;/error\.log crit;/g" /etc/nginx/nginx.conf
grep client_max_body_size /etc/nginx/nginx.conf > /dev/null 2>&1 || sed -i "/server_tokens off;/ a\ client_max_body_size 40m;\n" /etc/nginx/nginx.conf
sed -i "/upload_max_filesize/ c\upload_max_filesize = 40M" $phploc/fpm/php.ini
sed -i '/^;\?listen.owner/ c\listen.owner = www-data' $phploc/fpm/pool.d/www.conf
sed -i '/^;\?listen.group/ c\listen.group = www-data' $phploc/fpm/pool.d/www.conf
sed -i '/^;\?listen.mode/ c\listen.mode = 0660' $phploc/fpm/pool.d/www.conf
if [ -d "/usr/share/nginx/www" ]; then
cp /usr/share/nginx/www/* /var/www
elif [ -d "/usr/share/nginx/html" ]; then
cp /usr/share/nginx/html/* /var/www
fi
mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.old
cp -f /etc/rtinst/conf/nginxsite /etc/nginx/sites-available/default
cp -f /etc/rtinst/conf/nginxsitedl /etc/nginx/sites-available/dload-loc
echo "location ~ \.php$ {" > /etc/nginx/conf.d/php
echo " fastcgi_split_path_info ^(.+\.php)(/.+)$;" >> /etc/nginx/conf.d/php
if [ "$phpver" = "php7.0" ]; then
echo " fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;" >> /etc/nginx/conf.d/php
else
echo " fastcgi_pass unix:/var/run/php5-fpm.sock;" >> /etc/nginx/conf.d/php
fi
echo " fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;" >> /etc/nginx/conf.d/php
echo " fastcgi_index index.php;" >> /etc/nginx/conf.d/php
echo " include fastcgi_params;" >> /etc/nginx/conf.d/php
echo "}" >> /etc/nginx/conf.d/php
echo "location ~* \.(jpg|jpeg|gif|css|png|js|woff|ttf|svg|eot)$ {" > /etc/nginx/conf.d/cache
echo " expires 30d;" >> /etc/nginx/conf.d/cache
echo "}" >> /etc/nginx/conf.d/cache
service nginx restart && service $phpver-fpm restart
if [ $dlflag = 0 ]; then
rtdload enable
fi
############################### ###############################
### INSTALL AUTODL-IRSSI ### ### INSTALL AUTODL-IRSSI ###
############################### ###############################
@@ -695,14 +821,13 @@ adlpass=$(genpasswd $(random 12 16))
mkdir -p $home/.irssi/scripts/autorun mkdir -p $home/.irssi/scripts/autorun
cd $home/.irssi/scripts cd $home/.irssi/scripts
curl -sL http://git.io/vlcND | grep -Po '(?<="browser_download_url": ")(.*-v[\d.]+.zip)' | xargs wget --quiet -O autodl-irssi.zip curl -sL http://git.io/vlcND | grep -Po '(?<="browser_download_url": ")(.*-v[\d.]+.zip)' | xargs wget --quiet -O autodl-irssi.zip
unzip -o autodl-irssi.zip >> $logfile 2>&1 unzip -qq -o autodl-irssi.zip | tee -a $logfile
rm autodl-irssi.zip rm autodl-irssi.zip
cp autodl-irssi.pl autorun/ cp autodl-irssi.pl autorun/
mkdir -p $home/.autodl mkdir -p $home/.autodl
touch $home/.autodl/autodl.cfg && touch $home/.autodl/autodl2.cfg
cd /var/www/rutorrent/plugins cd /var/www/rutorrent/plugins
git clone https://github.com/autodl-community/autodl-rutorrent.git autodl-irssi >> $logfile 2>&1 || error_exit "Unable to download autodl plugin files from https://github.com/autodl-community/autodl-irssi" git clone -q https://github.com/autodl-community/autodl-rutorrent.git autodl-irssi | tee -a $home/rtinst.info
mkdir /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi mkdir /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi
@@ -716,9 +841,23 @@ echo >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
echo "?>" >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php echo "?>" >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
cd $home/.autodl cd $home/.autodl
echo "[options]" > autodl2.cfg rm -f autodl2.cfg
echo "gui-server-port = $adlport" >> autodl2.cfg
echo "gui-server-password = $adlpass" >> autodl2.cfg if [ -f "autodl.cfg" ]; then
if (grep -sq gui-server-port autodl.cfg) && (grep -sq gui-server-password autodl.cfg); then
sed -i "/gui-server-port/ c\gui-server-port = $adlport" autodl.cfg
sed -i "/gui-server-password/ c\gui-server-password = $adlpass" autodl.cfg
else
sed -i '/gui-server-port/ d' autodl.cfg
sed -i '/gui-server-password/ d' autodl.cfg
echo >> autodl.cfg
sed -i "1s/^/[options]\ngui-server-port = $adlport\ngui-server-password = $adlpass\n/" autodl.cfg
fi
else
echo "[options]" > autodl.cfg
echo "gui-server-port = $adlport" >> autodl.cfg
echo "gui-server-password = $adlpass" >> autodl.cfg
fi
############################### ###############################
### FINAL TASKS ### ### FINAL TASKS ###
@@ -727,9 +866,12 @@ echo "gui-server-password = $adlpass" >> autodl2.cfg
# set permissions # set permissions
echo "Setting permissions, Starting services" | tee -a $logfile echo "Setting permissions, Starting services" | tee -a $logfile
chown -R www-data:www-data /var/www chown -R www-data:www-data /var/www
chmod -R 755 /var/www/rutorrent
chown -R $user:$user $home chown -R $user:$user $home
if [ $dlflag = 0 ]; then
find $home -type d -print0 | xargs -0 chmod 755
fi
cd $home cd $home
#allows users to change their rutorrent passwords #allows users to change their rutorrent passwords
@@ -750,37 +892,89 @@ if [ -z "$(crontab -u $user -l | grep "\*/10 \* \* \* \* /usr/local/bin/rtcheck
(crontab -u $user -l; echo "$cronline2" ) | crontab -u $user - >> $logfile 2>&1 (crontab -u $user -l; echo "$cronline2" ) | crontab -u $user - >> $logfile 2>&1
fi fi
# add aditional users if any
if [ $rut_add_users = 0 ]; then
for rut_user in $rut_user_list; do
echo "Adding $rut_user"
rtadduser -n -u $rut_user >> $logfile 2>&1
done
fi
############################### ###############################
### WRITE RTINST.INFO ### ### WRITE RTINST.INFO ###
############################### ###############################
echo
echo "crontab entries made. rtorrent and irssi will start on boot for $user"
echo
echo "ftp client should be set to explicit ftp over tls using port $ftpport" | tee $home/rtinst.info
echo
if [ $dlflag = 0 ]; then
find $home -type d -print0 | xargs -0 chmod 755
fi
echo "If enabled, access https downloads at https://$serverip/download/$user" | tee -a $home/rtinst.info
echo
echo "rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info
if [ $passflag = 1 ]; then ftp_current=$(apt-cache policy vsftpd | grep -o Installed.* | cut -d ' ' -f2)
echo "rutorrent password set to $webpass" | tee -a $home/rtinst.info rt_current=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
ru_current=$(grep -m 1 version: /var/www/rutorrent/js/webui.js | cut -d \" -f2)
echo
echo
echo "Summary of Installation (Important Information, please read" | tee $home/rtinst.info
echo | tee $home/rtinst.info
echo "SSH Configured" | tee -a $home/rtinst.info
echo " SSH port set to $sshport" | tee -a $home/rtinst.info
echo " root login directly from SSH disabled"
echo " login with $user and switch to root using: sudo su"
echo | tee -a $home/rtinst.info
echo "FTP Server" | tee -a $home/rtinst.info
if installed vsftpd; then
echo " vsftpd $ftp_current installed" | tee -a $home/rtinst.info
echo " ftp port set to $ftpport" | tee -a $home/rtinst.info
echo " ftp client should be set to explicit ftp over tls using port $ftpport" | tee -a $home/rtinst.info
else else
echo "rutorrent password as set by user" | tee -a $home/rtinst.info echo " vsftpd is not installed" | tee -a $home/rtinst.info
fi fi
echo "to change rutorrent password enter: rtpass" | tee -a $home/rtinst.info echo | tee -a $home/rtinst.info
echo
echo "IMPORTANT: SSH Port set to $sshport - Ensure you can login before closing this session" echo "rtorrent torrent client" | tee -a $home/rtinst.info
echo "ssh port changed to $sshport" | tee -a $home/rtinst.info > /dev/null if installed rtorrent; then
echo " rtorrent $rt_current installed" | tee -a $home/rtinst.info
echo " crontab entries made. rtorrent and irssi will start on boot for $user" | tee -a $home/rtinst.info
else
echo " rtorrent was not installed" | tee -a $home/rtinst.info
fi
echo | tee -a $home/rtinst.info
echo "RuTorrent Web GUI" | tee -a $home/rtinst.info
if [ -z $ru_current ]; then
echo " RuTorrent was not installed" | tee -a $home/rtinst.info
else
echo " RuTorrent $ru_current installed" | tee -a $home/rtinst.info
echo " rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info
if [ $passflag = 1 ]; then
echo " rutorrent password set to $webpass" | tee -a $home/rtinst.info
elif [ $passflag = 2 ]; then
echo " rutorrent password has not been changed" | tee -a $home/rtinst.info
else
echo " rutorrent password as set by user" | tee -a $home/rtinst.info
fi
echo " to change rutorrent password enter: rtpass" | tee -a $home/rtinst.info
echo | tee -a $home/rtinst.info
echo " If enabled, access https downloads at https://$serverip/download/$user" | tee -a $home/rtinst.info
fi
echo | tee -a $home/rtinst.info
echo "IMPORTANT: SSH Port set to $sshport" | tee -a $home/rtinst.info
echo "IMPORTANT: SSH Port set to $sshport"
echo "IMPORTANT: SSH Port set to $sshport"
echo "Please ensure you can login BEFORE closing this session"
echo echo
echo "The above information is stored in rtinst.info in your home directory." echo "The above information is stored in rtinst.info in your home directory."
echo "To see contents enter: cat $home/rtinst.info" echo "To see contents enter: cat $home/rtinst.info"
echo echo
echo "To install webmin enter: sudo rtwebmin" echo "To install webmin enter: sudo rtwebmin"
echo echo
echo "SCROLL UP IF NEEDED TO READ ALL THE SUMMARY INFO"
echo "PLEASE REBOOT YOUR SYSTEM ONCE YOU HAVE NOTED THE ABOVE INFORMATION" echo "PLEASE REBOOT YOUR SYSTEM ONCE YOU HAVE NOTED THE ABOVE INFORMATION"
echo | tee -a $home/rtinst.info
echo "Thank You for choosing rtinst" | tee -a $home/rtinst.info
echo
chown $user rtinst.info chown $user rtinst.info
+10 -10
View File
@@ -11,6 +11,7 @@
forceyes=1 forceyes=1
headless=1 headless=1
selfsign=1
#function to check if string is valid format for an ip address #function to check if string is valid format for an ip address
valid_ip() valid_ip()
@@ -48,19 +49,19 @@ echo -n "Generating https/ssl certificates"
openssl req -x509 -nodes -days 3650 -subj /CN=$serverip -config /etc/ssl/ruweb.cnf -newkey rsa:2048 -keyout /etc/ssl/private/ruweb.key -out /etc/ssl/ruweb.crt > /dev/null 2>&1 openssl req -x509 -nodes -days 3650 -subj /CN=$serverip -config /etc/ssl/ruweb.cnf -newkey rsa:2048 -keyout /etc/ssl/private/ruweb.key -out /etc/ssl/ruweb.crt > /dev/null 2>&1
echo ": done"
if [ -f /etc/vsftpd.conf ]; then if [ -f /etc/vsftpd.conf ]; then
sed -i '/^\(\s\|#\)*rsa_private_key_file/ c\rsa_private_key_file=\/etc\/ssl\/private\/ruweb\.key' /etc/vsftpd.conf sed -i '/^\(\s\|#\)*rsa_private_key_file/ c\rsa_private_key_file=\/etc\/ssl\/private\/ruweb\.key' /etc/vsftpd.conf
sed -i '/^\(\s\|#\)*rsa_cert_file/ c\rsa_cert_file=\/etc\/ssl\/ruweb\.crt' /etc/vsftpd.conf sed -i '/^\(\s\|#\)*rsa_cert_file/ c\rsa_cert_file=\/etc\/ssl\/ruweb\.crt' /etc/vsftpd.conf
service vsftpd restart service vsftpd restart >/dev/null 2>&1
fi fi
if [ -f /etc/nginx/sites-available/default ]; then if [ -f /etc/nginx/sites-available/default ]; then
sed -i '/ssl_certificate / c\ ssl_certificate \/etc\/ssl\/ruweb\.crt;' /etc/nginx/sites-available/default sed -i '/ssl_certificate / c\ ssl_certificate \/etc\/ssl\/ruweb\.crt;' /etc/nginx/sites-available/default
sed -i '/ssl_certificate_key/ c\ ssl_certificate_key \/etc\/ssl\/private\/ruweb\.key;' /etc/nginx/sites-available/default sed -i '/ssl_certificate_key/ c\ ssl_certificate_key \/etc\/ssl\/private\/ruweb\.key;' /etc/nginx/sites-available/default
service nginx restart service nginx restart >/dev/null 2>&1
fi fi
echo ": done"
} }
#check it is being run as root #check it is being run as root
@@ -71,12 +72,13 @@ fi
# options -y and -d take away the user interaction so can be called from another script # options -y and -d take away the user interaction so can be called from another script
# option -y will force the creation of new certificates # option -y will force the creation of new certificates
# option -d will not unless it determines they are needed # option -d will not unless it determines they are needed
while getopts ":yd" optname while getopts ":yds" optname
do do
case $optname in case $optname in
"y" ) forceyes=0 ;; "y" ) forceyes=0 ;;
"d" ) headless=0 ;; "d" ) headless=0 ;;
* ) echo "-y or -d only options allowed" && exit ;; "s" ) selfsign=0 ;;
* ) echo "-y, -d, and -s only options allowed" && exit ;;
esac esac
done done
@@ -87,13 +89,11 @@ if [ $forceyes = 0 ] && [ $headless = 0 ]; then
exit exit
fi fi
if [ $# -gt 1 ]; then if [ $# -gt 0 ]; then
echo "Only one argument allowed" echo "No arguments allowed"
exit exit
fi fi
serverip=$1
if [ -z $serverip ]; then if [ -z $serverip ]; then
serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}') serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
elif ! valid_ip $serverip; then elif ! valid_ip $serverip; then
+183 -55
View File
@@ -10,17 +10,59 @@
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
RTFILE=/usr/local/bin/rt osname=$(lsb_release -si)
relno=$(lsb_release -sr | cut -d. -f1)
sourcedir='http://rtorrent.net/downloads/'
duoversion="0.13.2/0.9.2 0.13.3/0.9.3 0.13.4/0.9.4 0.13.5/0.9.5 0.13.6/0.9.6" xmlrpc_url='https://svn.code.sf.net/p/xmlrpc-c/code/stable/'
OSNAME=$(cat /etc/issue.net | cut -d' ' -f1) xmlrpcloc='svn://svn.code.sf.net/p/xmlrpc-c/code/stable/'
xmlrpc_url_alt='https://github.com/mirror/xmlrpc-c'
xmlrpcloc_alt='https://github.com/mirror/xmlrpc-c/trunk/stable'
rtdevrel=1
if [ $relno = 9 ] || [ $(lsb_release -sr) = 17.10 ] || [ $relno = 18 ]; then
rtdevrel=0
fi
if [ $rtdevrel = 0 ]; then
sourcedir='https://github.com/rakshasa/'
fi
listsize=6
duoversion=''
passed_rtvers=$1
[ -z $logfile ] && logfile="/dev/null"
# get a list of the most recent releases
rt_releases=$(wget -q -O - $sourcedir | grep -o "rtorrent-[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}\.tar.gz" | sort -uV | tail -$listsize | grep -o "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
# extract the release numbers from the list of most recent releases
for rtversion in $rt_releases
do
libversion=$(echo $rtversion | awk -F. -v OFS=. '{$2='$(( $(echo $rtversion | cut -d. -f2) + 4 ))'; print }')
duoversion="$duoversion $libversion/$rtversion"
done
# get the most recent release version number
latest_duo=$(echo $duoversion | rev | cut -d' ' -f1 | rev)
latest_libvers=$(echo $latest_duo | cut -d/ -f1)
latest_rtvers=$(echo $latest_duo | cut -d/ -f2)
# checks if an application is installed
installed() { installed() {
hash $1 2>/dev/null hash $1 2>/dev/null
} }
ask_version() { #function to check if a web site is reachable
check_url() {
if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then return 0; else return 1; fi
}
# function to create a list of versions to install
list_version() {
local verschoice
while [ -z "$verschoice" ] while [ -z "$verschoice" ]
do do
echo "Please select libtorrent/rtorrent version." echo "Please select libtorrent/rtorrent version."
@@ -33,16 +75,16 @@ do
done done
} }
confirm_answer() { ask_user(){
local answer
while true while true
do do
read -p "Sure you wish to install libtorrent-"$libvers" and rtorrent-"$rtvers"?" answer read answer
case $answer in [Yy]* ) return 0 ;; case $answer in [Yy]* ) return 0 ;;
[Nn]* ) exit ;; [Nn]* ) return 1 ;;
* ) echo "Enter y or n";; * ) echo "Enter y or n";;
esac esac
done done
} }
if [ "$(id -u)" != "0" ]; then if [ "$(id -u)" != "0" ]; then
@@ -50,69 +92,155 @@ if [ "$(id -u)" != "0" ]; then
exit 1 exit 1
fi fi
if ( installed rtorrent ); then # Check the libtorrent/rtorrent and xmlrpc sites are available
rtorrent_current=$(rtorrent -h | grep -m 1 'version') xmlrpc_repo=0
rtorrent_current=${rtorrent_current#*version } rt_repo=0
echo "rtorrent $rtorrent_current detected" echo
echo echo "Checking File Repositories"
else
echo "rtorrent NOT installed" echo -n "xmlrpc-c: "; check_url $xmlrpc_url && echo "OK" || xmlrpc_repo=1
echo "This script is for upgrading/downgrading only, not for initial install"
if [[ $xmlrpc_repo = 1 ]]; then
xmlrpc_url=$xmlrpc_url_alt
xmlrpcloc=$xmlrpcloc_alt
check_url $xmlrpc_url && { echo "OK"; xmlrpc_repo=0; } || { echo "FAIL"; xmlrpc_repo=1; }
fi
echo -n "rtorrent: "; check_url $sourcedir && echo "OK" || { echo "FAIL"; rt_repo=1; }
if [ $rt_repo = 1 ]; then
echo "The libtorrent/rtorrent file repositoy is offline"
echo "Try again later, you can check if the following address is online in your browser:"
echo $sourcedir
exit 1 exit 1
fi fi
ask_version if [ $xmlrpc_repo = 1 ]; then
confirm_answer if [ -d /usr/include/xmlrpc-c ]; then
echo "xmlrpc repository is off line, but looks like it has already beed installed."
echo "We will try and install rtorrent"
else
echo "The xmlrpc-c file repositoy is offline"
echo "Try again later, you can check if the following address is online in your browser:"
echo $xmlrpcloc
exit 1
fi
fi
if [ -z $passed_rtvers ]; then
if ( installed rtorrent ); then
rt_current=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
echo "rtorrent $rt_current detected"
else
echo "rtorrent NOT installed"
echo "This script is for upgrading/downgrading only, not for initial install"
exit 1
fi
# checks if the OS is debian 9, and forces the version to 0.9.7 of it is
if [ $rtdevrel = 0 ]; then
libvers='0.13.7'
rtvers='0.9.7'
echo "Debian 9, and Ubuntu 17.10 and later, are only supported by libtorrent-0.13.7/rtorrent-0.9.7"
else
list_version
fi
echo "Install libtorrent-$libvers and rtorrent-$rtvers"
echo "Your rtorrent config, torrents, and data will not be lost or changed"
echo -n "Continue? "
if ! ask_user; then
exit
fi
else
if [ "$passed_rtvers" = "latest" ] || [ $(wget -q -O - $sourcedir | grep -o "rtorrent-$passed_rtvers.tar.gz" | wc -l) -eq 0 ]; then
if [ "$passed_rtvers" != "latest" ]; then
echo " Could not find $passed_rtvers so using latest version instead"
fi
libvers=$latest_libvers
rtvers=$latest_rtvers
else
libvers=$(echo $passed_rtvers | awk -F. -v OFS=. '{$2='$(( $(echo $rtversion | cut -d. -f2) + 4 ))'; print }')
rtvers=$passed_rtvers
fi
# checks if the OS is debian 9, and forces the version to 0.9.7 of it is
if [ $rtdevrel = 0 ]; then
libvers='0.13.7'
rtvers='0.9.7'
echo "Debian 9, and Ubuntu 17.10 and later, are only supported by libtorrent-0.13.6/rtorrent-0.9.7"
fi
fi
if [ -z "$home" ]; then
home=$HOME
fi
echo echo
echo "Installing $libvers/$rtvers" echo "Installing libtorrent-$libvers/rtorrent-$rtvers"
cd $HOME cd $home
if [ -d source ]; then if [ -d source ]; then
cd source cd source
else else
mkdir source && cd source mkdir source && cd source
fi fi
rm -r -f libtorrent* rtorrent* rm -rf xmlrpc libtorrent* rtorrent*
echo "Fetching source files" echo "Fetching source files"
curl -# http://rtorrent.net/downloads/libtorrent-$libvers.tar.gz | tar xz
curl -# http://rtorrent.net/downloads/rtorrent-$rtvers.tar.gz | tar xz
echo "Compiling libtorrent"
cd $HOME/source/libtorrent-$libvers if [ $rtdevrel = 0 ]; then
./autogen.sh >> /dev/null 2>&1 git clone -q -b feature-bind --single-branch https://github.com/rakshasa/libtorrent.git libtorrent-$libvers
if [ "$OSNAME" = "Raspbian" ]; then git clone -q -b feature-bind --single-branch https://github.com/rakshasa/rtorrent.git rtorrent-$rtvers
./configure --prefix=/usr --disable-instrumentation >> /dev/null 2>&1 else
else curl -# http://rtorrent.net/downloads/libtorrent-$libvers.tar.gz | tar xz
./configure --prefix=/usr >> /dev/null 2>&1 curl -# http://rtorrent.net/downloads/rtorrent-$rtvers.tar.gz | tar xz
fi fi
make -j2 >> /dev/null 2>&1
make install >> /dev/null 2>&1
echo "Compiling rtorrent" if [ $xmlrpc_repo = 0 ]; then
cd $HOME/source/rtorrent-$rtvers svn co $xmlrpcloc xmlrpc >> $logfile 2>&1
./autogen.sh >> /dev/null 2>&1
./configure --prefix=/usr --with-xmlrpc-c >> /dev/null 2>&1
make -j2 >> /dev/null 2>&1
make install >> /dev/null 2>&1
ldconfig
cd /var/www/rutorrent/conf/users cd xmlrpc
user_list=* echo "Installing xmlrpc" | tee -a $logfile
./configure --prefix=/usr --disable-cplusplus >> $logfile 2>&1
make -j$(nproc) >> $logfile 2>&1
make -s install >> $logfile 2>&1
cd ..
fi
for user in $user_list cd libtorrent-$libvers
do echo "Installing libtorrent" | tee -a $logfile
./autogen.sh >> $logfile 2>&1
if [ $osname = "Raspbian" ]; then
./configure --prefix=/usr --disable-instrumentation >> $logfile 2>&1
else
./configure --prefix=/usr >> $logfile 2>&1
fi
make -j$(nproc) >> $logfile 2>&1
make -s install >> $logfile 2>&1
cd ../rtorrent-$rtvers
echo "Installing rtorrent" | tee -a $logfile
./autogen.sh >> $logfile 2>&1
./configure --prefix=/usr --with-xmlrpc-c >> $logfile 2>&1
make -j$(nproc) >> $logfile 2>&1
make -s install >> $logfile 2>&1
ldconfig >> $logfile 2>&1
echo "$libvers/$rtvers installed"
echo
if [ -d /var/www/rutorrent/conf/users ]; then
cd /var/www/rutorrent/conf/users
user_list=*
for user in $user_list; do
if [ ! "$user" = '*' ]; then if [ ! "$user" = '*' ]; then
echo "Restarting rtorrent for $user" echo "Restarting rtorrent for $user"
su $user -c 'rt restart >> /dev/null 2>&1' su $user -c 'rt restart >> /dev/null 2>&1'
fi fi
done done
echo
cd $HOME fi
echo
echo "$libvers/$rtvers installed"
echo
echo "Your .rtorrent.rc file, and download, watch, and .session directories have not been altered in any way"
+57
View File
@@ -0,0 +1,57 @@
#!/bin/bash
######################################################################
#
# Copyright (c) 2015 arakasi72 (https://github.com/arakasi72)
#
# --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
#
######################################################################
sourcedir='http://rtorrent.net/downloads/'
rt_latest=$(wget -q -O - $sourcedir | grep -o "rtorrent-[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}" | sort -uV | tail -1 | grep -o "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
ru_latest=$(curl -s https://raw.githubusercontent.com/Novik/ruTorrent/master/js/webui.js | grep -m 1 version: | cut -d \" -f2)
# checks if an application is installed
installed() {
hash $1 2>/dev/null
}
if ( installed rtorrent ); then
rt_current=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
echo "rtorrent installed: $rt_current"
echo "rtorrent available: $rt_latest"
else
echo "rtorrent: not installed"
fi
echo
if [ -d /var/www/rutorrent ]; then
ru_current=$(grep -m 1 version: /var/www/rutorrent/js/webui.js | cut -d \" -f2)
echo "RuTorrent installed: $ru_current"
echo "RuTorrent available: $ru_latest"
else
echo "RuTorrent: not installed"
fi
echo
echo "rtinst"
cd /etc/rtinst
branch=$(basename "$(git symbolic-ref -q HEAD)")
if [ -z $branch ]; then
branch=$(git describe --tags --exact-match)
echo "Current Release: rtinst $branch"
if [ ${branch:0:1} = v ]; then
latest=$(basename "$(git ls-remote --tags https://github.com/arakasi72/rtinst.git | grep -o 'refs/tags/v.*' | sort -V | tail -1)")
if [ $branch = $latest ]; then
echo "This is the latest release"
else
echo "Use rtsetup to update to rtinst $latest"
fi
fi
else
echo "Current Branch: $branch"
echo "Use rtsetup to update branch"
fi
+2 -2
View File
@@ -20,8 +20,8 @@ if [ $(dpkg-query -W -f='${Status}' webmin 2>/dev/null | grep -c "ok installed")
echo "Installing Webmin" echo "Installing Webmin"
echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list
wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add - wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add -
apt-get update >> /dev/null 2>&1 apt-get -qq update
apt-get -y install webmin >> /dev/null 2>&1 apt-get -qq install webmin
else else
echo 'Webmin is already installed' echo 'Webmin is already installed'
fi fi
+75 -24
View File
@@ -14,19 +14,45 @@ newvers=$(curl -s https://raw.githubusercontent.com/Novik/ruTorrent/master/js/we
oldvers=$(grep -m 1 version: /var/www/rutorrent/js/webui.js | cut -d \" -f2) oldvers=$(grep -m 1 version: /var/www/rutorrent/js/webui.js | cut -d \" -f2)
ruflag=0 ruflag=0
rurelease=$(git ls-remote -t https://github.com/Novik/ruTorrent v\* | cut -d/ -f3 | sort -V | tail -1)
force_yes=1
restore_old=1
install_master=1
ask_option() { ask_restore() {
while true if [ $force_yes = 0 ]; then
do return $restore_old
echo "1. Restore rutorrent_old" else
echo "2. Upgrade to latest version" while true
read -p "Select 1 or 2: " answer do
case $answer in [1]* ) return 0 ;; echo "1. Restore rutorrent_old"
[2]* ) return 1 ;; echo "2. Upgrade to latest version"
read -p "Select 1 or 2: " answer
case $answer in [1]* ) return 0 ;;
[2]* ) return 1 ;;
esac esac
done done
fi
} }
ask_version() {
if [ $force_yes = 0 ]; then
return $install_master
else
echo "Choose which build to install, (if you are not sure select 1)"
while true
do
echo "1. Use the latest stable release"
echo "2. Use the most recent master build"
read -p "Select 1 or 2: " answer
case $answer in [1]* ) return 1 ;;
[2]* ) return 0 ;;
esac
done
fi
}
check_user() { check_user() {
while true while true
do do
@@ -43,6 +69,21 @@ if [ "$(id -u)" != "0" ]; then
echo "Must be run from root or using sudo" && exit 1 echo "Must be run from root or using sudo" && exit 1
fi fi
# get options
OPTS=$(getopt -n "$0" -o myo --long "rutorrent-master,force-yes,restore-old" -- "$@")
eval set -- "$OPTS"
while true; do
case "$1" in
-m | --rutorrent-master ) install_master=0; shift;;
-y | --force-yes ) force_yes=0; shift;;
-o | --restore-old ) restore_old=0; shift;;
-- ) shift; break ;;
* ) break ;;
esac
done
#check rutorrent folder exists #check rutorrent folder exists
if ! [ -d '/var/www/rutorrent' ]; then if ! [ -d '/var/www/rutorrent' ]; then
echo 'Could not find /var/www/rutorrent, exiting script' echo 'Could not find /var/www/rutorrent, exiting script'
@@ -50,31 +91,33 @@ exit
fi fi
#check versions #check versions
if [ '$newvers' = '$oldvers' ]; then echo "Installed version: "$oldvers
echo "You have the latest version: "$newvers echo " Latest version: "$newvers
else
echo "Installed version: "$oldvers if [ -d $HOME'/rutorrent_old' ]; then
echo " Latest version: "$newvers echo
echo "A previous backup is available to restore"
echo
fi fi
if ! ( check_user ); then if [ $restore_old = 0 ] && ! [ -d $HOME'/rutorrent_old' ]; then
echo "No backup available to do a restore"
exit exit
fi fi
#check to see if rutorrent_old exists, offer restore or upgrade options #check to see if rutorrent_old exists, offer restore or upgrade options
if [ -d $HOME'/rutorrent_old' ];then if [ -d $HOME'/rutorrent_old' ];then
echo 'Detected '$HOME'/rutorrent_old' echo 'Detected '$HOME'/rutorrent_old'
if ( ask_option ); then if ( ask_restore ); then
echo "Restoring Old version of rutorrent" echo "Restoring Old version of rutorrent"
echo "WARNING: The current rutorrent will be overwitten by older backup" echo "WARNING: The current rutorrent will be overwitten by older backup"
ruflag=1 ruflag=1
if ( check_user ); then if [ $force_yes = 0 ] || ( check_user ); then
echo "Restoring" echo "Restoring"
rm -r /var/www/rutorrent rm -r /var/www/rutorrent
mv -f $HOME/rutorrent_old /var/www/rutorrent mv -f $HOME/rutorrent_old /var/www/rutorrent
echo "Setting permissions, Starting services" echo "Setting permissions, Starting services"
chown -R www-data:www-data /var/www chown -R www-data:www-data /var/www
chmod -R 755 /var/www/rutorrent
echo "Done" echo "Done"
else else
exit exit
@@ -82,8 +125,8 @@ echo 'Detected '$HOME'/rutorrent_old'
else else
echo "Rutorrent will be upgraded" echo "Rutorrent will be upgraded"
echo "WARNING: rutorrent_old will be deleted" echo "WARNING: rutorrent_old will be deleted"
echo "If you wish to retain this older version you should exit this script, and rename or move it" echo "If you wish to retain this older version you should exit this script, and rename or move it"
if ( check_user ); then if [ $force_yes = 0 ] || ( check_user ); then
ruflag=0 ruflag=0
else else
exit exit
@@ -93,9 +136,13 @@ fi
if [ $ruflag = 0 ]; then if [ $ruflag = 0 ]; then
if ( ask_version ); then
rurelease=master
fi
if [ -d $HOME'/rutorrent_old' ]; then if [ -d $HOME'/rutorrent_old' ]; then
rm -r $HOME/rutorrent_old rm -r $HOME/rutorrent_old
echo "rutorrent_old has been deleted" echo "rutorrent_old has been deleted"
fi fi
echo echo
@@ -106,10 +153,13 @@ if [ $ruflag = 0 ]; then
echo echo
mv -f /var/www/rutorrent $HOME/rutorrent_old mv -f /var/www/rutorrent $HOME/rutorrent_old
echo "Installing Rutorrent ($rurelease)"
wget -q https://github.com/Novik/ruTorrent/archive/$rurelease.tar.gz
tar -xzf $rurelease.tar.gz
mv -f $(tar -tzf $rurelease.tar.gz | head -1) /var/www/rutorrent
rm $rurelease.tar.gz
echo "Installing Rutorrent "$newvers git clone -q https://github.com/autodl-community/autodl-rutorrent.git /var/www/rutorrent/plugins/autodl-irssi
git clone https://github.com/Novik/ruTorrent.git /var/www/rutorrent >> /dev/null 2>&1
git clone https://github.com/autodl-community/autodl-rutorrent.git /var/www/rutorrent/plugins/autodl-irssi >> /dev/null 2>&1
rm -r /var/www/rutorrent/conf >> /dev/null 2>&1 rm -r /var/www/rutorrent/conf >> /dev/null 2>&1
cp -r $HOME/rutorrent_old/conf /var/www/rutorrent/conf >> /dev/null 2>&1 cp -r $HOME/rutorrent_old/conf /var/www/rutorrent/conf >> /dev/null 2>&1
@@ -117,5 +167,6 @@ if [ $ruflag = 0 ]; then
cp -r $HOME/rutorrent_old/share /var/www/rutorrent/share >> /dev/null 2>&1 cp -r $HOME/rutorrent_old/share /var/www/rutorrent/share >> /dev/null 2>&1
echo "Setting permissions, Starting services" echo "Setting permissions, Starting services"
chown -R www-data:www-data /var/www chown -R www-data:www-data /var/www
chmod -R 755 /var/www/rutorrent echo
echo "Installation of RuTorrent complete"
fi fi