-
Notifications
You must be signed in to change notification settings - Fork 405
/
Copy pathappex.sh
170 lines (159 loc) · 4.63 KB
/
appex.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/bin/bash
function Welcome()
{
cd /root
clear
printf " Service Time : " && date -R
echo " ======================================================";
echo " | serverSpeeder |";
echo " | Debian 7 |";
echo " | 3.2.0-4 |";
echo " |----------------------------------------------------|";
echo " | -- By .Vicer |";
echo " ======================================================";
echo "";
}
function rootness()
{
if [[ $EUID -ne 0 ]]; then
echo "Error:This script must be run as root!" 1>&2
exit 1
fi
}
function pause()
{
echo "";
read -n 1 -p "Press Enter to Continue..." INP
if [ "$INP" != '' ] ; then
echo -ne '\b \n'
echo "";
fi
}
function Clear()
{
chattr -R -i /appex >/dev/null 2>&1
chattr -R -i /serverSpeeder >/dev/null 2>&1
rm -rf /appex >/dev/null 2>&1
rm -rf /serverSpeeder >/dev/null 2>&1
sed -i '/deb cdrom/'d /etc/apt/sources.list
sed -i '/^$/'d /etc/apt/sources.list
}
function ServerIP()
{
serverip=$(wget -qO- ipv4.icanhazip.com)
printf "Default Server IP: \e[36m$serverip\e[0m .\nIf Default Server IP \e[31mcorrect\e[0m, Press Enter .\nIf Default Server IP \e[31mincorrect\e[0m, Please input Server IP :"
read serveriptmp
if [[ -n "$serveriptmp" ]]; then
serverip=$serveriptmp
fi
printf "Server IP: \e[35m$serverip\e[0m .\n";
ETHER;
if [[ "$sysOVZ" == "yes" ]]; then
echo "Your server NOT support serverSpeeder! "
pause;
exit 1
elif [[ "$sysOVZ" == "no" ]]; then
MyKernel=`uname -r| grep -E "3.2.0-4-amd64|3.2.0-4-686-pae"`
if [[ $MyKernel == "" ]]; then
echo "Your server NOT support $0! "
pause;
exit 1
fi fi
}
function ETHER()
{
ETH=`ifconfig |awk '/venet/{ print $1 }' |sed -n '1p'`;
if [[ "$ETH" == "venet0" ]]; then
Eth="venet0";
sysOVZ="yes";
else
ETH=`ifconfig |awk '/eth/{ print $1 }' |sed -n '1p'`;
if [[ "$ETH" == "eth1" ]]; then
Eth="eth1";
sysOVZ="no";
elif [[ "$ETH" == "eth0" ]]; then
Eth="eth0";
sysOVZ="no";
fi fi
}
function SelectKernel()
{
if [[ $MyKernel == "3.2.0-4-686-pae" ]]; then
wget --no-check-certificate -q -O "/root/appex/apxfiles/bin/acce-3.10.61.0-[Debian_7_3.2.0-4-686-pae]" "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_kernel/master/Debian/7/3.2.0-4-686-pae/x32/3.10.61.0/serverspeeder_2623"
fi
if [[ $MyKernel == "3.2.0-4-amd64" ]]; then
wget --no-check-certificate -q -O "/root/appex/apxfiles/bin/acce-3.10.61.0-[Debian_7_3.2.0-4-amd64]" "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_kernel/master/Debian/7/3.2.0-4-amd64/x64/3.10.61.0/serverspeeder_2626"
fi
}
function dl-Lic()
{
chattr -R -i /appex >/dev/null 2>&1
rm -rf /appex >/dev/null 2>&1
mkdir -p /appex/etc
MAC=`ifconfig $Eth | awk '/HWaddr/{ print $5 }'`
wget --no-check-certificate -q -O /appex/etc/apx.lic "http://serverspeeder.azurewebsites.net/lic?mac=$MAC"
SIZE=`du -b /appex/etc/apx.lic |awk '{ print $1 }'`
if [[ $SIZE == '0' ]]; then
echo "Lic download error, try again! "
echo "Please wait..."
sleep 7;
dl-Lic;
else
echo "Lic download success! "
chattr +i /appex/etc/apx.lic
Install-serverspeeder;
fi
}
function ServerSpeeder()
{
if [[ `which unzip` == "" ]]; then
apt-get update
apt-get install -y unzip zip
fi
wget --no-check-certificate -q -O /root/appex.zip https://raw.githubusercontent.com/0oVicero0/serverSpeeser_Install/master/appex.zip
mkdir -p /root/appex
unzip -o -d /root/appex /root/appex.zip
SelectKernel;
APXEXE=`du -a /root/appex/apxfiles/bin |awk -F "/" '/acce/{ print $6 }'`
sed -i "s/^apxexe\=.*/apxexe\=\"\/appex\/bin\/$APXEXE\"/" /root/appex/apxfiles/etc/config
HOSTS=`cat /etc/hosts | grep 'dl.serverspeeder.com' | awk '{print $1}'`
if [[ "$HOSTS" != $serverip ]]; then
echo " " >> /etc/hosts
echo "$serverip $serverip dl.serverspeeder.com" >> /etc/hosts
fi
HOSTS=`cat /etc/hosts | grep 'my.serverspeeder.com' | awk '{print $1}'`
if [[ "$HOSTS" != "127.0.0.1" ]]; then
echo "127.0.0.1 my.serverspeeder.com" >> /etc/hosts
fi
HOSTS=`cat /etc/hosts | grep 'www.serverspeeder.com' | awk '{print $1}'`
if [[ "$HOSTS" != "127.0.0.1" ]]; then
echo "127.0.0.1 www.serverspeeder.com" >> /etc/hosts
fi
dl-Lic;
}
function Install-ethtool()
{
ethtooldir=`which ethtool`
if [[ "$ethtooldir" != "" ]]; then
rm -rf /appex/bin/ethtool >/dev/null 2>&1
mkdir -p /appex/bin
cp -f $ethtooldir /appex/bin
chmod -R +X /appex >/dev/null 2>&1
else
apt-get install -y -qq ethtool >/dev/null 2>&1
Install-ethtool;
fi
}
function Install-serverspeeder()
{
Install-ethtool;
bash /root/appex/install.sh
}
Welcome;
rootness;
Clear;
ServerIP;
ServerSpeeder;
rm -rf /root/appex* >/dev/null 2>&1
clear
bash /appex/bin/serverSpeeder.sh status