forked from arakasi72/rtinst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtgetscripts
52 lines (46 loc) · 1.7 KB
/
rtgetscripts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin
get_scripts() {
local script_name=$1
local script_dest=$2
local attempts=0
local script_size=0
local bindest="/usr/local/bin"
while [ $script_size = 0 ]
do
rm -f $script_name
attempts=$(( $attempts + 1 ))
if [ $attempts = 20 ]; then
echo "There is a problem downloading the scripts. Please check your network or there may be an issue with the github website"
echo "If the Github website is down, you can try again later"
exit 1
fi
wget --no-check-certificate https://raw.githubusercontent.com/arakasi72/rtinst/master/$script_name
script_size=$(du -b $script_name | cut -f1)
done
if ! [ -z "$script_dest" ]; then
mv -f $script_name $script_dest
if case $script_dest in *"${bindest}"*) true;; *) false;; esac; then
chmod 755 $script_dest
fi
fi
}
if [ -z "$SUDO_USER" -a "$LOGNAME" != "root" ]; then
echo "Must be run from root or using sudo" && exit 1
fi
if [ -f "/var/www/rutorrent/.htpasswd" ]; then
mv /var/www/rutorrent/.htpasswd /etc/nginx
chown www-data:www-data /etc/nginx/.htpasswd
chmod 640 /etc/nginx/.htpasswd
sed -i 's/\/var\/www\/rutorrent\/\.htpasswd/\/etc\/nginx\/\.htpasswd/g' /etc/nginx/sites-available/default
sed -i 's/\/var\/www\/rutorrent\/\.htpasswd/\/etc\/nginx\/\.htpasswd/g' /etc/nginx/conf.d/rtdload
service nginx reload
fi
get_scripts rt /usr/local/bin/rt
get_scripts rtcheck /usr/local/bin/rtcheck
get_scripts rtupdate /usr/local/bin/rtupdate
get_scripts rtpass /usr/local/bin/rtpass
get_scripts rtsetpass /usr/local/bin/rtsetpass
get_scripts rtdload /usr/local/bin/rtdload
get_scripts rtadduser /usr/local/bin/rtadduser
get_scripts rtremove /usr/local/bin/rtremove