mirror of
https://github.com/elisspace/rtinst.git
synced 2026-10-07 01:26:24 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e57727b1f | ||
|
|
fe45572921 | ||
|
|
095db1ac33 | ||
|
|
5cee68c881 | ||
|
|
f8d667c6e3 | ||
|
|
9ffbf03938 | ||
|
|
9cf742a0fb | ||
|
|
d66db0d049 | ||
|
|
34833cb5e2 | ||
|
|
86c148966f | ||
|
|
61556b73ea | ||
|
|
67484c6813 | ||
|
|
627b5c25e9 | ||
|
|
bf06620c85 | ||
|
|
0d4ae9b317 | ||
|
|
e13bc2b706 | ||
|
|
f9615fe823 | ||
|
|
14c270f096 | ||
|
|
5452c98799 | ||
|
|
016299230e | ||
|
|
763d2efdeb | ||
|
|
1f1ec0ad3a | ||
|
|
b18b5718fe | ||
|
|
deff019f56 | ||
|
|
11a019cd16 | ||
|
|
0a8b21b8f3 | ||
|
|
c3cde97a74 | ||
|
|
18dd935f18 | ||
|
|
6935c58e6a | ||
|
|
f9063b89d4 | ||
|
|
d2869bf416 | ||
|
|
e6523c1956 | ||
|
|
3df3171d5c | ||
|
|
227eb998f2 | ||
|
|
3613eae1d9 | ||
|
|
6c5191a144 | ||
|
|
eef6d04d9d | ||
|
|
bde4bb2492 | ||
|
|
e7679d897b | ||
|
|
ba2a315b37 | ||
|
|
a0be8c3278 | ||
|
|
16d2f1d310 | ||
|
|
11ff99f684 | ||
|
|
6def26dc46 | ||
|
|
ff43cb7ccf | ||
|
|
1d8116d622 | ||
|
|
c38c565211 | ||
|
|
15dd6d5b19 | ||
|
|
e4bfaf4322 | ||
|
|
30ac8a1efb | ||
|
|
658e2d3937 | ||
|
|
f885123bab | ||
|
|
24b3ca1d44 | ||
|
|
c094ea145e | ||
|
|
0da4c80b62 | ||
|
|
2068d3a45c | ||
|
|
f8eea44834 | ||
|
|
2cb8ba306d | ||
|
|
c96e68e2b5 | ||
|
|
e32810d684 | ||
|
|
72291ecd6f | ||
|
|
b802e761ae | ||
|
|
64e998b2de | ||
|
|
bfee5f27fe | ||
|
|
2f7ad34e5b | ||
|
|
0652fe19eb | ||
|
|
90072e5226 | ||
|
|
ab34ec9fd4 | ||
|
|
4ca8cbc9a4 | ||
|
|
2dd915d800 | ||
|
|
2ecf699e9d | ||
|
|
3b2b6789a2 | ||
|
|
bb7e6bf87b | ||
|
|
2d2d1dff59 | ||
|
|
1f2a1b1f29 | ||
|
|
334659eb40 | ||
|
|
6a8bbafe95 | ||
|
|
78d70f57cd | ||
|
|
060a4b7660 | ||
|
|
4ead4b71e1 | ||
|
|
0c6d410dbe | ||
|
|
9ca5721d08 | ||
|
|
f3ee539bd4 | ||
|
|
9f13ecbfa6 | ||
|
|
7d200e9f58 | ||
|
|
986b24086d | ||
|
|
884d3e73bd | ||
|
|
9c14c2a82d | ||
|
|
25fa01635a | ||
|
|
4588907f07 | ||
|
|
318573ed63 | ||
|
|
5035ab0a95 | ||
|
|
1b9794ee7d | ||
|
|
eaffb50529 | ||
|
|
00aed27199 | ||
|
|
fe023bed1a | ||
|
|
37354f386a | ||
|
|
54f12f7877 | ||
|
|
c366ab575c | ||
|
|
d732810e83 | ||
|
|
79dd712da1 | ||
|
|
6ba83f6097 | ||
|
|
d3cb5e57e9 | ||
|
|
7bb8b0dd88 | ||
|
|
29a3ad947b | ||
|
|
98cac8525e | ||
|
|
c7d5d4a7ef | ||
|
|
ac23d1d943 | ||
|
|
fa2be075e8 | ||
|
|
ccf634fe8e | ||
|
|
3cb4ce6e4b | ||
|
|
4e4f248596 | ||
|
|
65aa469f04 | ||
|
|
7161f7d44f | ||
|
|
fd0f31f932 | ||
|
|
e1d80618ab | ||
|
|
723035d98b | ||
|
|
f31d00686f | ||
|
|
ec28d3745a | ||
|
|
e3ee61442a | ||
|
|
e1fe902647 | ||
|
|
d1553f2313 | ||
|
|
3390c0a997 | ||
|
|
04e306b8c4 | ||
|
|
ebb87d3a59 | ||
|
|
3d89e7038d | ||
|
|
c1ada21ca2 | ||
|
|
81b3f33320 | ||
|
|
163e070c74 | ||
|
|
e73d0409fe | ||
|
|
fc14ed4c26 | ||
|
|
17a179cc96 | ||
|
|
38d592a394 | ||
|
|
5d5f11aad5 | ||
|
|
1f9cbb58fe | ||
|
|
ed1e19a12e | ||
|
|
b8492ca3dc | ||
|
|
832ba598c6 | ||
|
|
e3a7cf69fe | ||
|
|
9b8cf7966a | ||
|
|
cfafd8eab3 | ||
|
|
21f9a0fa82 | ||
|
|
6cd5ca7e6a | ||
|
|
847517d461 | ||
|
|
4238aa85ed | ||
|
|
50c66e7c95 | ||
|
|
a9231a2397 | ||
|
|
ce5a0f6b49 | ||
|
|
a76779622f | ||
|
|
96a3725d06 | ||
|
|
b1cc07f104 | ||
|
|
43a00f560e | ||
|
|
7e380adf3a | ||
|
|
7b9b88e1ec | ||
|
|
5e4f088f04 | ||
|
|
825b381d2a | ||
|
|
713432d8a4 | ||
|
|
0ebf8f8335 | ||
|
|
aa00760898 | ||
|
|
9c06c11ba8 | ||
|
|
494b387e15 | ||
|
|
c41f7ab6a0 | ||
|
|
cdf523c5e1 | ||
|
|
e711362f7e | ||
|
|
48b010c6aa | ||
|
|
29a1be1673 | ||
|
|
939f7c4d6f | ||
|
|
0a511bdbfe | ||
|
|
cf266ca2d9 | ||
|
|
83d014435d | ||
|
|
a3699251a2 | ||
|
|
0b063374a2 | ||
|
|
8816cfd9b6 | ||
|
|
4b50d9d2c9 | ||
|
|
3a6231db3b | ||
|
|
08ce46c103 | ||
|
|
e23007496b | ||
|
|
b2dcb9e99e | ||
|
|
1a0dc76635 | ||
|
|
5a50f5059b | ||
|
|
666235dfd2 | ||
|
|
7a7c827bab | ||
|
|
c5f7625d9d | ||
|
|
75bd5b4dc9 | ||
|
|
5bef4334a7 | ||
|
|
071aab4d44 | ||
|
|
84a5cfca46 | ||
|
|
c22820cf7d | ||
|
|
83289d49a9 | ||
|
|
ad1568b912 | ||
|
|
0399ebfd4b | ||
|
|
c1e6bef8a8 | ||
|
|
1a97951253 | ||
|
|
3f89cf28ad | ||
|
|
127a5da748 | ||
|
|
8c48e91017 | ||
|
|
43190791d2 | ||
|
|
26ebdd7568 | ||
|
|
75c426f285 | ||
|
|
4cbda5906b | ||
|
|
780612e532 | ||
|
|
e677e8b701 |
@@ -1,16 +1,14 @@
|
|||||||
## rtinst
|
## rtinst
|
||||||
|
|
||||||
### NOTE: Please note there are some minor changes to how the script is installed and run.
|
### Note: Now installs Lets Encrypt SSL certificates
|
||||||
If you are familiar with rtinst please check the guide to avoid any confusion
|
|
||||||
|
|
||||||
#### 30 Second Guide
|
#### 30 Second Guide
|
||||||
|
|
||||||
Ubuntu and Debian Seedbox Installation
|
Ubuntu and Debian Seedbox Installation
|
||||||
|
|
||||||
Download and run setup (if logged in as root, do not need to use sudo)
|
Download and run setup (if logged in directly as root, do not need to use sudo)
|
||||||
|
|
||||||
wget --no-check-certificate https://raw.githubusercontent.com/arakasi72/rtinst/master/rtsetup
|
sudo bash -c "$(wget --no-check-certificate -qO - https://raw.githubusercontent.com/arakasi72/rtinst/master/rtsetup)"
|
||||||
sudo bash rtsetup
|
|
||||||
|
|
||||||
and then to run the main script, ([check the options you can use](https://github.com/arakasi72/rtinst/wiki/Guide#21-main-script-options)):
|
and then to run the main script, ([check the options you can use](https://github.com/arakasi72/rtinst/wiki/Guide#21-main-script-options)):
|
||||||
|
|
||||||
@@ -18,22 +16,22 @@ and then to run the main script, ([check the options you can use](https://github
|
|||||||
|
|
||||||
It takes about 10 minutes to run, depending on your server setup. After you have run the script and everything is working, I suggest a reboot, the script does not automate this reboot, you need to do it manually using the reboot command.
|
It takes about 10 minutes to run, depending on your server setup. After you have run the script and everything is working, I suggest a reboot, the script does not automate this reboot, you need to do it manually using the reboot command.
|
||||||
|
|
||||||
[A detailed installation guide](https://github.com/arakasi72/rtinst/wiki/Guide)
|
[A detailed installation guide](https://github.com/arakasi72/rtinst/wiki/Installing-rtinst)
|
||||||
|
|
||||||
|
[A detailed user guide](https://github.com/arakasi72/rtinst/wiki/Guide)
|
||||||
|
|
||||||
**IMPORTANT: NOTE THE NEW SSH PORT AND MAKE SURE YOU CAN SSH INTO YOUR SERVER BEFORE CLOSING THE EXISTING SESSION**
|
**IMPORTANT: NOTE THE NEW SSH PORT AND MAKE SURE YOU CAN SSH INTO YOUR SERVER BEFORE CLOSING THE EXISTING SESSION**
|
||||||
|
|
||||||
|
|
||||||
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 16
|
||||||
Ubuntu 17
|
Ubuntu 17
|
||||||
Debian 7 "Wheezy" (unsupported)
|
Ubuntu 18
|
||||||
Debian 8 "Jessie"
|
Ubuntu 19
|
||||||
|
Ubuntu 20
|
||||||
Debian 9 "Stretch"
|
Debian 9 "Stretch"
|
||||||
|
Debian 10 "Buster"
|
||||||
|
|
||||||
Services that will be installed and configured are
|
Services that will be installed and configured are
|
||||||
|
|
||||||
@@ -45,9 +43,9 @@ Services that will be installed and configured are
|
|||||||
6. webmin (optional see section 3.7 in main guide)
|
6. webmin (optional see section 3.7 in main guide)
|
||||||
|
|
||||||
|
|
||||||
[A detailed installation guide, and additional information on all the features](https://github.com/arakasi72/rtinst/wiki/Guide)
|
[rtinst installation guide](https://github.com/arakasi72/rtinst/wiki/Installing-rtinst)
|
||||||
|
|
||||||
For older unssuported OS listed above see the [Older OS Installation Guide](https://github.com/arakasi72/rtinst/wiki/Installing-on-Older-OS)
|
[Additional information on all the features](https://github.com/arakasi72/rtinst/wiki/Guide)
|
||||||
|
|
||||||
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
-1
@@ -1,5 +1,7 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
#server_name <Domain Name>;
|
||||||
root /var/www;
|
root /var/www;
|
||||||
|
|
||||||
index index.html index.php index.htm;
|
index index.html index.php index.htm;
|
||||||
@@ -34,7 +36,10 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl;
|
listen 443 ssl http2 default_server;
|
||||||
|
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;
|
||||||
|
|||||||
+3
-1
@@ -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.watch, private|const|string, (cat,(cfg.basedir),"watch/")
|
||||||
|
|
||||||
#method.insert = cfg.logs, private|const|string, (cat,(cfg.basedir),"log/")
|
#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")
|
session.path.set = (cat,(cfg.basedir),".session")
|
||||||
directory.default.set = (cat,(cfg.basedir),"download")
|
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
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ $pathToExternals = array(
|
|||||||
"gzip" => '/bin/gzip', // Something like /usr/bin/gzip. If empty, will be found in PATH.
|
"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.
|
"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.
|
"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
|
$localhosts = array( // list of local interfaces
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ enabled = yes
|
|||||||
enabled = yes
|
enabled = yes
|
||||||
|
|
||||||
;; Disabled
|
;; Disabled
|
||||||
|
[_cloudflare]
|
||||||
|
enabled = no
|
||||||
[check_port]
|
[check_port]
|
||||||
enabled = no
|
enabled = no
|
||||||
[chunks]
|
[chunks]
|
||||||
@@ -120,5 +122,7 @@ enabled = no
|
|||||||
enabled = no
|
enabled = no
|
||||||
[scheduler]
|
[scheduler]
|
||||||
enabled = no
|
enabled = no
|
||||||
|
[spectrogram]
|
||||||
|
enabled = no
|
||||||
[xmpp]
|
[xmpp]
|
||||||
enabled = no
|
enabled = no
|
||||||
|
|||||||
@@ -13,11 +13,33 @@ PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
|
|||||||
rundir=$(dirname $(readlink -f $0))
|
rundir=$(dirname $(readlink -f $0))
|
||||||
branch=$1
|
branch=$1
|
||||||
|
|
||||||
|
# function to ask user for y/n response
|
||||||
|
ask_user(){
|
||||||
|
local answer
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
read answer
|
||||||
|
case $answer in [Yy]* ) return 0 ;;
|
||||||
|
[Nn]* ) return 1 ;;
|
||||||
|
* ) echo "Enter y or n";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "Must be run as root, directly or with sudo"
|
echo "Must be run as root, directly or with sudo"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# kill apt-daily.service if running
|
||||||
|
if [[ $(systemctl list-units --all apt-daily.service | fgrep -c apt-daily.service) -gt 0 ]]; then
|
||||||
|
systemctl stop apt-daily.service > /dev/null 2>&1
|
||||||
|
systemctl kill --kill-who=all apt-daily.service > /dev/null 2>&1
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-get -qq update
|
||||||
|
|
||||||
if [ $(dpkg-query -W -f='${Status}' git 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
|
if [ $(dpkg-query -W -f='${Status}' git 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
|
||||||
echo "Installing git"
|
echo "Installing git"
|
||||||
apt-get -yqq install git 2>&1 >> /dev/null
|
apt-get -yqq install git 2>&1 >> /dev/null
|
||||||
@@ -34,6 +56,19 @@ if [ -d /etc/rtinst ] && [ -z $branch ]; then
|
|||||||
branch=$(basename "$(git symbolic-ref -q HEAD)")
|
branch=$(basename "$(git symbolic-ref -q HEAD)")
|
||||||
if [ -z $branch ]; then
|
if [ -z $branch ]; then
|
||||||
branch=$(git describe --tags --exact-match)
|
branch=$(git describe --tags --exact-match)
|
||||||
|
if [ ${branch:0:1} = v ]; then
|
||||||
|
latest=$(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
|
||||||
|
else
|
||||||
|
echo "Already using the latest version, rtinst $branch"
|
||||||
|
echo -n "Do you wish to reinstall rtinst y/n? "
|
||||||
|
if ! ask_user; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ $(git ls-remote --tags --heads https://github.com/arakasi72/rtinst.git $branch | wc -l) -eq 0 ]; then
|
if [ $(git ls-remote --tags --heads https://github.com/arakasi72/rtinst.git $branch | wc -l) -eq 0 ]; then
|
||||||
echo "$branch has been deleted, using latest numbered release instead"
|
echo "$branch has been deleted, using latest numbered release instead"
|
||||||
@@ -54,15 +89,20 @@ if [ $(git ls-remote --tags --heads https://github.com/arakasi72/rtinst.git $bra
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Installing rtinst $branch"
|
||||||
cd
|
cd
|
||||||
rm -fr /etc/rtinst
|
rm -fr /etc/rtinst
|
||||||
git clone -q https://github.com/arakasi72/rtinst.git /etc/rtinst
|
git clone -q https://github.com/arakasi72/rtinst.git /etc/rtinst
|
||||||
cd /etc/rtinst
|
cd /etc/rtinst
|
||||||
git checkout $branch
|
git checkout $branch > /dev/null 2>&1
|
||||||
cd
|
cd
|
||||||
ln -sf /etc/rtinst/scripts/* /usr/local/bin
|
ln -sf /etc/rtinst/scripts/* /usr/local/bin
|
||||||
ln -sf /etc/rtinst/rtsetup /usr/local/bin
|
ln -sf /etc/rtinst/rtsetup /usr/local/bin
|
||||||
|
|
||||||
|
echo "Installation complete"
|
||||||
|
echo
|
||||||
|
echo "You can now run rtinst and the additional supporting scripts"
|
||||||
|
|
||||||
if [ "$rundir" != "/etc/rtinst" ]; then
|
if [ "$rundir" != "/etc/rtinst" ]; then
|
||||||
rm -f $rundir/rtsetup
|
rm -f $rundir/rtsetup
|
||||||
fi
|
fi
|
||||||
|
|||||||
+83
-38
@@ -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")
|
||||||
@@ -287,11 +322,13 @@ if ! [ -d "$home/rtorrent/watch" ]; then
|
|||||||
mkdir $home/rtorrent/watch
|
mkdir $home/rtorrent/watch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$webpass" ]; then
|
if [ -z "$webpass" ] && [ -z $(grep -s $user $passfile) ]; then
|
||||||
webpass=$(genpasswd)
|
webpass=$(genpasswd)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
htpasswd -b $passfile $user $webpass
|
if [ ! -z "$webpass" ]; then
|
||||||
|
htpasswd -b $passfile $user $webpass
|
||||||
|
fi
|
||||||
|
|
||||||
cp -f /etc/rtinst/conf/rtorrent.rc $home/.rtorrent.rc
|
cp -f /etc/rtinst/conf/rtorrent.rc $home/.rtorrent.rc
|
||||||
|
|
||||||
@@ -316,12 +353,11 @@ 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/
|
||||||
mkdir -p $home/.autodl
|
mkdir -p $home/.autodl
|
||||||
touch $home/.autodl/autodl.cfg && touch $home/.autodl/autodl2.cfg
|
|
||||||
|
|
||||||
echo "<?php" > /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
|
echo "<?php" > /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
|
||||||
echo >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
|
echo >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
|
||||||
@@ -331,13 +367,25 @@ echo >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
|
|||||||
echo "?>" >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
|
echo "?>" >> /var/www/rutorrent/conf/users/$user/plugins/autodl-irssi/conf.php
|
||||||
|
|
||||||
cd $home/.autodl
|
cd $home/.autodl
|
||||||
echo "[options]" > autodl2.cfg
|
|
||||||
echo "gui-server-port = $adlport" >> autodl2.cfg
|
if [ -f "autodl.cfg" ]; then
|
||||||
echo "gui-server-password = $adlpass" >> autodl2.cfg
|
if (grep -sq gui-server-port autodl.cfg) && (grep -sq gui-server-password autodl.cfg); then
|
||||||
|
sed -i "/gui-server-port/ c\gui-server-port = $adlport" autodl.cfg
|
||||||
|
sed -i "/gui-server-password/ c\gui-server-password = $adlpass" autodl.cfg
|
||||||
|
else
|
||||||
|
sed -i '/gui-server-port/ d' autodl.cfg
|
||||||
|
sed -i '/gui-server-password/ d' autodl.cfg
|
||||||
|
echo >> autodl.cfg
|
||||||
|
sed -i "1s/^/[options]\ngui-server-port = $adlport\ngui-server-password = $adlpass\n/" autodl.cfg
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "[options]" > autodl.cfg
|
||||||
|
echo "gui-server-port = $adlport" >> autodl.cfg
|
||||||
|
echo "gui-server-password = $adlpass" >> autodl.cfg
|
||||||
|
fi
|
||||||
|
|
||||||
chown -R $user:$user $home
|
chown -R $user:$user $home
|
||||||
chown -R www-data:www-data /var/www/rutorrent
|
chown -R www-data:www-data /var/www/rutorrent
|
||||||
chmod -R 755 /var/www/rutorrent
|
|
||||||
|
|
||||||
if [ -z "$(crontab -u $user -l | grep "$cronline1")" ]; then
|
if [ -z "$(crontab -u $user -l | grep "$cronline1")" ]; then
|
||||||
(crontab -u $user -l; echo "$cronline1" ) | crontab -u $user -
|
(crontab -u $user -l; echo "$cronline1" ) | crontab -u $user -
|
||||||
@@ -350,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"
|
||||||
@@ -371,18 +411,23 @@ echo
|
|||||||
### WRITE RTINST.INFO ###
|
### WRITE RTINST.INFO ###
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
|
echo > $home/rtinst.info
|
||||||
if groups $user | grep -q -E ' sshuser(\s|$)' || groups $user | grep -q -E ' sudo(\s|$)'; then
|
if groups $user | grep -q -E ' sshuser(\s|$)' || groups $user | grep -q -E ' sudo(\s|$)'; then
|
||||||
echo "$user has SSH access on port $sshport" | tee -a $home/rtinst.info
|
echo "$user has SSH access on port $sshport" | tee -a $home/rtinst.info
|
||||||
echo
|
echo
|
||||||
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
|
||||||
echo "rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info
|
echo "rutorrent can be accessed at https://$serverip/rutorrent" | tee -a $home/rtinst.info
|
||||||
echo "rutorrent password set to $webpass" | tee -a $home/rtinst.info
|
if [ -z $webpass ]; then
|
||||||
|
echo "rutorrent password has not been changed" | tee -a $home/rtinst.info
|
||||||
|
else
|
||||||
|
echo "rutorrent password set to $webpass" | tee -a $home/rtinst.info
|
||||||
|
fi
|
||||||
echo "to change rutorrent password enter: rtpass" | tee -a $home/rtinst.info
|
echo "to change rutorrent password enter: rtpass" | tee -a $home/rtinst.info
|
||||||
echo
|
echo
|
||||||
echo "The above info is stored at $home/rtinst.info"
|
echo "The above info is stored at $home/rtinst.info"
|
||||||
|
|||||||
+8
-6
@@ -16,16 +16,17 @@ select_task(){
|
|||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
read answer
|
read answer
|
||||||
case $answer in [1] ) rtgetscripts && return 0 ;;
|
case $answer in [1] ) rtsetup && return 0 ;;
|
||||||
[2] ) rtadduser && return 0 ;;
|
[2] ) rtadduser && return 0 ;;
|
||||||
[3] ) rtremove && return 0 ;;
|
[3] ) rtremove && return 0 ;;
|
||||||
[4] ) rtdload $rtdaction && return 0 ;;
|
[4] ) rtdload $rtdaction && return 0 ;;
|
||||||
[5] ) rtupdate && return 0 ;;
|
[5] ) rtupdate && return 0 ;;
|
||||||
[6] ) rutupgrade && return 0 ;;
|
[6] ) rutupgrade && return 0 ;;
|
||||||
[7] ) rtwebmin && return 0 ;;
|
[7] ) rtwebmin && return 0 ;;
|
||||||
[8] ) rtsslcert && return 0 ;;
|
[8] ) rtletsencrypt && return 0 ;;
|
||||||
|
[9] ) rtsslcert && return 0 ;;
|
||||||
[Qq] ) exit ;;
|
[Qq] ) exit ;;
|
||||||
* ) echo "Enter 1-8 (q to quit)";;
|
* ) echo "Enter 1-9 (q to quit)";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -46,14 +47,15 @@ clear
|
|||||||
echo "For more information go to:"
|
echo "For more information go to:"
|
||||||
echo "https://github.com/arakasi72/rtinst/blob/master/README.md"
|
echo "https://github.com/arakasi72/rtinst/blob/master/README.md"
|
||||||
echo "Select from the following options:"
|
echo "Select from the following options:"
|
||||||
echo "1.) rtgetscripts - update the rtinst scripts"
|
echo "1.) rtsetup - update the rtinst scripts"
|
||||||
echo "2.) rtadduser - add new user"
|
echo "2.) rtadduser - add new user"
|
||||||
echo "3.) rtremove - delete a user"
|
echo "3.) rtremove - delete a user"
|
||||||
echo "4.) rtdload $rtdaction - $rtdaction http downloads"
|
echo "4.) rtdload $rtdaction - $rtdaction https downloads"
|
||||||
echo "5.) rtupdate - up/down-grade rtorent/libtorrent"
|
echo "5.) rtupdate - up/down-grade rtorent/libtorrent"
|
||||||
echo "6.) rutupgrade - upgrade to latest version of RuTorrent"
|
echo "6.) rutupgrade - upgrade to latest version of RuTorrent"
|
||||||
echo "7.) rtwebmin - install webmin"
|
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"
|
echo "Enter option or q to quit"
|
||||||
|
|
||||||
select_task
|
select_task
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
#
|
|
||||||
# Copyright (c) 2015 arakasi72 (https://github.com/arakasi72)
|
|
||||||
#
|
|
||||||
# --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
|
||||||
#
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
|
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
|
||||||
echo "Must be run as root, directly or with sudo"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d /etc/rtinst ]; then
|
|
||||||
git clone https://github.com/arakasi72/rtinst.git /etc/rtinst
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd /etc/rtinst
|
|
||||||
|
|
||||||
branch=$(basename "$(git symbolic-ref -q HEAD)")
|
|
||||||
|
|
||||||
# if branch is empty then it is a tag
|
|
||||||
if [ -z $branch ]; then
|
|
||||||
branch=$(git describe --tags --exact-match)
|
|
||||||
if [ ${branch:0:1} = v ]; then
|
|
||||||
git fetch origin
|
|
||||||
latest=$(git tag | sort -V | grep ^v | tail -1)
|
|
||||||
if [ $branch = $latest ]; then
|
|
||||||
echo "Already using the latest release: $branch"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
# update to latest release
|
|
||||||
echo "rtinst updating from $branch to $latest"
|
|
||||||
cd
|
|
||||||
rm -fr /etc/rtinst
|
|
||||||
git clone -q https://github.com/arakasi72/rtinst.git /etc/rtinst
|
|
||||||
cd /etc/rtinst
|
|
||||||
git checkout -q $latest
|
|
||||||
branch=$(git describe --tags --exact-match)
|
|
||||||
echo "rtinst $branch installed"
|
|
||||||
cd
|
|
||||||
ln -sf /etc/rtinst/scripts/* /usr/local/bin
|
|
||||||
ln -sf /etc/rtinst/rtsetup /usr/local/bin
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
echo "$branch is not a branch, or a numbered release"
|
|
||||||
echo "Run rtsetup if you want to switch to another build"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $(git ls-remote --heads https://github.com/arakasi72/rtinst.git $branch | wc -l) -eq 0 ]; then
|
|
||||||
echo "$branch no longer appears to exist"
|
|
||||||
echo "run rtsetup to reset branch"
|
|
||||||
else
|
|
||||||
git fetch --all
|
|
||||||
git reset --hard origin/$branch 2>&1 >> /dev/null
|
|
||||||
git pull origin $branch
|
|
||||||
|
|
||||||
ln -sf /etc/rtinst/scripts/* /usr/local/bin
|
|
||||||
ln -sf /etc/rtinst/rtsetup /usr/local/bin
|
|
||||||
fi
|
|
||||||
+577
-265
File diff suppressed because it is too large
Load Diff
Executable
+116
@@ -0,0 +1,116 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
# Remove apt version of Certbot if installed
|
||||||
|
if [ $(dpkg-query -W -f='${Status}' "certbot" 2>/dev/null | grep -c "ok installed") = 1 ]; then
|
||||||
|
echo "Removing apt version of Certbot"
|
||||||
|
aptitude -q=5 -y remove certbot python*-certbot-nginx >> $logfile 2>&1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install Snapd service
|
||||||
|
aptitude -q=5 -y install snapd >> $logfile 2>&1
|
||||||
|
# Install the core snap in order to get the latest snapd for Debian
|
||||||
|
if [ $osname = "Debian" ]; then snap install core >> $logfile 2>&1; snap refresh core; fi
|
||||||
|
|
||||||
|
# Installing Certbot
|
||||||
|
if [ $(snap list | grep -c "certbot") = 0 ]; then
|
||||||
|
echo "Installing certbot"
|
||||||
|
snap install --classic certbot >> $logfile 2>&1
|
||||||
|
else
|
||||||
|
echo "certbot already installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(snap list | grep -c "certbot") = 0 ]; then
|
||||||
|
echo "Install Failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Prepare certbot command
|
||||||
|
ln -s /snap/bin/certbot /usr/bin/certbot
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+35
-16
@@ -8,9 +8,9 @@
|
|||||||
#
|
#
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
forceyes=1
|
forceyes=1
|
||||||
headless=1
|
headless=1
|
||||||
|
selfsign=1
|
||||||
|
|
||||||
#function to check if string is valid format for an ip address
|
#function to check if string is valid format for an ip address
|
||||||
valid_ip()
|
valid_ip()
|
||||||
@@ -48,19 +48,20 @@ echo -n "Generating https/ssl certificates"
|
|||||||
|
|
||||||
openssl req -x509 -nodes -days 3650 -subj /CN=$serverip -config /etc/ssl/ruweb.cnf -newkey rsa:2048 -keyout /etc/ssl/private/ruweb.key -out /etc/ssl/ruweb.crt > /dev/null 2>&1
|
openssl req -x509 -nodes -days 3650 -subj /CN=$serverip -config /etc/ssl/ruweb.cnf -newkey rsa:2048 -keyout /etc/ssl/private/ruweb.key -out /etc/ssl/ruweb.crt > /dev/null 2>&1
|
||||||
|
|
||||||
|
echo ": done"
|
||||||
|
|
||||||
if [ -f /etc/vsftpd.conf ]; then
|
if [ -f /etc/vsftpd.conf ]; then
|
||||||
sed -i '/^\(\s\|#\)*rsa_private_key_file/ c\rsa_private_key_file=\/etc\/ssl\/private\/ruweb\.key' /etc/vsftpd.conf
|
sed -i '/^\(\s\|#\)*rsa_private_key_file/ c\rsa_private_key_file=\/etc\/ssl\/private\/ruweb\.key' /etc/vsftpd.conf
|
||||||
sed -i '/^\(\s\|#\)*rsa_cert_file/ c\rsa_cert_file=\/etc\/ssl\/ruweb\.crt' /etc/vsftpd.conf
|
sed -i '/^\(\s\|#\)*rsa_cert_file/ c\rsa_cert_file=\/etc\/ssl\/ruweb\.crt' /etc/vsftpd.conf
|
||||||
service vsftpd restart
|
service vsftpd restart >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/nginx/sites-available/default ]; then
|
if [ -f /etc/nginx/sites-available/default ]; then
|
||||||
sed -i '/ssl_certificate / c\ ssl_certificate \/etc\/ssl\/ruweb\.crt;' /etc/nginx/sites-available/default
|
sed -i '/ssl_certificate / c\ ssl_certificate \/etc\/ssl\/ruweb\.crt;' /etc/nginx/sites-available/default
|
||||||
sed -i '/ssl_certificate_key/ c\ ssl_certificate_key \/etc\/ssl\/private\/ruweb\.key;' /etc/nginx/sites-available/default
|
sed -i '/ssl_certificate_key/ c\ ssl_certificate_key \/etc\/ssl\/private\/ruweb\.key;' /etc/nginx/sites-available/default
|
||||||
service nginx restart
|
sed -i "/^\(\s\|#\)*server_name/ c\ server_name $serverip;" /etc/nginx/sites-available/default
|
||||||
|
service nginx restart >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ": done"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#check it is being run as root
|
#check it is being run as root
|
||||||
@@ -71,12 +72,13 @@ fi
|
|||||||
# options -y and -d take away the user interaction so can be called from another script
|
# options -y and -d take away the user interaction so can be called from another script
|
||||||
# option -y will force the creation of new certificates
|
# option -y will force the creation of new certificates
|
||||||
# option -d will not unless it determines they are needed
|
# option -d will not unless it determines they are needed
|
||||||
while getopts ":yd" optname
|
while getopts ":yds" optname
|
||||||
do
|
do
|
||||||
case $optname in
|
case $optname in
|
||||||
"y" ) forceyes=0 ;;
|
"y" ) forceyes=0 ;;
|
||||||
"d" ) headless=0 ;;
|
"d" ) headless=0 ;;
|
||||||
* ) echo "-y or -d only options allowed" && exit ;;
|
"s" ) selfsign=0 ;;
|
||||||
|
* ) echo "-y, -d, and -s only options allowed" && exit ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -87,19 +89,36 @@ if [ $forceyes = 0 ] && [ $headless = 0 ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -gt 1 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
echo "Only one argument allowed"
|
echo "No arguments allowed"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
serverip=$1
|
|
||||||
|
|
||||||
if [ -z $serverip ]; then
|
if [ -z $serverip ]; then
|
||||||
serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
|
serveripa=$(ip route get 8.8.8.8 | awk 'NR==1 {print $7}')
|
||||||
elif ! valid_ip $serverip; then
|
serveripb=$(wget -qO- ipecho.net/plain)
|
||||||
echo "$serverip is not a valid IP address"
|
serveripc=$(wget -qO- --timeout=3 ipinfo.io/ip)
|
||||||
serverip=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
|
if [ "$serveripa" = "$serveripb" ] || [ "$serveripa" = "$serveripc" ]; then
|
||||||
echo "will use $serverip instead"
|
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
|
fi
|
||||||
|
|
||||||
serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
|
serverdn=$(perl -MSocket -le "print((gethostbyaddr(inet_aton('$serverip'), AF_INET))[0])")
|
||||||
|
|||||||
+146
-65
@@ -10,39 +10,65 @@
|
|||||||
|
|
||||||
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
|
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
|
||||||
|
|
||||||
RTFILE=/usr/local/bin/rt
|
osname=$(lsb_release -si)
|
||||||
|
relno=$(lsb_release -sr | cut -d. -f1)
|
||||||
|
fullrelno=$(lsb_release -sr)
|
||||||
|
|
||||||
duoversion="0.13.2/0.9.2 0.13.3/0.9.3 0.13.4/0.9.4 0.13.5/0.9.5 0.13.6/0.9.6"
|
# Fallback if lsb_release -si returns nothing
|
||||||
OSNAME=$(cat /etc/issue.net | cut -d' ' -f1)
|
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='https://rakshasa.github.io/rtorrent/'
|
||||||
|
|
||||||
|
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/stable'
|
||||||
|
|
||||||
|
rtdevrel=1
|
||||||
|
|
||||||
|
libvers='0.13.8'
|
||||||
|
rtvers='0.9.8'
|
||||||
|
|
||||||
|
duoversion=''
|
||||||
|
passed_rtvers=$1
|
||||||
|
[ -z $logfile ] && logfile="/dev/null"
|
||||||
|
|
||||||
|
|
||||||
|
# checks if an application is installed
|
||||||
installed() {
|
installed() {
|
||||||
hash $1 2>/dev/null
|
hash $1 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
ask_version() {
|
#function to check if a web site is reachable
|
||||||
while [ -z "$verschoice" ]
|
check_url() {
|
||||||
do
|
if [[ `wget -S -T 3 --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then return 0; else return 1; fi
|
||||||
echo "Please select libtorrent/rtorrent version."
|
|
||||||
select verschoice in ${duoversion[*]}
|
|
||||||
do
|
|
||||||
libvers=$(echo $verschoice | cut -d/ -f1)
|
|
||||||
rtvers=$(echo $verschoice | cut -d/ -f2)
|
|
||||||
break
|
|
||||||
done
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm_answer() {
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
read -p "Sure you wish to install libtorrent-"$libvers" and rtorrent-"$rtvers"?" answer
|
|
||||||
case $answer in [Yy]* ) return 0 ;;
|
|
||||||
[Nn]* ) exit ;;
|
|
||||||
* ) echo "Enter y or n";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
|
ask_user(){
|
||||||
|
local answer
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
read answer
|
||||||
|
case $answer in [Yy]* ) return 0 ;;
|
||||||
|
[Nn]* ) return 1 ;;
|
||||||
|
* ) echo "Enter y or n";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
@@ -50,69 +76,124 @@ if [ "$(id -u)" != "0" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ( installed rtorrent ); then
|
# Check the libtorrent/rtorrent and xmlrpc sites are available
|
||||||
rtorrent_current=$(rtorrent -h | grep -m 1 'version')
|
xmlrpc_repo=0
|
||||||
rtorrent_current=${rtorrent_current#*version }
|
rt_repo=0
|
||||||
echo "rtorrent $rtorrent_current detected"
|
echo
|
||||||
echo
|
echo "Checking File Repositories"
|
||||||
else
|
|
||||||
echo "rtorrent NOT installed"
|
echo -n "xmlrpc-c: "; check_url $xmlrpc_url && echo "OK" || xmlrpc_repo=1
|
||||||
echo "This script is for upgrading/downgrading only, not for initial install"
|
|
||||||
|
if [[ $xmlrpc_repo = 1 ]]; then
|
||||||
|
xmlrpc_url=$xmlrpc_url_alt
|
||||||
|
xmlrpcloc=$xmlrpcloc_alt
|
||||||
|
check_url $xmlrpc_url && { echo "OK"; xmlrpc_repo=0; } || { echo "FAIL"; xmlrpc_repo=1; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "rtorrent: "; check_url $sourcedir && echo "OK" || { echo "FAIL"; rt_repo=1; }
|
||||||
|
|
||||||
|
if [ $rt_repo = 1 ]; then
|
||||||
|
echo "The libtorrent/rtorrent file repositoy is offline"
|
||||||
|
echo "Try again later, you can check if the following address is online in your browser:"
|
||||||
|
echo $sourcedir
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ask_version
|
if [ $xmlrpc_repo = 1 ]; then
|
||||||
confirm_answer
|
if [ -d /usr/include/xmlrpc-c ]; then
|
||||||
|
echo "xmlrpc repository is off line, but looks like it has already beed installed."
|
||||||
|
echo "We will try and install rtorrent"
|
||||||
|
else
|
||||||
|
echo "The xmlrpc-c file repositoy is offline"
|
||||||
|
echo "Try again later, you can check if the following address is online in your browser:"
|
||||||
|
echo $xmlrpcloc
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z $passed_rtvers ]; then
|
||||||
|
if ( installed rtorrent ); then
|
||||||
|
rt_current=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
|
||||||
|
echo "rtorrent $rt_current detected"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "rtorrent NOT installed"
|
||||||
|
echo "This script is for upgrading/downgrading only, not for initial install"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ -z "$home" ]; then
|
||||||
|
home=$HOME
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Installing $libvers/$rtvers"
|
echo "Installing libtorrent-$libvers/rtorrent-$rtvers"
|
||||||
|
|
||||||
cd $HOME
|
cd $home
|
||||||
|
|
||||||
if [ -d source ]; then
|
if [ -d source ]; then
|
||||||
cd source
|
cd source
|
||||||
else
|
else
|
||||||
mkdir source && cd source
|
mkdir source && cd source
|
||||||
fi
|
fi
|
||||||
rm -r -f libtorrent* rtorrent*
|
rm -rf xmlrpc libtorrent* rtorrent*
|
||||||
|
|
||||||
echo "Fetching source files"
|
echo "Fetching source files"
|
||||||
curl -# http://rtorrent.net/downloads/libtorrent-$libvers.tar.gz | tar xz
|
|
||||||
curl -# http://rtorrent.net/downloads/rtorrent-$rtvers.tar.gz | tar xz
|
|
||||||
|
|
||||||
echo "Compiling libtorrent"
|
#if [ $rtdevrel = 0 ]; then
|
||||||
cd $HOME/source/libtorrent-$libvers
|
# git clone -q -b feature-bind --single-branch https://github.com/rakshasa/libtorrent.git libtorrent-$libvers
|
||||||
./autogen.sh >> /dev/null 2>&1
|
# git clone -q -b feature-bind --single-branch https://github.com/rakshasa/rtorrent.git rtorrent-$rtvers
|
||||||
if [ "$OSNAME" = "Raspbian" ]; then
|
#else
|
||||||
./configure --prefix=/usr --disable-instrumentation >> /dev/null 2>&1
|
curl -LOJ# https://github.com/rakshasa/rtorrent-archive/raw/master/libtorrent-$libvers.tar.gz
|
||||||
else
|
tar -xzf libtorrent-$libvers.tar.gz
|
||||||
./configure --prefix=/usr >> /dev/null 2>&1
|
curl -LOJ# https://github.com/rakshasa/rtorrent-archive/raw/master/rtorrent-$rtvers.tar.gz
|
||||||
|
tar -xzf rtorrent-$rtvers.tar.gz
|
||||||
|
#fi
|
||||||
|
|
||||||
|
if [ $xmlrpc_repo = 0 ]; then
|
||||||
|
svn co $xmlrpcloc xmlrpc >> $logfile 2>&1
|
||||||
|
if [ ! -e xmlrpc ]; then
|
||||||
|
git clone $xmlrpc_url_alt xmlrpc >> $logfile 2>&1
|
||||||
|
cd xmlrpc/stable
|
||||||
|
else cd xmlrpc; fi
|
||||||
|
|
||||||
|
echo "Installing xmlrpc" | tee -a $logfile
|
||||||
|
./configure --prefix=/usr --disable-cplusplus >> $logfile 2>&1
|
||||||
|
make -j$(nproc) >> $logfile 2>&1
|
||||||
|
make -s install >> $logfile 2>&1
|
||||||
|
cd $home/source
|
||||||
fi
|
fi
|
||||||
make -j2 >> /dev/null 2>&1
|
|
||||||
make install >> /dev/null 2>&1
|
|
||||||
|
|
||||||
echo "Compiling rtorrent"
|
cd libtorrent-$libvers
|
||||||
cd $HOME/source/rtorrent-$rtvers
|
echo "Installing libtorrent" | tee -a $logfile
|
||||||
./autogen.sh >> /dev/null 2>&1
|
./autogen.sh >> $logfile 2>&1
|
||||||
./configure --prefix=/usr --with-xmlrpc-c >> /dev/null 2>&1
|
if [ $osname = "Raspbian" ]; then
|
||||||
make -j2 >> /dev/null 2>&1
|
./configure --prefix=/usr --disable-instrumentation >> $logfile 2>&1
|
||||||
make install >> /dev/null 2>&1
|
else
|
||||||
ldconfig
|
./configure --prefix=/usr >> $logfile 2>&1
|
||||||
|
fi
|
||||||
|
make -j$(nproc) >> $logfile 2>&1
|
||||||
|
make -s install >> $logfile 2>&1
|
||||||
|
|
||||||
cd /var/www/rutorrent/conf/users
|
cd ../rtorrent-$rtvers
|
||||||
user_list=*
|
echo "Installing rtorrent" | tee -a $logfile
|
||||||
|
./autogen.sh >> $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
|
||||||
|
|
||||||
for user in $user_list
|
|
||||||
do
|
if [ -d /var/www/rutorrent/conf/users ]; then
|
||||||
|
cd /var/www/rutorrent/conf/users
|
||||||
|
user_list=*
|
||||||
|
for user in $user_list; do
|
||||||
if [ ! "$user" = '*' ]; then
|
if [ ! "$user" = '*' ]; then
|
||||||
echo "Restarting rtorrent for $user"
|
echo "Restarting rtorrent for $user"
|
||||||
su $user -c 'rt restart >> /dev/null 2>&1'
|
su $user -c 'rt restart >> /dev/null 2>&1'
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo
|
||||||
cd $HOME
|
fi
|
||||||
|
|
||||||
echo
|
|
||||||
echo "$libvers/$rtvers installed"
|
|
||||||
echo
|
|
||||||
echo "Your .rtorrent.rc file, and download, watch, and .session directories have not been altered in any way"
|
|
||||||
|
|||||||
Executable
+57
@@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015 arakasi72 (https://github.com/arakasi72)
|
||||||
|
#
|
||||||
|
# --> Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
sourcedir='http://rtorrent.net/downloads/'
|
||||||
|
rt_latest=$(wget -q -O - $sourcedir | grep -o "rtorrent-[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}" | sort -uV | tail -1 | grep -o "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
|
||||||
|
ru_latest=$(curl -s https://raw.githubusercontent.com/Novik/ruTorrent/master/js/webui.js | grep -m 1 version: | cut -d \" -f2)
|
||||||
|
|
||||||
|
# checks if an application is installed
|
||||||
|
installed() {
|
||||||
|
hash $1 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( installed rtorrent ); then
|
||||||
|
rt_current=$(rtorrent -h | grep -om 1 "[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}")
|
||||||
|
echo "rtorrent installed: $rt_current"
|
||||||
|
echo "rtorrent available: $rt_latest"
|
||||||
|
else
|
||||||
|
echo "rtorrent: not installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ -d /var/www/rutorrent ]; then
|
||||||
|
ru_current=$(grep -m 1 version: /var/www/rutorrent/js/webui.js | cut -d \" -f2)
|
||||||
|
echo "RuTorrent installed: $ru_current"
|
||||||
|
echo "RuTorrent available: $ru_latest"
|
||||||
|
else
|
||||||
|
echo "RuTorrent: not installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "rtinst"
|
||||||
|
cd /etc/rtinst
|
||||||
|
branch=$(basename "$(git symbolic-ref -q HEAD)")
|
||||||
|
if [ -z $branch ]; then
|
||||||
|
branch=$(git describe --tags --exact-match)
|
||||||
|
echo "Current Release: rtinst $branch"
|
||||||
|
if [ ${branch:0:1} = v ]; then
|
||||||
|
latest=$(basename "$(git ls-remote --tags https://github.com/arakasi72/rtinst.git | grep -o 'refs/tags/v.*' | sort -V | tail -1)")
|
||||||
|
if [ $branch = $latest ]; then
|
||||||
|
echo "This is the latest release"
|
||||||
|
else
|
||||||
|
echo "Use rtsetup to update to rtinst $latest"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Current Branch: $branch"
|
||||||
|
echo "Use rtsetup to update branch"
|
||||||
|
fi
|
||||||
+3
-3
@@ -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"
|
||||||
@@ -20,8 +20,8 @@ if [ $(dpkg-query -W -f='${Status}' webmin 2>/dev/null | grep -c "ok installed")
|
|||||||
echo "Installing Webmin"
|
echo "Installing Webmin"
|
||||||
echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list
|
echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list
|
||||||
wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add -
|
wget -qO - http://www.webmin.com/jcameron-key.asc | apt-key add -
|
||||||
apt-get update >> /dev/null 2>&1
|
aptitude -q=5 update
|
||||||
apt-get -y install webmin >> /dev/null 2>&1
|
aptitude -q=5 -y install webmin
|
||||||
else
|
else
|
||||||
echo 'Webmin is already installed'
|
echo 'Webmin is already installed'
|
||||||
fi
|
fi
|
||||||
|
|||||||
+75
-24
@@ -14,19 +14,45 @@ newvers=$(curl -s https://raw.githubusercontent.com/Novik/ruTorrent/master/js/we
|
|||||||
oldvers=$(grep -m 1 version: /var/www/rutorrent/js/webui.js | cut -d \" -f2)
|
oldvers=$(grep -m 1 version: /var/www/rutorrent/js/webui.js | cut -d \" -f2)
|
||||||
|
|
||||||
ruflag=0
|
ruflag=0
|
||||||
|
rurelease=$(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
|
||||||
|
|
||||||
ask_option() {
|
ask_restore() {
|
||||||
while true
|
if [ $force_yes = 0 ]; then
|
||||||
do
|
return $restore_old
|
||||||
echo "1. Restore rutorrent_old"
|
else
|
||||||
echo "2. Upgrade to latest version"
|
while true
|
||||||
read -p "Select 1 or 2: " answer
|
do
|
||||||
case $answer in [1]* ) return 0 ;;
|
echo "1. Restore rutorrent_old"
|
||||||
[2]* ) return 1 ;;
|
echo "2. Upgrade to latest version"
|
||||||
|
read -p "Select 1 or 2: " answer
|
||||||
|
case $answer in [1]* ) return 0 ;;
|
||||||
|
[2]* ) return 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ask_version() {
|
||||||
|
if [ $force_yes = 0 ]; then
|
||||||
|
return $install_master
|
||||||
|
else
|
||||||
|
echo "Choose which build to install, (if you are not sure select 1)"
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
echo "1. Use the latest stable release"
|
||||||
|
echo "2. Use the most recent master build"
|
||||||
|
read -p "Select 1 or 2: " answer
|
||||||
|
case $answer in [1]* ) return 1 ;;
|
||||||
|
[2]* ) return 0 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
check_user() {
|
check_user() {
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
@@ -43,6 +69,21 @@ if [ "$(id -u)" != "0" ]; then
|
|||||||
echo "Must be run from root or using sudo" && exit 1
|
echo "Must be run from root or using sudo" && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# get options
|
||||||
|
OPTS=$(getopt -n "$0" -o myo --long "rutorrent-master,force-yes,restore-old" -- "$@")
|
||||||
|
|
||||||
|
eval set -- "$OPTS"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
-m | --rutorrent-master ) install_master=0; shift;;
|
||||||
|
-y | --force-yes ) force_yes=0; shift;;
|
||||||
|
-o | --restore-old ) restore_old=0; shift;;
|
||||||
|
-- ) shift; break ;;
|
||||||
|
* ) break ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
#check rutorrent folder exists
|
#check rutorrent folder exists
|
||||||
if ! [ -d '/var/www/rutorrent' ]; then
|
if ! [ -d '/var/www/rutorrent' ]; then
|
||||||
echo 'Could not find /var/www/rutorrent, exiting script'
|
echo 'Could not find /var/www/rutorrent, exiting script'
|
||||||
@@ -50,31 +91,33 @@ exit
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#check versions
|
#check versions
|
||||||
if [ '$newvers' = '$oldvers' ]; then
|
echo "Installed version: "$oldvers
|
||||||
echo "You have the latest version: "$newvers
|
echo " Latest version: "$newvers
|
||||||
else
|
|
||||||
echo "Installed version: "$oldvers
|
if [ -d $HOME'/rutorrent_old' ]; then
|
||||||
echo " Latest version: "$newvers
|
echo
|
||||||
|
echo "A previous backup is available to restore"
|
||||||
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ( check_user ); then
|
if [ $restore_old = 0 ] && ! [ -d $HOME'/rutorrent_old' ]; then
|
||||||
|
echo "No backup available to do a restore"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#check to see if rutorrent_old exists, offer restore or upgrade options
|
#check to see if rutorrent_old exists, offer restore or upgrade options
|
||||||
if [ -d $HOME'/rutorrent_old' ];then
|
if [ -d $HOME'/rutorrent_old' ];then
|
||||||
echo 'Detected '$HOME'/rutorrent_old'
|
echo 'Detected '$HOME'/rutorrent_old'
|
||||||
if ( ask_option ); then
|
if ( ask_restore ); then
|
||||||
echo "Restoring Old version of rutorrent"
|
echo "Restoring Old version of rutorrent"
|
||||||
echo "WARNING: The current rutorrent will be overwitten by older backup"
|
echo "WARNING: The current rutorrent will be overwitten by older backup"
|
||||||
ruflag=1
|
ruflag=1
|
||||||
if ( check_user ); then
|
if [ $force_yes = 0 ] || ( check_user ); then
|
||||||
echo "Restoring"
|
echo "Restoring"
|
||||||
rm -r /var/www/rutorrent
|
rm -r /var/www/rutorrent
|
||||||
mv -f $HOME/rutorrent_old /var/www/rutorrent
|
mv -f $HOME/rutorrent_old /var/www/rutorrent
|
||||||
echo "Setting permissions, Starting services"
|
echo "Setting permissions, Starting services"
|
||||||
chown -R www-data:www-data /var/www
|
chown -R www-data:www-data /var/www
|
||||||
chmod -R 755 /var/www/rutorrent
|
|
||||||
echo "Done"
|
echo "Done"
|
||||||
else
|
else
|
||||||
exit
|
exit
|
||||||
@@ -82,8 +125,8 @@ echo 'Detected '$HOME'/rutorrent_old'
|
|||||||
else
|
else
|
||||||
echo "Rutorrent will be upgraded"
|
echo "Rutorrent will be upgraded"
|
||||||
echo "WARNING: rutorrent_old will be deleted"
|
echo "WARNING: rutorrent_old will be deleted"
|
||||||
echo "If you wish to retain this older version you should exit this script, and rename or move it"
|
echo "If you wish to retain this older version you should exit this script, and rename or move it"
|
||||||
if ( check_user ); then
|
if [ $force_yes = 0 ] || ( check_user ); then
|
||||||
ruflag=0
|
ruflag=0
|
||||||
else
|
else
|
||||||
exit
|
exit
|
||||||
@@ -93,9 +136,13 @@ fi
|
|||||||
|
|
||||||
if [ $ruflag = 0 ]; then
|
if [ $ruflag = 0 ]; then
|
||||||
|
|
||||||
|
if ( ask_version ); then
|
||||||
|
rurelease=master
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -d $HOME'/rutorrent_old' ]; then
|
if [ -d $HOME'/rutorrent_old' ]; then
|
||||||
rm -r $HOME/rutorrent_old
|
rm -r $HOME/rutorrent_old
|
||||||
echo "rutorrent_old has been deleted"
|
echo "rutorrent_old has been deleted"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@@ -106,10 +153,13 @@ if [ $ruflag = 0 ]; then
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
mv -f /var/www/rutorrent $HOME/rutorrent_old
|
mv -f /var/www/rutorrent $HOME/rutorrent_old
|
||||||
|
echo "Installing Rutorrent ($rurelease)"
|
||||||
|
wget -q https://github.com/Novik/ruTorrent/archive/$rurelease.tar.gz
|
||||||
|
tar -xzf $rurelease.tar.gz
|
||||||
|
mv -f $(tar -tzf $rurelease.tar.gz | head -1) /var/www/rutorrent
|
||||||
|
rm $rurelease.tar.gz
|
||||||
|
|
||||||
echo "Installing Rutorrent "$newvers
|
git clone -q https://github.com/autodl-community/autodl-rutorrent.git /var/www/rutorrent/plugins/autodl-irssi
|
||||||
git clone https://github.com/Novik/ruTorrent.git /var/www/rutorrent >> /dev/null 2>&1
|
|
||||||
git clone https://github.com/autodl-community/autodl-rutorrent.git /var/www/rutorrent/plugins/autodl-irssi >> /dev/null 2>&1
|
|
||||||
|
|
||||||
rm -r /var/www/rutorrent/conf >> /dev/null 2>&1
|
rm -r /var/www/rutorrent/conf >> /dev/null 2>&1
|
||||||
cp -r $HOME/rutorrent_old/conf /var/www/rutorrent/conf >> /dev/null 2>&1
|
cp -r $HOME/rutorrent_old/conf /var/www/rutorrent/conf >> /dev/null 2>&1
|
||||||
@@ -117,5 +167,6 @@ if [ $ruflag = 0 ]; then
|
|||||||
cp -r $HOME/rutorrent_old/share /var/www/rutorrent/share >> /dev/null 2>&1
|
cp -r $HOME/rutorrent_old/share /var/www/rutorrent/share >> /dev/null 2>&1
|
||||||
echo "Setting permissions, Starting services"
|
echo "Setting permissions, Starting services"
|
||||||
chown -R www-data:www-data /var/www
|
chown -R www-data:www-data /var/www
|
||||||
chmod -R 755 /var/www/rutorrent
|
echo
|
||||||
|
echo "Installation of RuTorrent complete"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user