Compare commits

...
44 Commits
Author SHA1 Message Date
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
10 changed files with 298 additions and 178 deletions
+9 -8
View File
@@ -23,18 +23,12 @@ 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** **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 (unsupported)
Ubuntu 15 (unsupported)
Ubuntu 16 Ubuntu 16
Ubuntu 17 Ubuntu 17
Ubuntu 18 Ubuntu 18
Ubuntu 19 Ubuntu 19
Debian 7 "Wheezy" (unsupported)
Debian 8 "Jessie" (unsupported)
Debian 9 "Stretch" Debian 9 "Stretch"
Debian 10 "Buster" Debian 10 "Buster"
@@ -52,7 +46,14 @@ Services that will be installed and configured are
[Additional information on all the features](https://github.com/arakasi72/rtinst/wiki/Guide) [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) 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 { server {
listen 80; listen 80;
listen [::]:80;
#server_name <Domain Name>; #server_name <Domain Name>;
root /var/www; root /var/www;
@@ -35,8 +36,11 @@ server {
} }
server { server {
listen 443 ssl; listen 443 ssl http2 default_server;
#server_name <Domain Name>; listen [::]:443 ssl http2 default_server;
#server_name <Domain Name>;
root /var/www; root /var/www;
index index.html index.php index.htm; index index.html index.php index.htm;
+2
View File
@@ -15,6 +15,8 @@ directory.default.set = (cat,(cfg.basedir),"download")
schedule = watch_directory,5,5,((load.start,(cat,(cfg.watch),"*.torrent"))) schedule = watch_directory,5,5,((load.start,(cat,(cfg.watch),"*.torrent")))
#system.umask.set = 0000
### BitTorrent ### BitTorrent
# Global upload and download rate in KiB, `0` for unlimited # Global upload and download rate in KiB, `0` for unlimited
throttle.global_down.max_rate.set = 0 throttle.global_down.max_rate.set = 0
+1 -6
View File
@@ -35,12 +35,7 @@ fi
if [[ $(systemctl list-units --all apt-daily.service | fgrep -c apt-daily.service) -gt 0 ]]; then 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 stop apt-daily.service > /dev/null 2>&1
systemctl kill --kill-who=all apt-daily.service > /dev/null 2>&1 systemctl kill --kill-who=all apt-daily.service > /dev/null 2>&1
sleep 5
# wait until `apt-get updated` has been killed
while ! (systemctl list-units --all apt-daily.service | fgrep -q dead)
do
sleep 1;
done
fi fi
apt-get -qq update apt-get -qq update
+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') ftpport=$(grep 'listen_port=' /etc/vsftpd.conf | sed 's/[^0-9]*//g')
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"
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 check_ssh=1
rtdstatus=$(rtdload)
#get user list #get user list
cd /var/www/rutorrent/conf/users cd /var/www/rutorrent/conf/users
@@ -33,6 +34,28 @@ user_list=*
### FUNCTIONS ### ### 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() { genpasswd() {
local genln=$1 local genln=$1
[ -z "$genln" ] && genln=8 [ -z "$genln" ] && genln=8
@@ -183,34 +206,39 @@ fi
############################### ###############################
if [ -z "$user" ]; then 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 "It can be an existing user or a new user"
echo echo
confirm_name=1 confirm_name=1
while [ $confirm_name = 1 ] while [ $confirm_name = 1 ]
do do
read -p "Enter user name: " answer valid_name
addname=$answer echo -n "Confirm that user name is $user y/n? "
check_name=1 if ask_user; then
if [ "$addname" = "root" ]; then confirm_name=0
echo "Cannot create root" else
exit user=''
fi 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 done
else
user=$addname 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 fi
echo "User name is $user"
if id -u $user >/dev/null 2>&1; then if id -u $user >/dev/null 2>&1; then
echo "$user already exists" echo "$user already exists"
else else
@@ -220,6 +248,13 @@ else
adduser --gecos "" $user --disabled-password adduser --gecos "" $user --disabled-password
echo "$user:$unixpass" | sudo chpasswd echo "$user:$unixpass" | sudo chpasswd
fi 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 fi
home=$(eval echo "~$user") 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 /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi
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 | 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 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/
@@ -363,14 +398,6 @@ fi
su $user -c '/usr/local/bin/rt restart' su $user -c '/usr/local/bin/rt restart'
su $user -c '/usr/local/bin/rt -i 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 "$user setup complete"
echo "SCGI Port: $newscgi" echo "SCGI Port: $newscgi"
echo "RPC Mount: $newrpc" echo "RPC Mount: $newrpc"
@@ -391,7 +418,7 @@ echo
fi fi
echo "ftp client should be set to explicit ftp over tls using port $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
echo 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 "https downloads can be accessed at https://$serverip/download/$user" | tee -a $home/rtinst.info
echo echo
fi fi
+195 -124
View File
@@ -8,99 +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='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)
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" ]; then
phpver=php7.3
phploc=/etc/php/7.3
libcver=libcurl4
fi
serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
serveripb=$(wget -qO- ipecho.net/plain)
if [ "$serveripa" = "$serveripb" ]; then
serverip=$serveripa
else
echo "Select the IP address to use:"
echo "1.) "$serveripa
echo "2.) "$serveripb
while true
do
read answer
case $answer in [1] ) serverip=$serveripa && break ;;
[2] ) serverip=$serveripb && break ;;
* ) echo "Enter 1 or 2";;
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=masterlibterm-readline-gnu-pe
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 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 ### ### FUNCTIONS ###
@@ -108,7 +15,7 @@ rut_add_users=1
#function to check if a web site is reachable #function to check if a web site is reachable
check_url() { 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 # checks if an application is installed
@@ -133,6 +40,18 @@ else
fi 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 #function to generate random password
genpasswd() { genpasswd() {
local genln=$1 local genln=$1
@@ -142,11 +61,12 @@ tr -dc A-Za-z0-9 < /dev/urandom | head -c ${genln} | xargs
#function executed if the script finishes early #function executed if the script finishes early
early_exit() { early_exit() {
local rt_ee_version
echo "Installation is incomplete. Run rtinst again to complete" echo "Installation is incomplete. Run rtinst again to complete"
echo echo
if hash rtorrent >> /dev/null 2>&1; then 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\}") rt_ee_version=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
echo "rtorrent $rt_current installed" echo "rtorrent $rt_ee_version installed"
else else
echo "rtorrent was not installed" echo "rtorrent was not installed"
fi fi
@@ -230,22 +150,138 @@ while true
# function to enter IP address # function to enter IP address
enter_ip() { enter_ip() {
local ip_address=$1
exec 3>&1 >/dev/tty
while true while true
do do
if valid_ip $serverip ; then if valid_ip $ip_address ; then
echo "Your Server IP is $serverip" echo "Your Server IP is $ip_address"
echo -n "Is this correct y/n? " echo -n "Is this correct y/n? "
ask_user && return 0 ask_user && break
else else
echo "Invalid IP address, please try again" echo "Invalid IP address, please try again"
fi fi
echo "enter your server's IP address" echo "enter your server's IP address"
echo "e.g. 213.0.113.113" echo "e.g. 213.0.113.113"
read serverip read ip_address
done 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 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 '"')
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
serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
serveripb=$(wget -qO- --timeout=3 ipecho.net/plain)
if [ "$serveripa" = "$serveripb" ]; then
serverip=$serveripa
else
echo "Select the IP address to use:"
echo "1.) "$serveripa
echo "2.) "$serveripb
while true
do
read answer
case $answer in [1] ) serverip=$serveripa && break ;;
[2] ) serverip=$serveripb && break ;;
* ) echo "Enter 1 or 2";;
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 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
############################### ###############################
### INITIAL SYSTEM CHECKS ### ### INITIAL SYSTEM CHECKS ###
############################### ###############################
@@ -335,7 +371,7 @@ fi
echo echo
# check IP Address # check IP Address
[ $forceyes = 1 ] && enter_ip [ $forceyes = 1 ] && serverip=$(enter_ip $serverip)
echo "Your server's IP is set to $serverip" echo "Your server's IP is set to $serverip"
export serverip export serverip
@@ -379,25 +415,39 @@ if [ -z "$user" ]; then
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"
echo echo
confirm_name=1 confirm_name=1
while [ $confirm_name = 1 ] while [ $confirm_name = 1 ]
do do
read -p "Enter user name: " answer valid_name
addname=$answer echo -n "Confirm that user name is $user y/n? "
echo -n "Confirm that user name is $answer y/n? "
if ask_user; then if ask_user; then
confirm_name=0 confirm_name=0
else
user=''
fi fi
done done
user=$addname
else else
user=$SUDO_USER user=$SUDO_USER
fi 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 fi
echo "User name is $user"
if id -u $user >/dev/null 2>&1; then if id -u $user >/dev/null 2>&1; then
echo "$user already exists" echo "$user already exists"
else else
@@ -407,6 +457,14 @@ else
adduser --gecos "" $user --disabled-password adduser --gecos "" $user --disabled-password
echo "$user:$unixpass" | chpasswd echo "$user:$unixpass" | chpasswd
fi 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 fi
home=$(eval echo "~$user") home=$(eval echo "~$user")
@@ -476,13 +534,7 @@ echo
if [[ $(systemctl list-units --all apt-daily.service | fgrep -c apt-daily.service) -gt 0 ]]; then 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 stop apt-daily.service >> $logfile 2>&1
systemctl kill --kill-who=all apt-daily.service >> $logfile 2>&1 systemctl kill --kill-who=all apt-daily.service >> $logfile 2>&1
sleep 5
# wait until `apt-get updated` has been killed
while ! (systemctl list-units --all apt-daily.service | fgrep -q dead)
do
sleep 1;
done
fi fi
#update amd upgrade system #update amd upgrade system
@@ -500,6 +552,7 @@ apt-get clean && apt-get autoclean >> $logfile 2>&1
#install the packsges needed #install the packsges needed
echo "Installing required packages" | tee -a $logfile echo "Installing required packages" | tee -a $logfile
apt-get install libtool -y >> $logfile 2>&1
for package_name in $package_list for package_name in $package_list
do do
if [ $(apt-cache show -q=0 $package_name 2>&1 | grep -c "No packages found") -eq 0 ]; then if [ $(apt-cache show -q=0 $package_name 2>&1 | grep -c "No packages found") -eq 0 ]; then
@@ -511,6 +564,11 @@ for package_name in $package_list
fi fi
done done
# Installs a package needed to prevent arm64 architectures from "WARNING: Unable to start rtorrent"
if [ "$(uname --m)" == "aarch64" ] || [ "$(dpkg --print-architecture)" == "arm64" ] ; then
sudo apt-get install libxmlrpc-core-c3-dev -y >> $logfile 2>&1
fi
test -z "$install_list" || apt-get -qq install $install_list >> $logfile 2>&1 test -z "$install_list" || apt-get -qq install $install_list >> $logfile 2>&1
if ! [ $? = 0 ]; then if ! [ $? = 0 ]; then
echo "Problem installing packages. Check log and rerun once it is resolved" && exit echo "Problem installing packages. Check log and rerun once it is resolved" && exit
@@ -529,13 +587,13 @@ if [ $osname = "Debian" ] && ! installed unrar; then
do do
attempts=$(( $attempts + 1 )) attempts=$(( $attempts + 1 ))
if [ "$(uname -m)" = "x86_64" ]; then if [ "$(uname -m)" = "x86_64" ]; then
wget http://www.rarlab.com/rar/rarlinux-x64-5.5.0.tar.gz >> $logfile 2>&1 wget http://www.rarlab.com/rar/rarlinux-x64-5.7.1.tar.gz >> $logfile 2>&1
tar xvzf rarlinux-x64-5.5.0.tar.gz >> $logfile 2>&1 tar xvzf rarlinux-x64-5.7.1.tar.gz >> $logfile 2>&1
rm rarlinux-x64-5.5.0.tar.gz rm rarlinux-x64-5.7.1.tar.gz
elif [ "$(uname -m)" = "x86_32" ]; then elif [ "$(uname -m)" = "x86_32" ]; then
wget http://www.rarlab.com/rar/rarlinux-5.5.0.tar.gz >> $logfile 2>&1 wget http://www.rarlab.com/rar/rarlinux-5.7.1.tar.gz >> $logfile 2>&1
tar xvzf rarlinux-5.5.0.tar.gz >> $logfile 2>&1 tar xvzf rarlinux-5.7.1.tar.gz >> $logfile 2>&1
rm rarlinux-5.5.0.tar.gz rm rarlinux-5.7.1.tar.gz
fi fi
done done
if [ -d rar ]; then if [ -d rar ]; then
@@ -757,6 +815,8 @@ if [ $leflag = 0 ]; then
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverdn;" /etc/nginx/sites-available/default 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 / 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 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 fi
service nginx restart && service $phpver-fpm restart service nginx restart && service $phpver-fpm restart
@@ -849,7 +909,7 @@ 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 | 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 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/
@@ -976,7 +1036,13 @@ if [ -z $ru_current ]; then
echo " RuTorrent was not installed" | tee -a $home/rtinst.info echo " RuTorrent was not installed" | tee -a $home/rtinst.info
else else
echo " RuTorrent $ru_current installed" | tee -a $home/rtinst.info echo " RuTorrent $ru_current installed" | tee -a $home/rtinst.info
echo " rutorrent can be accessed at https://$serverdn/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 if [ $passflag = 1 ]; then
echo " rutorrent password set to $webpass" | tee -a $home/rtinst.info echo " rutorrent password set to $webpass" | tee -a $home/rtinst.info
elif [ $passflag = 2 ]; then elif [ $passflag = 2 ]; then
@@ -986,7 +1052,12 @@ else
fi 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 | tee -a $home/rtinst.info echo | tee -a $home/rtinst.info
echo " If enabled, access https downloads at https://$serverdn/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 fi
echo | tee -a $home/rtinst.info echo | tee -a $home/rtinst.info
+3 -2
View File
@@ -62,9 +62,10 @@ if [ $(dpkg-query -W -f='${Status}' "certbot" 2>/dev/null | grep -c "ok installe
apt-get -q update >> $logfile 2>&1 apt-get -q update >> $logfile 2>&1
apt-get install -y certbot python-certbot-nginx >> $logfile 2>&1 apt-get install -y certbot python-certbot-nginx >> $logfile 2>&1
else else
grep "^deb http\:\/\/deb\.debian\.org\/debian stretch-backports main" /etc/apt/sources.list > /dev/null || echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list 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
apt-get -q update >> $logfile 2>&1 apt-get -q update >> $logfile 2>&1
apt-get install -y certbot python-certbot-nginx -t stretch-backports >> $logfile 2>&1 apt-get install -y certbot python-certbot-nginx -t $deb_name-backports >> $logfile 2>&1
fi fi
else else
echo "certbot already installed" echo "certbot already installed"
+1
View File
@@ -59,6 +59,7 @@ 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
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverip;" /etc/nginx/sites-available/default
service nginx restart >/dev/null 2>&1 service nginx restart >/dev/null 2>&1
fi fi
} }
+23 -5
View File
@@ -12,17 +12,35 @@ PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
osname=$(lsb_release -si) osname=$(lsb_release -si)
relno=$(lsb_release -sr | cut -d. -f1) 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/' sourcedir='http://rtorrent.net/downloads/'
xmlrpc_url='https://svn.code.sf.net/p/xmlrpc-c/code/advanced/' xmlrpc_url='https://svn.code.sf.net/p/xmlrpc-c/code/stable/'
xmlrpcloc='svn://svn.code.sf.net/p/xmlrpc-c/code/advanced/' xmlrpcloc='svn://svn.code.sf.net/p/xmlrpc-c/code/stable/'
xmlrpc_url_alt='https://github.com/mirror/xmlrpc-c' xmlrpc_url_alt='https://github.com/mirror/xmlrpc-c'
xmlrpcloc_alt='https://github.com/mirror/xmlrpc-c/trunk/advanced' xmlrpcloc_alt='https://github.com/mirror/xmlrpc-c/trunk/stable'
rtdevrel=1 rtdevrel=1
if [ $(lsb_release -sr) = 17.10 ]; then if [ "$fullrelno" = "17.10" ]; then
rtdevrel=0 rtdevrel=0
fi fi
@@ -57,7 +75,7 @@ hash $1 2>/dev/null
#function to check if a web site is reachable #function to check if a web site is reachable
check_url() { 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 # function to create a list of versions to install
+1 -1
View File
@@ -9,7 +9,7 @@
###################################################################### ######################################################################
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
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 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"