-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathinstall.sh
142 lines (122 loc) · 5.32 KB
/
install.sh
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
#
# https://github.com/Aniverse/qbittorrent-nox-static
# Author: Aniverse
script_update=2020.05.11
script_version=r10011
################################################################################################
usage_guide() {
yum install -y nano # wget
pacman -S --noconfirm nano # wget
s=$HOME/install.sh;rm -f $s;nano $s;chmod 755 $s
bash $HOME/install.sh -u aaa -p bbb -w 2018 -i 9003
bash <(wget -qO- --no-check-certificate https://github.com/Aniverse/qbittorrent-nox-static/raw/master/install.sh -o /dev/null) -u aniverse -p test123
bash <(curl -Ls https://github.com/Aniverse/qbittorrent-nox-static/raw/master/install.sh) -u aniverse -p test123
}
################################################################################################
function show_usage() { echo "
$AppName $pm_action $script_version ($script_update)
Usage:
-u Username for qBittorrent
-p Password for qBittorrent WebUI
-w WebUI port for qBittorrent
-i Incoming port for qBittorrent
-v Specify qBittorrent version
available version:
4.1.9.lt.1.1.14
4.2.3.lt.1.1.14
4.2.3.lt.1.2.5
4.2.4.lt.1.1.14
4.2.5.lt.1.2.6
"
exit 1 ; }
OPTS=$(getopt -a -o u:p:w:i:h:l:v:dh --long "username:,password:,home:,wport:,iPort:,lang:,logbase:,version:,debug,shared,log,help" -- "$@")
[ ! $? = 0 ] && show_usage
eval set -- "$OPTS"
while true; do
case "$1" in
-u | --username ) iUser="$2" ; shift 2 ;;
-p | --password ) iPass="$2" ; shift 2 ;;
-h | --home ) iHome="$2" ; shift 2 ;;
-w | --wport ) wPort="$2" ; shift 2 ;;
-i | --iPort ) iPort="$2" ; shift 2 ;;
-v | --version ) qbver="$2" ; shift 2 ;;
-d | --debug ) debug=1 ; shift ;;
-h | --help ) show_usage ; exit 0 ; shift ;;
--log ) show_log=1 ; shift ;;
--logbase ) LogTimes="$2" ; shift 2 ;;
--shared ) shared=1 ; shift ;;
-- ) shift 2 ; break ;;
* ) break ;;
esac
done
[[ -z $iUser ]] && echo -e "Please set your username by using -u <username>" && exit 1
[[ -z $iPass ]] && echo -e "Please set your password by using -p <password>" && exit 1
[[ -z $wPort ]] && wPort=2017
[[ -z $iPort ]] && iPort=9002
[[ -z $qbver ]] && qbver=4.2.3.lt.1.1.14
################################################################################################
if [[ $EUID != 0 ]]; then
Root=0
shared=1
BinPath=$HOME/.local/bin
mkdir -p $BinPath
else
Root=1
BinPath=/usr/bin
fi
AppName=qBittorrent
AppNameLower=qbittorrent
AppCmd=qbittorrent-nox
AppExec="${BinPath}/${AppCmd}"
if [[ -n $(command -v wget) ]]; then
source <(wget -qO- --no-check-certificate https://github.com/Aniverse/inexistence/raw/master/00.Installation/function)
source <(wget -qO- --no-check-certificate https://github.com/Aniverse/inexistence/raw/master/00.Installation/check-sys)
serverip=$(wget --no-check-certificate -t1 -T6 -qO- v4.ipv6-test.com/api/myip.php)
elif [[ -n $(command -v curl) ]]; then
source <(curl -Ls https://github.com/Aniverse/inexistence/raw/master/00.Installation/function)
source <(curl -Ls https://github.com/Aniverse/inexistence/raw/master/00.Installation/check-sys)
serverip=$(curl -s v4.ipv6-test.com/api/myip.php)
fi
set_variables_log_location
check_var_OutputLOG
################################################################################################
if [[ -z $(command -v wget) ]]; then
echo -n "Installing wget ... "
pm_action install wget >> $OutputLOG 2>&1
echo -e " ${green}${bold}DONE${normal}"
fi
function install_qbittorrent_nox_static(){
wget --no-check-certificate https://sourceforge.net/projects/inexistence/files/qbittorrent/qbittorrent-nox.${qbver}/download -O $AppExec >> $OutputLOG 2>&1
chmod +x $AppExec >> $OutputLOG 2>&1
status_lock=$AppName
echo "status_lock=$status_lock" > $tmp_dir/Variables
rm -f $tmp_dir/$status_lock.1.lock $tmp_dir/$status_lock.2.lock
[[ -x $AppExec ]] && touch $tmp_dir/$status_lock.1.lock || $tmp_dir/$status_lock.2.lock
}
function configure_qbittorrent_nox(){
if [[ $Root == 1 ]]; then
if [[ $os =~ (debian|ubuntu) ]]; then
adduser --gecos "" $iUser --disabled-password --force-badname >> $OutputLOG 2>&1
elif [[ $os == archlinux ]]; then
useradd $iUser -m >> $OutputLOG 2>&1
elif [[ $os == centos ]]; then
adduser $iUser >> $OutputLOG 2>&1
else
useradd $iUser -m >> $OutputLOG 2>&1
fi
# echo "$iUser:$iPass" | chpasswd >> $OutputLOG 2>&1
bash <(wget -qO- --no-check-certificate https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/qbittorrent/configure -o /dev/null) -u $iUser -p $iPass -w $wPort -i $iPort
echo -e "\n${cyan}qBittorrent WebUI${normal} http://$serverip:$wPort\n"
else
wget --no-check-certificate https://github.com/Aniverse/inexistence/raw/master/00.Installation/package/qbittorrent/configure -O ${BinPath}/qbconf >> $OutputLOG 2>&1
chmod +x ${BinPath}/qbconf
fi
}
################################################################################################
if [[ ! -x $AppExec ]] ; then
echo_task "Installing $AppName ..."
install_qbittorrent_nox_static & spinner $!
check_status $status_lock
fi
configure_qbittorrent_nox