mirror of
https://github.com/elisspace/rtinst.git
synced 2026-10-06 17:16:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16d2f1d310 | ||
|
|
11ff99f684 | ||
|
|
6def26dc46 | ||
|
|
ff43cb7ccf | ||
|
|
1d8116d622 | ||
|
|
c38c565211 | ||
|
|
15dd6d5b19 | ||
|
|
e4bfaf4322 | ||
|
|
30ac8a1efb | ||
|
|
658e2d3937 | ||
|
|
f885123bab | ||
|
|
24b3ca1d44 | ||
|
|
c094ea145e | ||
|
|
0da4c80b62 | ||
|
|
2068d3a45c | ||
|
|
f8eea44834 | ||
|
|
2cb8ba306d | ||
|
|
c96e68e2b5 | ||
|
|
e32810d684 | ||
|
|
72291ecd6f | ||
|
|
b802e761ae |
@@ -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**
|
||||
|
||||
|
||||
It has been tested with clean installs of:
|
||||
Current release has been tested with clean installs of:
|
||||
|
||||
Ubuntu 12 (old release)
|
||||
Ubuntu 13 (old release)
|
||||
Ubuntu 14 (old release)
|
||||
Ubuntu 15 (old release)
|
||||
Ubuntu 16
|
||||
Ubuntu 17
|
||||
Ubuntu 18
|
||||
Ubuntu 19
|
||||
Debian 7 "Wheezy" (old release)
|
||||
Debian 8 "Jessie" (old release)
|
||||
Debian 9 "Stretch"
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -35,12 +35,7 @@ fi
|
||||
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
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
apt-get -qq update
|
||||
|
||||
+171
-163
@@ -8,6 +8,173 @@
|
||||
#
|
||||
#########################################################################################
|
||||
|
||||
|
||||
###############################
|
||||
### FUNCTIONS ###
|
||||
###############################
|
||||
|
||||
#function to check if a web site is reachable
|
||||
check_url() {
|
||||
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
|
||||
installed() {
|
||||
hash $1 2>/dev/null
|
||||
}
|
||||
|
||||
#function to check if string is valid format for an ip address
|
||||
valid_ip()
|
||||
{
|
||||
local ip=${1:-1.2.3.4}
|
||||
local i
|
||||
if expr "$ip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||
for i in 1 2 3 4; do
|
||||
if [ $(echo "$ip" | cut -d. -f$i) -gt 255 ]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
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
|
||||
[ -z "$genln" ] && genln=8
|
||||
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_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
|
||||
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
|
||||
set_pass() {
|
||||
local localpass
|
||||
local exitvalue=0
|
||||
local password1
|
||||
local password2
|
||||
|
||||
exec 3>&1 >/dev/tty
|
||||
|
||||
echo "Enter a password (6+ chars)"
|
||||
echo "or leave blank to generate a random one"
|
||||
|
||||
while [ -z $localpass ]
|
||||
do
|
||||
echo "Please enter the new password:"
|
||||
stty -echo
|
||||
read password1
|
||||
stty echo
|
||||
|
||||
# check that password is valid
|
||||
if [ -z $password1 ]; then
|
||||
echo "Random password generated, will be provided to user at end of script"
|
||||
exitvalue=1
|
||||
localpass=$(genpasswd)
|
||||
elif [ ${#password1} -lt 6 ]; then
|
||||
echo "password needs to be at least 6 chars long" && continue
|
||||
else
|
||||
echo "Enter the new password again:"
|
||||
stty -echo
|
||||
read password2
|
||||
stty echo
|
||||
|
||||
# Check both passwords match
|
||||
if [ $password1 != $password2 ]; then
|
||||
echo "Passwords do not match"
|
||||
else
|
||||
localpass=$password1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exec >&3-
|
||||
echo $localpass
|
||||
return $exitvalue
|
||||
}
|
||||
|
||||
#function to determine random number between 2 numbers
|
||||
random()
|
||||
{
|
||||
local min=$1
|
||||
local max=$2
|
||||
local RAND=`od -t uI -N 4 /dev/urandom | awk '{print $2}'`
|
||||
RAND=$((RAND%((($max-$min)+1))+$min))
|
||||
echo $RAND
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
# function to enter IP address
|
||||
enter_ip() {
|
||||
local ip_address=$1
|
||||
|
||||
exec 3>&1 >/dev/tty
|
||||
|
||||
while true
|
||||
do
|
||||
if valid_ip $ip_address ; then
|
||||
echo "Your Server IP is $ip_address"
|
||||
echo -n "Is this correct y/n? "
|
||||
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 ip_address
|
||||
done
|
||||
|
||||
exec >&3-
|
||||
|
||||
echo $ip_address
|
||||
}
|
||||
|
||||
|
||||
###############################
|
||||
### SET VARIABLES ###
|
||||
###############################
|
||||
@@ -113,161 +280,7 @@ forceyes=1
|
||||
selfsign=1
|
||||
rut_add_users=1
|
||||
|
||||
###############################
|
||||
### FUNCTIONS ###
|
||||
###############################
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
# checks if an application is installed
|
||||
installed() {
|
||||
hash $1 2>/dev/null
|
||||
}
|
||||
|
||||
#function to check if string is valid format for an ip address
|
||||
valid_ip()
|
||||
{
|
||||
local ip=${1:-1.2.3.4}
|
||||
local i
|
||||
if expr "$ip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
|
||||
for i in 1 2 3 4; do
|
||||
if [ $(echo "$ip" | cut -d. -f$i) -gt 255 ]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
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
|
||||
[ -z "$genln" ] && genln=8
|
||||
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
|
||||
set_pass() {
|
||||
local localpass
|
||||
local exitvalue=0
|
||||
local password1
|
||||
local password2
|
||||
|
||||
exec 3>&1 >/dev/tty
|
||||
|
||||
echo "Enter a password (6+ chars)"
|
||||
echo "or leave blank to generate a random one"
|
||||
|
||||
while [ -z $localpass ]
|
||||
do
|
||||
echo "Please enter the new password:"
|
||||
stty -echo
|
||||
read password1
|
||||
stty echo
|
||||
|
||||
# check that password is valid
|
||||
if [ -z $password1 ]; then
|
||||
echo "Random password generated, will be provided to user at end of script"
|
||||
exitvalue=1
|
||||
localpass=$(genpasswd)
|
||||
elif [ ${#password1} -lt 6 ]; then
|
||||
echo "password needs to be at least 6 chars long" && continue
|
||||
else
|
||||
echo "Enter the new password again:"
|
||||
stty -echo
|
||||
read password2
|
||||
stty echo
|
||||
|
||||
# Check both passwords match
|
||||
if [ $password1 != $password2 ]; then
|
||||
echo "Passwords do not match"
|
||||
else
|
||||
localpass=$password1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
exec >&3-
|
||||
echo $localpass
|
||||
return $exitvalue
|
||||
}
|
||||
|
||||
#function to determine random number between 2 numbers
|
||||
random()
|
||||
{
|
||||
local min=$1
|
||||
local max=$2
|
||||
local RAND=`od -t uI -N 4 /dev/urandom | awk '{print $2}'`
|
||||
RAND=$((RAND%((($max-$min)+1))+$min))
|
||||
echo $RAND
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
# function to enter IP address
|
||||
enter_ip() {
|
||||
while true
|
||||
do
|
||||
if valid_ip $serverip ; then
|
||||
echo "Your Server IP is $serverip"
|
||||
echo -n "Is this correct y/n? "
|
||||
ask_user && return 0
|
||||
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
|
||||
done
|
||||
}
|
||||
|
||||
###############################
|
||||
### INITIAL SYSTEM CHECKS ###
|
||||
@@ -358,7 +371,7 @@ 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
|
||||
@@ -521,13 +534,7 @@ echo
|
||||
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
|
||||
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
#update amd upgrade system
|
||||
@@ -545,6 +552,7 @@ apt-get clean && apt-get autoclean >> $logfile 2>&1
|
||||
|
||||
#install the packsges needed
|
||||
echo "Installing required packages" | tee -a $logfile
|
||||
apt-get install libtool -y >> $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
|
||||
@@ -558,7 +566,7 @@ for package_name in $package_list
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
+23
-5
@@ -12,17 +12,35 @@ 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/advanced/'
|
||||
xmlrpcloc='svn://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/stable/'
|
||||
|
||||
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
|
||||
|
||||
if [ $(lsb_release -sr) = 17.10 ]; then
|
||||
if [ "$fullrelno" = "17.10" ]; then
|
||||
rtdevrel=0
|
||||
fi
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user