mirror of
https://github.com/elisspace/rtinst.git
synced 2026-08-30 16:12:12 +00:00
67 lines
2.9 KiB
Bash
67 lines
2.9 KiB
Bash
#!/bin/bash
|
|
|
|
######################################################################
|
|
#
|
|
# Copyright (c) 2015 arakasi72 (https://github.com/arakasi72)
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
#
|
|
# --> 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
|
|
|
|
script_list=($(curl -s https://raw.githubusercontent.com/arakasi72/rtinst/master/script_list))
|
|
|
|
rt_get_scripts() {
|
|
local script_name=$1
|
|
local attempts=0
|
|
local script_size=0
|
|
local bindest="/usr/local/bin"
|
|
|
|
while [ $script_size = 0 ]
|
|
do
|
|
rm -f /usr/local/bin/$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 -q --no-check-certificate --output-document=/usr/local/bin/$script_name https://raw.githubusercontent.com/arakasi72/rtinst/master/$script_name
|
|
script_size=$(du -b /usr/local/bin/$script_name | cut -f1)
|
|
done
|
|
|
|
chmod 755 /usr/local/bin/$script_name
|
|
|
|
}
|
|
|
|
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
|
|
|
|
for i in "${script_list[@]}"
|
|
do
|
|
rt_get_scripts $i
|
|
done
|
|
|
|
echo "Completed scripts download"
|
|
|
|
if [ -f $HOME/rtgetscripts ]; then
|
|
rm -f $HOME/rtgetscripts
|
|
fi
|