Compare commits

..
90 Commits
Author SHA1 Message Date
V33m 1f1ec0ad3a Update rtinst - add '-y' to aptitude upgrade 2020-08-30 09:39:44 +02:00
V33m b18b5718fe Update rtsetup
Use latest release instead of tag
2020-08-27 22:23:32 +02:00
V33m deff019f56 Use Aptitude to install packages 2020-08-27 21:42:52 +02:00
V33m 11a019cd16 Update README.md 2020-08-25 19:20:53 +02:00
V33m 0a8b21b8f3 Verify if PPA is available for current distribution
Added checking to verify if current distribution (release name, ex. focal) has available PPA packages. If not, packages will be installed from Ubuntu Package archive.

Solves Issue https://github.com/arakasi72/rtinst/issues/518 and https://github.com/arakasi72/rtinst/issues/522.
2020-08-25 19:12:33 +02:00
V33m c3cde97a74 Add fallback for fetching external ip (ipinfo.io)
If ipecho is down or the ISP is blocking it, there are no other ways to get external ip. Adding another fallback to ipinfo.io makes the issue that rtinst can't figure out the external ip less likely.

Issue: https://github.com/arakasi72/rtinst/issues/448
2020-08-15 00:11:41 +02:00
V33m 18dd935f18 Add correct php version for Debian 11
Debian 11, codename bullseye, is currently using the same versions as Ubuntu 20.
2020-08-14 16:24:51 +02:00
V33m 6935c58e6a Add php-zip module for multi-torrent downloading
Solves the issue "PHP module 'zip' is not installed." when selecting two or more items with "Get .torrent". Issue: https://github.com/arakasi72/rtinst/issues/516
2020-08-13 10:55:22 +02:00
V33m f9063b89d4 Update fetching latest ruTorrent release
Updates the method for how latest ruTorrent releases are found. Prior method sorted by name, which made suffixes such as -beta prioritised over stable (v3.10-beta over v3.10 etc.).
2020-07-05 10:34:31 +02:00
arakasi72 d2869bf416 Merge pull request #505 from V33m/patch-4
Update rutupgrade - Fetch latest release
2020-07-04 18:09:40 +01:00
arakasi72 e6523c1956 Merge pull request #496 from V33m/patch-3
Fallback if lsb_release -si does not return Ubuntu, Debian or Raspbian
2020-07-04 18:08:58 +01:00
arakasi72 3df3171d5c Merge pull request #494 from V33m/patch-2
Add support for Ubuntu 20.04
2020-07-04 18:07:24 +01:00
V33m 227eb998f2 Update rutupgrade - Fetch latest release
Updates the method for how latest releases are found. Prior method sorted by name, which made suffixes such as -beta prioritised over stable (v3.10-beta over v3.10 etc.).
2020-07-02 19:01:41 +02:00
V33m 3613eae1d9 Fallback if lsb_release -si does not return Ubuntu, Debian or Raspbian
Adds a fallback if lsb_release -si returns anything else than Ubuntu, Debian or Raspbian.

Should solve https://github.com/arakasi72/rtinst/issues/495. Needs testing and confirmation.
2020-04-26 11:25:46 +02:00
V33m 6c5191a144 Add support for Ubuntu 20.04
I've removed the package "python-scgi" which is for python2, however, we need to figure out if any packages are dependent on it for older OSes and if we need a supplement to it for python3 and future releases. PS: I've not tested this by myself. 

