-
Notifications
You must be signed in to change notification settings - Fork 30
/
install-before
128 lines (108 loc) · 4.16 KB
/
install-before
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
#!/bin/sh
#
kiemtraemail3="^(([-a-zA-Z0-9\!#\$%\&\'*+/=?^_\`{\|}~])+\.)*[-a-zA-Z0-9\!#\$%\&\'*+/=?^_\`{\|}~]+@\w((-|\w)*\w)*\.(\w((-|\w)*\w)*\.)*\w{2,24}$";
#
clear
#
echo "=========================================================================="
echo "--------------------------------------------------------------------------"
echo "Thiet lap thong tin cai dat/ Setup installation information:"
echo "--------------------------------------------------------------------------"
#
echo -n "Enter phpMyAdmin Port number (1000 - 65535): "
read svport
if [ "$svport" = "80" ] || [ "$svport" = "443" ] || [ "$svport" = "22" ] || [ "$svport" = "3306" ] || [ "$svport" = "25" ] || [ "$svport" = "465" ] || [ "$svport" = "587" ] || [ "$svport" = "21" ]; then
svport="1241"
echo "phpMyAdmin khong the trung voi port cua dich vu khac!"
echo "ECHBAY-VPSSIM dat phpMyAdmin port mac dinh la: "$svport
echo "--------------------------------------------------------------------------"
echo "phpMyAdmin cannot match the port of another service!"
echo "phpMyAdmin port default set is: "$svport
sleep 5
fi
if [ "$svport" = "" ] ; then
clear
echo "=========================================================================="
echo "phpMyAdmin Port number khong duoc de trong!"
echo "Ban hay kiem tra lai..."
echo "--------------------------------------------------------------------------"
echo "phpMyAdmin Port number can't be empty!"
echo "Please check again..."
bash /root/vpssim-setup
exit
fi
if ! [[ $svport -ge 1000 && $svport -le 65535 ]] ; then
clear
echo "=========================================================================="
echo "$svport khong hop le!"
echo "Port hop le la so tu nhien nam trong khoang (1000 - 65535)."
echo "Ban hay kiem tra lai..."
echo "--------------------------------------------------------------------------"
echo "$svport invalid!"
echo "Port is an integer in the range (1000 - 65535)"
echo "Please check again..."
echo "-------------------------------------------------------------------------"
read -p "Nhan [Enter] de tiep tuc (Press [Enter] to continue)..."
clear
bash /root/vpssim-setup
exit
fi
#
echo "--------------------------------------------------------------------------"
echo -n "Enter admin email: "
read vpssimemail
if [ "$vpssimemail" = "" ]; then
clear
echo "=========================================================================="
echo "Admin email khong duoc de trong!"
echo "Ban hay kiem tra lai..."
echo "--------------------------------------------------------------------------"
echo "Admin email can't be empty!"
echo "Please check again..."
echo "-------------------------------------------------------------------------"
read -p "Nhan [Enter] de tiep tuc (Press [Enter] to continue)..."
clear
bash /root/vpssim-setup
exit
fi
if [[ ! "$vpssimemail" =~ $kiemtraemail3 ]]; then
clear
echo "=========================================================================="
echo "Email $vpssimemail khong dung dinh dang!"
echo "Ban hay kiem tra lai..."
echo "--------------------------------------------------------------------------"
echo "Email $vpssimemail incorrect format is supported!"
echo "Please check again..."
echo "-------------------------------------------------------------------------"
read -p "Nhan [Enter] de tiep tuc (Press [Enter] to continue)..."
clear
bash /root/vpssim-setup
exit
fi
#
svip=$(wget https://cloud.echbay.com/plains/ip -O - -q ; echo)
cpuname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo )
cpucores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
cpufreq=$( awk -F: ' /cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo )
#svram=$( free -m | awk 'NR==2 {print $2}' )
svram=$( free -m | awk '/Mem:/ {print $2}' )
#svhdd=$( df -h | awk 'NR==2 {print $2}' )
svhdd=$( df -h | awk '/\/dev\/sda/ {print $2}' )
#svswap=$( free -m | awk 'NR==3 {print $2}' )
svswap=$( free -m | awk '/Swap:/ {print $2}' )
checktruenumber='^[0-9]+$'
#
#rm -f /tmp/vpssim.conf
cat > "/tmp/vpssim.conf" <<END
svport="$svport"
vpssimemail="$vpssimemail"
cpuname="$cpuname"
cpucores="$cpucores"
cpufreq="$cpufreq"
svram="$svram"
svhdd="$svhdd"
svswap="$svswap"
svip="$svip"
checktruenumber="$checktruenumber"
END
chmod +x /tmp/vpssim.conf