https://github.com/arakasi72/rtinst/issues/493
2020-04-25 10:14:41 +02:00
arakasi72 eef6d04d9d Merge pull request #486 from KaffeMyers/master
fix autodl-irrsi url extract
2020-03-31 09:42:34 +01:00
Simon "Kaffe" Wagemyr bde4bb2492 small fix for safety (account for possible whitespace, which probably was the original issue) 2020-03-31 04:01:42 +02:00
Simon "Kaffe" Wagemyr e7679d897b fix autodl-irrsi url extract 2020-03-31 03:46:13 +02:00
arakasi72 ba2a315b37 Update rtinst 2019-12-18 16:41:57 +00:00
arakasi72 a0be8c3278 Update rtinst 2019-12-18 16:31:45 +00:00
arakasi72 16d2f1d310 Update rtinst 2019-11-21 03:42:23 +00:00
arakasi72 11ff99f684 Update rtupdate 2019-11-20 20:05:49 +00:00
arakasi72 6def26dc46 Update rtinst 2019-11-20 20:05:20 +00:00
arakasi72 ff43cb7ccf Update rtupdate 2019-11-20 19:49:05 +00:00
arakasi72 1d8116d622 Update rtinst 2019-11-20 19:45:33 +00:00
arakasi72 c38c565211 Update rtinst 2019-11-18 23:06:48 +00:00
arakasi72 15dd6d5b19 Update rtinst 2019-11-18 23:05:22 +00:00
arakasi72 e4bfaf4322 Update rtinst 2019-10-24 08:24:02 +01:00
arakasi72 30ac8a1efb Update rtinst 2019-10-22 09:48:03 +01:00
arakasi72 658e2d3937 Update rtinst 2019-10-18 23:50:56 +01:00
arakasi72 f885123bab Update rtsetup 2019-10-18 23:48:06 +01:00
arakasi72 24b3ca1d44 Update rtinst 2019-10-16 10:16:34 +01:00
arakasi72 c094ea145e Merge pull request #447 from V33m/patch-3
Minor update to rtinst for arm64
2019-10-15 22:51:24 +01:00
V33m 0da4c80b62 Minor update to rtinst for arm64
Add “-y” so the user doesn't need to agree to continue to install the package which is needed for arm64 devices
2019-10-15 23:21:33 +02:00
arakasi72 2068d3a45c Update rtupdate 2019-10-06 20:25:38 +01:00
arakasi72 f8eea44834 Merge pull request #443 from V33m/patch-2
[rtupdate] Adds fallback for lsb_release
2019-10-06 20:22:40 +01:00
V33m 2cb8ba306d Use defined relno variable
Fixes
/usr/local/bin/rtupdate: line 37: [: =: unary operator expected
2019-10-06 15:13:44 +02:00
V33m c96e68e2b5 [rtupdate] Adds fallback for lsb_release
As (lsb_release -si) or (lsb_release -sr | cut -d. -f1) might not return any name or value, one should add a fallback to prevent the script from not finding the proper OS name or version ID.
2019-10-06 14:40:14 +02:00
arakasi72 e32810d684 Update README.md 2019-09-18 23:20:28 +01:00
arakasi72 72291ecd6f Update README.md 2019-09-18 23:20:07 +01:00
arakasi72 b802e761ae Update README.md 2019-09-18 23:19:19 +01:00
arakasi72 64e998b2de Update rtletsencrypt 2019-09-18 14:22:04 +01:00
arakasi72 bfee5f27fe Merge pull request #432 from V33m/patch-1
Fixes issues #246 and #431
2019-09-12 21:44:33 +01:00
V33m 2f7ad34e5b [arm64] Fixes "WARNING: Unable to start rtorrent"
If the package libxmlrpc-core-c3-dev is not installed on an arm64 system, rTorrent won't be able to run and you'll get the following error - WARNING: Unable to start rtorrent

Fixes the issue: https://github.com/arakasi72/rtinst/issues/246
2019-09-11 11:45:37 +02:00
V33m 0652fe19eb Adds fallback to lsb_release if output is empty
As (lsb_release -si) or (lsb_release -sr | cut -d. -f1) might not return any name or value, one should add a fallback to prevent the script from not finding the proper OS name or version ID. 

Fixes the issue: https://github.com/arakasi72/rtinst/issues/431
2019-09-11 11:36:02 +02:00
arakasi72 90072e5226 Update rtinst 2019-09-09 00:50:10 +01:00
arakasi72 ab34ec9fd4 Update nginxsite 2019-09-02 22:26:14 +01:00
arakasi72 4ca8cbc9a4 Update rtinst 2019-08-12 22:38:59 +01:00
arakasi72 2dd915d800 Update README.md 2019-08-10 00:30:31 +01:00
arakasi72 2ecf699e9d Update rtwebmin 2019-08-08 08:43:44 +01:00
arakasi72 3b2b6789a2 Develop (#424)
* Update rtinst

* Update rtinst

* Update rtinst

* Update rtorrent.rc

* Update rtadduser

* Update rtadduser

* Update rtadduser

* Update rtadduser

* Update rtadduser

* Update rtadduser

* Update rtadduser

* Update rtletsencrypt
2019-08-07 19:00:54 +01:00
arakasi72 bb7e6bf87b Update nginxsite 2019-08-04 15:14:45 +01:00
arakasi72 2d2d1dff59 Update rtinst 2019-08-04 13:43:22 +01:00
arakasi72 1f2a1b1f29 Update rtsslcert 2019-08-04 13:34:52 +01:00
arakasi72 334659eb40 Update nginxsite 2019-08-04 13:26:53 +01:00
arakasi72 6a8bbafe95 Update nginxsite 2019-08-04 13:25:44 +01:00
arakasi72 78d70f57cd Update nginxsite 2019-08-04 13:23:37 +01:00
arakasi72 060a4b7660 Update rtinst 2019-08-02 22:33:55 +01:00
arakasi72 4ead4b71e1 Update rtinst 2019-08-02 14:33:57 +01:00
arakasi72 0c6d410dbe Update rtinst 2019-08-02 10:54:39 +01:00
arakasi72 9ca5721d08 Update README.md 2019-08-02 10:43:03 +01:00
arakasi72 f3ee539bd4 Update rtadmin 2019-08-02 10:41:14 +01:00
arakasi72 9f13ecbfa6 Develop (#422)
* Update rtinst

* Update README.md

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update README.md

* Update rtinst

* Update rtupdate

* Update rtupdate

* Create rtletsencrypt

* Changing file permissions

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtinst

* Update rtletsencrypt

* Update rtinst

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtinst

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtinst

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtletsencrypt

* Update rtinst
2019-08-02 10:38:26 +01:00
arakasi72 7d200e9f58 Develop (#420)
* Update rtinst

* Update README.md

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update rtinst

* Update README.md

* Update rtinst

* Update rtupdate

* Update rtupdate
2019-07-28 08:50:33 +01:00
arakasi72 986b24086d Update rtinst 2019-07-28 08:07:20 +01:00
arakasi72 884d3e73bd Update rtupdate 2019-07-24 20:43:54 +01:00
arakasi72 9c14c2a82d Update rtupdate 2019-07-24 20:34:02 +01:00
arakasi72 25fa01635a Develop (#418)
* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtupdate

* Update rtinst

* Update rtupdate

* Update rtupdate
2019-07-23 20:05:53 +01:00
arakasi72 4588907f07 Update README.md 2019-07-10 09:12:53 +01:00
arakasi72 318573ed63 Update rtinst 2019-07-10 08:48:10 +01:00
arakasi72 5035ab0a95 Develop (#416)
* Update rtinst

* Update rtinst

* Update rtupdate
2019-07-10 08:47:40 +01:00
arakasi72 1b9794ee7d Update rtupdate 2019-07-10 08:05:54 +01:00
arakasi72 eaffb50529 Update rtinst 2019-06-03 14:30:34 +01:00
arakasi72 00aed27199 Update rtupdate 2019-06-03 14:26:54 +01:00
arakasi72 fe023bed1a Update rtupdate 2019-06-02 21:32:57 +01:00
arakasi72 37354f386a Develop (#406)
* Update rtinst

* Update rtinst

* Update rtsslcert

* Update rtsslcert

* Update rtsslcert

* Update rtsslcert

* Update rtsslcert

* Update rtinst

* Update rtupdate
2019-05-11 15:19:15 +01:00
Yo 54f12f7877 4.) rtdload $rtdaction - $rtdaction httpS downloads" (#405) 2019-05-10 21:06:50 +01:00
arakasi72 c366ab575c Update rtinst 2019-04-09 23:41:13 +01:00
arakasi72 d732810e83 Update rtinst 2019-04-09 23:40:32 +01:00
000xxx 79dd712da1 More better way to find external IP (#385)
* More better way to find external IP

Please change it because external IP is more usable than private IP

* External IP detection
2019-04-09 23:22:23 +01:00
arakasi72 6ba83f6097 Update ru.config 2019-04-09 23:16:47 +01:00
arakasi72 d3cb5e57e9 Update ru.ini 2019-04-09 23:14:20 +01:00
arakasi72 7bb8b0dd88 Update rtorrent.rc 2018-10-09 20:24:14 +01:00
arakasi72 29a3ad947b Update rtinst 2018-08-15 20:54:06 +01:00
arakasi72 98cac8525e Update rtupdate 2018-08-15 20:53:34 +01:00
arakasi72 c7d5d4a7ef Update rtupdate 2018-06-28 12:48:15 +01:00
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
14 changed files with 533 additions and 199 deletions
+14 -8
View File
@@ -1,5 +1,7 @@
## rtinst
### Note: Now installs Lets Encrypt SSL certificates
#### 30 Second Guide
Ubuntu and Debian Seedbox Installation
@@ -21,18 +23,15 @@ It takes about 10 minutes to run, depending on your server setup. After you have
**IMPORTANT: NOTE THE NEW SSH PORT AND MAKE SURE YOU CAN SSH INTO YOUR SERVER BEFORE CLOSING THE EXISTING SESSION**
It has been tested with clean installs of:
Current release has been tested with clean installs of:
Ubuntu 12 (unsupported)
Ubuntu 13 (unsupported)
Ubuntu 14
Ubuntu 15
Ubuntu 16
Ubuntu 17
Ubuntu 18
Debian 7 "Wheezy" (unsupported)
Debian 8 "Jessie"
Ubuntu 19
Ubuntu 20
Debian 9 "Stretch"
Debian 10 "Buster"
Services that will be installed and configured are
@@ -48,7 +47,14 @@ Services that will be installed and configured are
[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 [Older OS Installation Guide](https://github.com/arakasi72/rtinst/wiki/Installing-on-Older-OS). These include:
Ubuntu 12 (old release)
Ubuntu 13 (old release)
Ubuntu 14 (old release)
Ubuntu 15 (old release)
Debian 7 "Wheezy" (old release)
Debian 8 "Jessie" (old release)
To see latest updates to the script go to [Change Log](https://github.com/arakasi72/rtinst/wiki/Change-Log)
+6 -2
View File
@@ -1,5 +1,6 @@
server {
listen 80;
listen [::]:80;
#server_name <Domain Name>;
root /var/www;
@@ -35,8 +36,11 @@ server {
}
server {
listen 443 ssl;
#server_name <Domain Name>;
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
#server_name <Domain Name>;
root /var/www;
index index.html index.php index.htm;
+3 -1
View File
@@ -8,13 +8,15 @@ method.insert = cfg.basedir, private|const|string, (cat,"<user home>/rtorren
method.insert = cfg.watch, private|const|string, (cat,(cfg.basedir),"watch/")
#method.insert = cfg.logs, private|const|string, (cat,(cfg.basedir),"log/")
#method.insert = cfg.logfile, private|const|string, (cat,(c fg.logs),"rtorrent-",(system.time),".log")
#method.insert = cfg.logfile, private|const|string, (cat,(cfg.logs),"rtorrent-",(system.time),".log")
session.path.set = (cat,(cfg.basedir),".session")
directory.default.set = (cat,(cfg.basedir),"download")
schedule = watch_directory,5,5,((load.start,(cat,(cfg.watch),"*.torrent")))
#system.umask.set = 0000
### BitTorrent
# Global upload and download rate in KiB, `0` for unlimited
throttle.global_down.max_rate.set = 0
+1
View File
@@ -43,6 +43,7 @@ $pathToExternals = array(
"gzip" => '/bin/gzip', // Something like /usr/bin/gzip. If empty, will be found in PATH.
"id" => '/usr/bin/id', // Something like /usr/bin/id. If empty, will be found in PATH.
"stat" => '/usr/bin/stat', // Something like /usr/bin/stat. If empty, will be found in PATH.
"pgrep" => '/usr/bin/pgrep', // Something like /usr/bin/pgrep. If empty, will be found in PATH.
);
$localhosts = array( // list of local interfaces
+4
View File
@@ -100,6 +100,8 @@ enabled = yes
enabled = yes
;; Disabled
[_cloudflare]
enabled = no
[check_port]
enabled = no
[chunks]
@@ -120,5 +122,7 @@ enabled = no
enabled = no
[scheduler]
enabled = no
[spectrogram]
enabled = no
[xmpp]
enabled = no
+10 -1
View File
@@ -31,6 +31,15 @@ if [ "$(id -u)" != "0" ]; then
exit 1
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
sleep 5
fi
apt-get -qq update
if [ $(dpkg-query -W -f='${Status}' git 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Installing git"
apt-get -yqq install git 2>&1 >> /dev/null
@@ -48,7 +57,7 @@ if [ -d /etc/rtinst ] && [ -z $branch ]; then
if [ -z $branch ]; then
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)")
latest=$(curl -s "https://api.github.com/repos/arakasi72/rtinst/releases/latest" | awk -F '"' '/tag_name/{print $4}')
if [ $branch != $latest ]; then
echo "Updating from $branch to $latest"
branch=$latest
+57 -30
View File
@@ -22,8 +22,9 @@ sshport=$(grep 'Port ' /etc/ssh/sshd_config | sed 's/[^0-9]*//g')
ftpport=$(grep 'listen_port=' /etc/vsftpd.conf | sed 's/[^0-9]*//g')
cronline1="@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent"
cronline2="*/10 * * * * /usr/local/bin/rtcheck irssi rtorrent"
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 $7}')
check_ssh=1
rtdstatus=$(rtdload)
#get user list
cd /var/www/rutorrent/conf/users
@@ -33,6 +34,28 @@ user_list=*
### FUNCTIONS ###
###############################
#function to determin if unix user name is valid
valid_name(){
until [[ $user =~ ^[a-z][-a-z0-9_]{2,31}$ ]]
do
echo "Enter user name (lowercase, numbers, dash and underscore):"
read user
done
}
# 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
}
genpasswd() {
local genln=$1
[ -z "$genln" ] && genln=8
@@ -183,34 +206,39 @@ fi
###############################
if [ -z "$user" ]; then
echo "Enter the name of the user to add"
echo "Enter the name of the user"
echo "It can be an existing user or a new user"
echo
confirm_name=1
while [ $confirm_name = 1 ]
do
read -p "Enter user name: " answer
addname=$answer
check_name=1
if [ "$addname" = "root" ]; then
echo "Cannot create root"
exit
valid_name
echo -n "Confirm that user name is $user y/n? "
if ask_user; then
confirm_name=0
else
user=''
fi
while [ $check_name = 1 ]
do
read -p "Is $addname correct? " answer
case $answer in [Yy]* ) confirm_name=0 && check_name=0 ;;
[Nn]* ) confirm_name=1 && check_name=0 ;;
* ) echo "Enter y or n";;
esac
done
done
user=$addname
else
if ! [[ $user =~ ^[a-z][-a-z0-9_]{2,31}$ ]]; then
echo "$user is not a valid user name please enter again"
confirm_name=1
while [ $confirm_name = 1 ]
do
valid_name
echo -n "Confirm that user name is $user y/n? "
if ask_user; then
confirm_name=0
else
user=''
fi
done
fi
fi
echo "User name is $user"
if id -u $user >/dev/null 2>&1; then
echo "$user already exists"
else
@@ -220,6 +248,13 @@ else
adduser --gecos "" $user --disabled-password
echo "$user:$unixpass" | sudo chpasswd
fi
if id -u $user >/dev/null 2>&1; then
echo "$user successfully created"
else
echo "create user failed - exiting process"
exit 1
fi
fi
home=$(eval echo "~$user")
@@ -318,7 +353,7 @@ echo "?>" >> /var/www/rutorrent/conf/users/$user/config.php
mkdir /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi
mkdir -p $home/.irssi/scripts/autorun
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 | sed -n 's/.*browser_download_url": \?"\(.*zip\)".*/\1/p' | xargs wget --quiet -O autodl-irssi.zip
unzip -o autodl-irssi.zip >> /dev/null 2>&1
rm autodl-irssi.zip
cp autodl-irssi.pl autorun/
@@ -363,14 +398,6 @@ fi
su $user -c '/usr/local/bin/rt restart'
su $user -c '/usr/local/bin/rt -i restart'
dload_line=$(grep "include /etc/nginx/conf.d/rtdload;" /etc/nginx/sites-available/default)
dload_hash=$(echo $dload_line | sed 's/[^#]*//g')
if [ ! -z "$dload_line" -a -z "$dload_hash" ]; then
dload_flag=0
else
dload_flag=1
fi
echo "$user setup complete"
echo "SCGI Port: $newscgi"
echo "RPC Mount: $newrpc"
@@ -391,7 +418,7 @@ echo
fi
echo "ftp client should be set to explicit ftp over tls using port $ftpport" | tee -a $home/rtinst.info
echo
if [ $dload_flag = 0 ]; then
if [ "$rtdstatus" = "enabled" ]; then
echo "https downloads can be accessed at https://$serverip/download/$user" | tee -a $home/rtinst.info
echo
fi
+6 -4
View File
@@ -23,9 +23,10 @@ while true
[5] ) rtupdate && return 0 ;;
[6] ) rutupgrade && return 0 ;;
[7] ) rtwebmin && return 0 ;;
[8] ) rtsslcert && return 0 ;;
[8] ) rtletsencrypt && return 0 ;;
[9] ) rtsslcert && return 0 ;;
[Qq] ) exit ;;
* ) echo "Enter 1-8 (q to quit)";;
* ) echo "Enter 1-9 (q to quit)";;
esac
done
}
@@ -49,11 +50,12 @@ echo "Select from the following options:"
echo "1.) rtsetup - update the rtinst scripts"
echo "2.) rtadduser - add new user"
echo "3.) rtremove - delete a user"
echo "4.) rtdload $rtdaction - $rtdaction http downloads"
echo "4.) rtdload $rtdaction - $rtdaction https downloads"
echo "5.) rtupdate - up/down-grade rtorent/libtorrent"
echo "6.) rutupgrade - upgrade to latest version of RuTorrent"
echo "7.) rtwebmin - install webmin"
echo "8.) rtsslcert - generate new self signed ssl certificate"
echo "8.) rtletsencrypt - install Lets Encypt ssl certificate"
echo "9.) rtsslcert - generate new self signed ssl certificate"
echo "Enter option or q to quit"
select_task
+247 -122
View File
@@ -8,77 +8,6 @@
#
#########################################################################################
###############################
### SET VARIABLES ###
###############################
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
# if left blank will install latest version of rtorrent, or set to a specific release E.G. '0.9.6' to install that release
rtorrentrel=''
#url's of the major components
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
echo "Installing lsb-release"
apt-get -yqq install lsb-release 2>&1 >> /dev/null
fi
fullrel=$(lsb_release -sd)
osname=$(lsb_release -si)
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
phpver=php7.0
phploc=/etc/php/7.0
geoipver=php-geoip
fi
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=''
cronline1="@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent"
cronline2="*/10 * * * * /usr/local/bin/rtcheck irssi rtorrent"
dlflag=1
portdefault=1
skip_rt=1
sshport=''
rudevflag=1
rurelease=master
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 $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-mcrypt $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=""
unixpass=""
passflag=0
forceyes=1
selfsign=1
rut_add_users=1
###############################
### FUNCTIONS ###
@@ -86,7 +15,7 @@ rut_add_users=1
#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
if [[ `wget -S -T 3 --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then return 0; else return 1; fi
}
# checks if an application is installed
@@ -111,6 +40,18 @@ else
fi
}
#function to determin if unix user name is valid
valid_name(){
until [[ $user =~ ^[a-z][-a-z0-9_]{2,31}$ ]]
do
echo "Enter user name (lowercase, numbers, dash and underscore):"
read user
done
}
#function to generate random password
genpasswd() {
local genln=$1
@@ -120,11 +61,12 @@ tr -dc A-Za-z0-9 < /dev/urandom | head -c ${genln} | xargs
#function executed if the script finishes early
early_exit() {
local rt_ee_version
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"
rt_ee_version=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
echo "rtorrent $rt_ee_version installed"
else
echo "rtorrent was not installed"
fi
@@ -208,22 +150,147 @@ while true
# function to enter IP address
enter_ip() {
local ip_address=$1
exec 3>&1 >/dev/tty
while true
do
if valid_ip $serverip ; then
echo "Your Server IP is $serverip"
if valid_ip $ip_address ; then
echo "Your Server IP is $ip_address"
echo -n "Is this correct y/n? "
ask_user && return 0
ask_user && break
else
echo "Invalid IP address, please try again"
fi
echo "enter your server's IP address"
echo "e.g. 213.0.113.113"
read serverip
read ip_address
done
exec >&3-
echo $ip_address
}
###############################
### SET VARIABLES ###
###############################
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
# if left blank will install latest version of rtorrent, or set to a specific release E.G. '0.9.6' to install that release
rtorrentrel='0.9.6'
#url's of the major components
rt_url="http://rtorrent.net/downloads/"
xmlrpc_url="https://svn.code.sf.net/p/xmlrpc-c/code/advanced/"
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
echo "Installing lsb-release"
apt-get -yqq install lsb-release 2>&1 >> /dev/null
fi
fullrel=$(lsb_release -sd)
osname=$(lsb_release -si)
relno=$(lsb_release -sr | cut -d. -f1)
# Fallback if lsb_release -si returns anything else than Ubuntu, Debian or Raspbian
if [ ! "$osname" = "ubuntu" ] && [ ! "$osname" = "debian" ] && [ ! "$osname" = "raspbian" ]; then
osname=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
osname=${osname^}
fi
# Fallback if lsb_release -sr returns nothing
if [ "$relno" = "" ]; then
relno=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"')
fi
if [ "$relno" = "16" ] || [ "$relno" = "17" ] || [ "$relno" = "9" ]; then
phpver=php7.0
phploc=/etc/php/7.0
libcver=libcurl3
fi
if [ "$(lsb_release -sr)" = "17.10" ]; then
phpver=php7.1
phploc=/etc/php/7.1
libcver=libcurl3
fi
if [ "$relno" = "18" ] || [ "$relno" = "19" ]; then
phpver=php7.2
phploc=/etc/php/7.2
libcver=libcurl4
fi
if [ "$relno" = "10" ] || [ "$(lsb_release -sr)" = "19.10" ]; then
phpver=php7.3
phploc=/etc/php/7.3
libcver=libcurl4
fi
if [ "$relno" = "20" ] || [ "$(lsb_release -sr)" = "20.04" ] || [ "$relno" = "11" ]; then
phpver=php7.4
phploc=/etc/php/7.4
libcver=libcurl4
fi
serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
serveripb=$(wget -qO- --timeout=3 ipecho.net/plain)
serveripc=$(wget -qO- --timeout=3 ipinfo.io/ip)
if [ "$serveripa" = "$serveripb" ] || [ "$serveripa" = "$serveripc" ]; then
serverip=$serveripa
else
echo "Select the IP address to use:"
echo "1.) "$serveripa
echo "2.) "$serveripb
echo "3.) "$serveripc
while true
do
read answer
case $answer in [1] ) serverip=$serveripa && break ;;
[2] ) serverip=$serveripb && break ;;
[3] ) serverip=$serveripc && break ;;
* ) echo "Enter 1, 2 or 3";;
esac
done
fi
echo "IP set to "$serverip
export logfile="/dev/null"
webpass=''
cronline1="@reboot sleep 10; /usr/local/bin/rtcheck irssi rtorrent"
cronline2="*/10 * * * * /usr/local/bin/rtcheck irssi rtorrent"
dlflag=1
portdefault=1
skip_rt=1
sshport=''
rudevflag=1
rurelease=master
passfile='/etc/nginx/.htpasswd'
package_list="sudo nano autoconf build-essential ca-certificates comerr-dev curl dtach htop irssi 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 php-geoip $phpver-xmlrpc $phpver-xml $phpver-zip screen subversion texinfo unzip zlib1g-dev libcurl4-openssl-dev mediainfo software-properties-common $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=""
unixpass=""
passflag=0
forceyes=1
selfsign=1
rut_add_users=1
###############################
### INITIAL SYSTEM CHECKS ###
###############################
@@ -234,11 +301,11 @@ if [ "$(id -u)" != "0" ]; then
fi
# determine system
if ([ "$osname" = "Ubuntu" ] && [ $relno -ge 14 ]) || ([ "$osname" = "Debian" ] && [ $relno -ge 8 ]) || ([ "$osname" = "Raspbian" ] && [ $relno -ge 8 ]); then
if ([ "$osname" = "Ubuntu" ] && [ $relno -ge 16 ]) || ([ "$osname" = "Debian" ] && [ $relno -ge 9 ]) || ([ "$osname" = "Raspbian" ] && [ $relno -ge 9 ]); then
echo $fullrel
else
echo $fullrel
echo "Only Ubuntu release 14 and later, and Debian and Raspbian release 8 and later, are supported"
echo "Only Ubuntu release 16 and later, and Debian and Raspbian release 9 and later, are supported"
echo "Your system does not appear to be supported"
echo "Check https://github.com/arakasi72/rtinst/wiki/Installing-on-Older-OS to see if it is supported by an earlier rtinst release"
exit
@@ -313,12 +380,13 @@ fi
echo
# check IP Address
[ $forceyes = 1 ] && enter_ip
[ $forceyes = 1 ] && serverip=$(enter_ip $serverip)
echo "Your server's IP is set to $serverip"
export serverip
# Determine domain name using server ip address
serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
export serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
if [ -z "$serverdn" ]; then
echo "Unable to determine domain"
else
@@ -356,25 +424,39 @@ if [ -z "$user" ]; then
echo "This will be your primary user"
echo "It can be an existing user or a new user"
echo
confirm_name=1
while [ $confirm_name = 1 ]
do
read -p "Enter user name: " answer
addname=$answer
echo -n "Confirm that user name is $answer y/n? "
valid_name
echo -n "Confirm that user name is $user y/n? "
if ask_user; then
confirm_name=0
else
user=''
fi
done
user=$addname
else
user=$SUDO_USER
fi
else
if ! [[ $user =~ ^[a-z][-a-z0-9_]{2,31}$ ]]; then
echo "$user is not a valid user name please enter again"
confirm_name=1
while [ $confirm_name = 1 ]
do
valid_name
echo -n "Confirm that user name is $user y/n? "
if ask_user; then
confirm_name=0
else
user=''
fi
done
fi
fi
echo "User name is $user"
if id -u $user >/dev/null 2>&1; then
echo "$user already exists"
else
@@ -382,8 +464,16 @@ else
adduser --gecos "" $user
else
adduser --gecos "" $user --disabled-password
echo "$user:$unixpass" | sudo chpasswd
echo "$user:$unixpass" | chpasswd
fi
if id -u $user >/dev/null 2>&1; then
echo "$user successfully created"
else
echo "create user failed - exiting process"
exit 1
fi
fi
home=$(eval echo "~$user")
@@ -449,21 +539,32 @@ echo "No more user input required, you can complete unattended"
echo "It will take approx 10 minutes for the script to complete"
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
sleep 5
fi
#update amd upgrade system
echo "Updating package lists" | tee $logfile
apt-get -qq update | tee -a $logfile
# Installing Aptitude
apt-get -qqy install aptitude
echo "Upgrading packages" | tee -a $logfile
export DEBIAN_FRONTEND=noninteractive
apt-get -qq upgrade >> $logfile 2>&1
aptitude -q=5 -y upgrade >> $logfile 2>&1
if ! [ $? = 0 ]; then
echo "Problem upgrading packages. Run 'apt-get upgrade' successfully and rerun the script" && exit
echo "Problem upgrading packages. Run 'aptitude upgrade' successfully and rerun the script" && exit
fi
apt-get clean && apt-get autoclean >> $logfile 2>&1
aptitude clean && aptitude autoclean >> $logfile 2>&1
#install the packsges needed
#install the packages needed
echo "Installing required packages" | tee -a $logfile
aptitude -q=5 -y install libtool >> $logfile 2>&1
for package_name in $package_list
do
if [ $(apt-cache show -q=0 $package_name 2>&1 | grep -c "No packages found") -eq 0 ]; then
@@ -475,13 +576,18 @@ for package_name in $package_list
fi
done
test -z "$install_list" || apt-get -qq install $install_list >> $logfile 2>&1
# Installs a package needed to prevent arm64 architectures from "WARNING: Unable to start rtorrent"
if [ "$(uname --m)" == "aarch64" ] || [ "$(dpkg --print-architecture)" == "arm64" ] ; then
aptitude -q=5 -y install libxmlrpc-core-c3-dev >> $logfile 2>&1
fi
test -z "$install_list" || aptitude -q=5 -y 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
aptitude -q=5 -y install $phpver-mbstring >> $logfile 2>&1
fi
#install unrar package
@@ -493,13 +599,13 @@ if [ $osname = "Debian" ] && ! installed unrar; then
do
attempts=$(( $attempts + 1 ))
if [ "$(uname -m)" = "x86_64" ]; then
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
wget http://www.rarlab.com/rar/rarlinux-x64-5.7.1.tar.gz >> $logfile 2>&1
tar xvzf rarlinux-x64-5.7.1.tar.gz >> $logfile 2>&1
rm rarlinux-x64-5.7.1.tar.gz
elif [ "$(uname -m)" = "x86_32" ]; then
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
wget http://www.rarlab.com/rar/rarlinux-5.7.1.tar.gz >> $logfile 2>&1
tar xvzf rarlinux-5.7.1.tar.gz >> $logfile 2>&1
rm rarlinux-5.7.1.tar.gz
fi
done
if [ -d rar ]; then
@@ -508,7 +614,7 @@ if [ $osname = "Debian" ] && ! installed unrar; then
rm -r $home/rar
fi
elif [ $osname = "Ubuntu" ]; then
apt-get -qq install unrar >> $logfile 2>&1
aptitude -q=5 -y install unrar >> $logfile 2>&1
fi
if installed unrar; then
@@ -520,19 +626,7 @@ fi
#install ffmpeg
if ! [ $osname = "Raspbian" ] && [ $(dpkg-query -W -f='${Status}' "ffmpeg" 2>/dev/null | grep -c "ok installed") = 0 ]; then
echo "Installing ffmpeg"
if [ $relno = 14 ]; then
apt-add-repository -y ppa:mc3man/trusty-media >> $logfile 2>&1
apt-get -qq update >> $logfile 2>&1
apt-get -qq install ffmpeg >> $logfile 2>&1
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
apt-get -qq update >> $logfile 2>&1
apt-get -qq --force-yes install deb-multimedia-keyring >> $logfile 2>&1
apt-get -qq update >> $logfile 2>&1
apt-get -qq --force-yes install ffmpeg >> $logfile 2>&1
else
apt-get -qq install ffmpeg >> $logfile 2>&1
fi
aptitude -q=5 -y install ffmpeg >> $logfile 2>&1
fi
echo "Completed installation of required packages "
@@ -602,7 +696,14 @@ echo "SSH port set to $sshport"
###############################
# calls the script rtsslcert to generate the ssl certificated for vsftpd and nginx
rtsslcert -d
if rtletsencrypt ; then
leflag=0
echo "Lets Encrypt Certificates installed"
else
rtsslcert -d
leflag=1
echo "Self signed certificats installed"
fi
###############################
### INSTALL FTP ###
@@ -612,7 +713,7 @@ ftpport=$(random 41005 48995)
if [ $(dpkg-query -W -f='${Status}' "vsftpd" 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
echo "Installing vsftpd" | tee -a $logfile
apt-get -y install vsftpd >> $logfile 2>&1
aptitude -q=5 -y install vsftpd >> $logfile 2>&1
fi
sed -i '/^\(\s\|#\)*anonymous_enable/ c\anonymous_enable=NO' /etc/vsftpd.conf
@@ -645,6 +746,11 @@ grep -Pq "^\s*ssl_tlsv1" /etc/vsftpd.conf && sed -i '/^\s*ssl_tlsv1/ c\ssl_tlsv
grep -Pq "^\s*require_ssl_reuse" /etc/vsftpd.conf && sed -i '/^\s*require_ssl_reuse/ c\require_ssl_reuse=NO' /etc/vsftpd.conf || echo "require_ssl_reuse=NO" >> /etc/vsftpd.conf
grep -Pq "^\s*ssl_ciphers" /etc/vsftpd.conf && sed -i '/^\s*ssl_ciphers/ c\ssl_ciphers=HIGH' /etc/vsftpd.conf || echo "ssl_ciphers=HIGH" >> /etc/vsftpd.conf
if [ $leflag = 0 ]; then
sed -i "/^\(\s\|#\)*rsa_cert_file/ c\rsa_cert_file=/etc/letsencrypt/live/$serverdn/fullchain.pem" /etc/vsftpd.conf
sed -i "/^\(\s\|#\)*rsa_private_key_file/ c\rsa_private_key_file=/etc/letsencrypt/live/$serverdn/privkey.pem" /etc/vsftpd.conf
fi
service vsftpd restart 1>> $logfile
ftpport=$(grep 'listen_port=' /etc/vsftpd.conf | sed 's/[^0-9]*//g')
@@ -717,6 +823,14 @@ echo "location ~* \.(jpg|jpeg|gif|css|png|js|woff|ttf|svg|eot)$ {" > /etc/nginx/
echo " expires 30d;" >> /etc/nginx/conf.d/cache
echo "}" >> /etc/nginx/conf.d/cache
if [ $leflag = 0 ]; then
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverdn;" /etc/nginx/sites-available/default
sed -i "/ssl_certificate / c\ ssl_certificate /etc/letsencrypt/live/$serverdn/fullchain.pem;" /etc/nginx/sites-available/default
sed -i "/ssl_certificate_key / c\ ssl_certificate_key /etc/letsencrypt/live/$serverdn/privkey.pem;" /etc/nginx/sites-available/default
else
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverip;" /etc/nginx/sites-available/default
fi
service nginx restart && service $phpver-fpm restart
if [ $dlflag = 0 ]; then
@@ -764,7 +878,7 @@ if [ -d "/var/www/rutorrent" ]; then
fi
if [ $rudevflag = 1 ]; then
rurelease=$(git ls-remote -t https://github.com/Novik/ruTorrent v\* | cut -d/ -f3 | sort -V | tail -1)
rurelease=$(curl -s "https://api.github.com/repos/Novik/ruTorrent/releases/latest" | awk -F '"' '/tag_name/{print $4}')
fi
echo "Installing Rutorrent ($rurelease)" | tee -a $logfile
@@ -807,7 +921,7 @@ adlpass=$(genpasswd $(random 12 16))
mkdir -p $home/.irssi/scripts/autorun
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 | sed -n 's/.*browser_download_url": \?"\(.*zip\)".*/\1/p' | xargs wget --quiet -O autodl-irssi.zip
unzip -qq -o autodl-irssi.zip | tee -a $logfile
rm autodl-irssi.zip
cp autodl-irssi.pl autorun/
@@ -934,7 +1048,13 @@ 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 [ $leflag = 0 ]; then
echo " rutorrent can be accessed at https://$serverdn/rutorrent" | tee -a $home/rtinst.info
else
echo " rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info
fi
if [ $passflag = 1 ]; then
echo " rutorrent password set to $webpass" | tee -a $home/rtinst.info
elif [ $passflag = 2 ]; then
@@ -944,7 +1064,12 @@ else
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
if [ $leflag = 0 ]; then
echo " If enabled, access https downloads at https://$serverdn/download/$user" | tee -a $home/rtinst.info
else
echo " If enabled, access https downloads at https://$serverip/download/$user" | tee -a $home/rtinst.info
fi
fi
echo | tee -a $home/rtinst.info
+119
View File
@@ -0,0 +1,119 @@
#!/bin/bash
#########################################################################################
#
# Copyright (c) 2015 arakasi72 (https://github.com/arakasi72)
#
# --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
#
#########################################################################################
headless=0
osname=$(lsb_release -si)
releasename=$(lsb_release -cs)
[ -z $logfile ] && logfile="/dev/null"
if [ -z $serverip ]; then
headless=1
fi
#check it is being run as root
if [ "$(id -u)" != "0" ]; then
echo "Must be run from root or using sudo" && exit 1
fi
if [ $headless = 1 ]; then
serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
serveripb=$(wget -qO- ipecho.net/plain)
serveripc=$(wget -qO- --timeout=3 ipinfo.io/ip)
if [ "$serveripa" = "$serveripb" ] || [ "$serveripa" = "$serveripc" ]; then
serverip=$serveripa
else
echo "Select the IP address to use:"
echo "1.) "$serveripa
echo "2.) "$serveripb
echo "3.) "$serveripc
while true
do
read answer
case $answer in [1] ) serverip=$serveripa && break ;;
[2] ) serverip=$serveripb && break ;;
[3] ) serverip=$serveripc && break ;;
* ) echo "Enter 1, 2 or 3";;
esac
done
fi
serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
fi
echo "IP: $serverip"
echo "DN: $serverdn"
if [ -z $serverdn ]; then
echo "Unable to determine domain name cannot setup Lets Encypt"
exit 1
fi
#Installing Certbot
if [ $(dpkg-query -W -f='${Status}' "certbot" 2>/dev/null | grep -c "ok installed") = 0 ]; then
echo "Installing certbot"
if [ "$osname" = "Ubuntu" ]; then
# Verify if current distribution (release name, ex. focal) has available PPA packages
wget -qO- http://ppa.launchpad.net/certbot/certbot/ubuntu/dists/ | grep -q "$releasename" && USE_PPA=y
if [ "$USE_PPA" = "y" ]; then
aptitude -q=5 update >> $logfile 2>&1
add-apt-repository -y universe >> $logfile 2>&1
add-apt-repository -y ppa:certbot/certbot >> $logfile 2>&1
fi
aptitude -q=5 update >> $logfile 2>&1
aptitude -q=5 -y install certbot python-certbot-nginx >> $logfile 2>&1
else
deb_name=$(lsb_release --codename --short)
grep "^deb http\:\/\/deb\.debian\.org\/debian $deb_name-backports main" /etc/apt/sources.list > /dev/null || echo "deb http://deb.debian.org/debian $deb_name-backports main" >> /etc/apt/sources.list
aptitude -q=5 update >> $logfile 2>&1
aptitude -q=5 -y install certbot python-certbot-nginx -t $deb_name-backports >> $logfile 2>&1
fi
else
echo "certbot already installed"
fi
if [ $(dpkg-query -W -f='${Status}' "certbot" 2>/dev/null | grep -c "ok installed") = 0 ]; then
echo "Install Failed"
exit 1
fi
#Generating Certificates
certbot -q --nginx --register-unsafely-without-email --agree-tos certonly -d $serverdn >> $logfile 2>&1
if [ $? = 1 ]; then
echo "unable to generate certificates"
exit 1
fi
echo "Certificates Generated"
if [ $headless = 0 ]; then
exit 0
fi
if [ -d "/etc/letsencrypt/live/$serverdn" ]; then
echo "Replacing certificates in nginx and vsftpd"
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverdn;" /etc/nginx/sites-available/default
sed -i "/ssl_certificate / c\ ssl_certificate /etc/letsencrypt/live/$serverdn/fullchain.pem;" /etc/nginx/sites-available/default
sed -i "/ssl_certificate_key / c\ ssl_certificate_key /etc/letsencrypt/live/$serverdn/privkey.pem;" /etc/nginx/sites-available/default
service nginx restart
sed -i "/^\(\s\|#\)*rsa_cert_file/ c\rsa_cert_file=/etc/letsencrypt/live/$serverdn/fullchain.pem" /etc/vsftpd.conf
sed -i "/^\(\s\|#\)*rsa_private_key_file/ c\rsa_private_key_file=/etc/letsencrypt/live/$serverdn/privkey.pem" /etc/vsftpd.conf
service vsftpd restart
fi
+25 -6
View File
@@ -8,7 +8,6 @@
#
#########################################################################################
forceyes=1
headless=1
selfsign=1
@@ -60,6 +59,7 @@ fi
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_key/ c\ ssl_certificate_key \/etc\/ssl\/private\/ruweb\.key;' /etc/nginx/sites-available/default
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverip;" /etc/nginx/sites-available/default
service nginx restart >/dev/null 2>&1
fi
}
@@ -95,11 +95,30 @@ if [ $# -gt 0 ]; then
fi
if [ -z $serverip ]; then
serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
elif ! valid_ip $serverip; then
echo "$serverip is not a valid IP address"
serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
echo "will use $serverip instead"
serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
serveripb=$(wget -qO- ipecho.net/plain)
serveripc=$(wget -qO- --timeout=3 ipinfo.io/ip)
if [ "$serveripa" = "$serveripb" ] || [ "$serveripa" = "$serveripc" ]; then
serverip=$serveripa
else
echo "Select the IP address to use:"
echo "1.) "$serveripa
echo "2.) "$serveripb
echo "3.) "$serveripc
while true
do
read answer
case $answer in [1] ) serverip=$serveripa && break ;;
[2] ) serverip=$serveripb && break ;;
[3] ) serverip=$serveripc && break ;;
* ) echo "Enter 1, 2 or 3";;
esac
done
fi
echo "IP set to "$serverip
echo
fi
serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
+37 -21
View File
@@ -12,6 +12,24 @@ PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
osname=$(lsb_release -si)
relno=$(lsb_release -sr | cut -d. -f1)
fullrelno=$(lsb_release -sr)
# Fallback if lsb_release -si returns nothing
if [ "$osname" = "" ]; then
osname=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"')
osname=${osname^}
fi
# Fallback if lsb_release -sr returns nothing
if [ "$relno" = "" ]; then
relno=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"' | cut -d. -f1)
fi
if [ "$fullrelno" = "" ]; then
fullrelno=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"')
fi
sourcedir='http://rtorrent.net/downloads/'
xmlrpc_url='https://svn.code.sf.net/p/xmlrpc-c/code/stable/'
@@ -22,12 +40,12 @@ xmlrpcloc_alt='https://github.com/mirror/xmlrpc-c/trunk/stable'
rtdevrel=1
if [ $relno = 9 ] || [ $(lsb_release -sr) = 17.10 ] || [ $relno = 18 ]; then
if [ "$fullrelno" = "17.10" ]; then
rtdevrel=0
fi
if [ $rtdevrel = 0 ]; then
sourcedir='https://github.com/rakshasa/'
if ([ "$osname" = "Debian" ] || [ "$osname" = "Raspbian" ] && [ $relno -ge 9 ]) || ([ "$osname" = "Ubuntu" ] && [ $relno -ge 18 ]); then
rtdevrel=0
fi
listsize=6
@@ -57,7 +75,7 @@ hash $1 2>/dev/null
#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
if [[ `wget -S -T 3 --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
@@ -137,15 +155,13 @@ if [ -z $passed_rtvers ]; then
exit 1
fi
# checks if the OS is debian 9, and forces the version to 0.9.6 of it is
# 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.6'
rtvers='0.9.6'
echo "Debian 9 and Ubuntu 17.10 are only supported by libtorrent-0.13.6/rtorrent-0.9.6"
else
list_version
echo "For Debian 9, and Ubuntu 17.10 and later, recommend libtorrent-0.13.7/rtorrent-0.9.7 or later"
fi
list_version
echo "Install libtorrent-$libvers and rtorrent-$rtvers"
echo "Your rtorrent config, torrents, and data will not be lost or changed"
echo -n "Continue? "
@@ -164,11 +180,11 @@ else
rtvers=$passed_rtvers
fi
# checks if the OS is debian 9, and forces the version to 0.9.6 of it is
# 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.6'
rtvers='0.9.6'
echo "Debian 9 and Ubuntu 17.10 are only supported by libtorrent-0.13.6/rtorrent-0.9.6"
libvers='0.13.8'
rtvers='0.9.8'
echo "Debian 9, and Ubuntu 17.10 and later, are only supported by libtorrent-0.13.7/rtorrent-0.9.7 or later"
fi
fi
@@ -192,13 +208,13 @@ rm -rf xmlrpc libtorrent* rtorrent*
echo "Fetching source files"
if [ $rtdevrel = 0 ]; then
git clone -q -b feature-bind --single-branch https://github.com/rakshasa/libtorrent.git libtorrent-$libvers
git clone -q -b feature-bind --single-branch https://github.com/rakshasa/rtorrent.git rtorrent-$rtvers
else
#if [ $rtdevrel = 0 ]; then
# git clone -q -b feature-bind --single-branch https://github.com/rakshasa/libtorrent.git libtorrent-$libvers
# git clone -q -b feature-bind --single-branch https://github.com/rakshasa/rtorrent.git rtorrent-$rtvers
#else
curl -# http://rtorrent.net/downloads/libtorrent-$libvers.tar.gz | tar xz
curl -# http://rtorrent.net/downloads/rtorrent-$rtvers.tar.gz | tar xz
fi
#fi
if [ $xmlrpc_repo = 0 ]; then
svn co $xmlrpcloc xmlrpc >> $logfile 2>&1
@@ -225,7 +241,7 @@ 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
./configure --prefix=/usr --with-xmlrpc-c --enable-ipv6 >> $logfile 2>&1
make -j$(nproc) >> $logfile 2>&1
make -s install >> $logfile 2>&1
ldconfig >> $logfile 2>&1
+3 -3
View File
@@ -9,7 +9,7 @@
######################################################################
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
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 $7}')
if [ "$(id -u)" != "0" ]; then
echo "Must be run as root, directly or with sudo"
@@ -20,8 +20,8 @@ if [ $(dpkg-query -W -f='${Status}' webmin 2>/dev/null | grep -c "ok installed")
echo "Installing Webmin"
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 -
apt-get -qq update
apt-get -qq install webmin
aptitude -q=5 update
aptitude -q=5 -y install webmin
else
echo 'Webmin is already installed'
fi
+1 -1
View File
@@ -14,7 +14,7 @@ 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)
ruflag=0
rurelease=$(git ls-remote -t https://github.com/Novik/ruTorrent v\* | cut -d/ -f3 | sort -V | tail -1)
rurelease=$(curl -s "https://api.github.com/repos/Novik/ruTorrent/releases/latest" | awk -F '"' '/tag_name/{print $4}')
force_yes=1
restore_old=1
install_master=1