forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvst-install.sh
More file actions
109 lines (95 loc) · 2.45 KB
/
vst-install.sh
File metadata and controls
109 lines (95 loc) · 2.45 KB
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
#!/bin/bash
# Vesta installation wrapper
# http://vestacp.com
# Am I root?
if [ "x$(id -u)" != 'x0' ]; then
echo 'Error: this script can only be executed by root'
exit 1
fi
# Check admin user account
if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ -z "$1" ]; then
echo "Error: user admin exists"
echo
echo 'Please remove admin user account before proceeding.'
echo 'If you want to do it automatically run installer with -f option:'
echo "Example: bash $0 --force"
exit 1
fi
# Check admin user account
if [ ! -z "$(grep ^admin: /etc/group)" ] && [ -z "$1" ]; then
echo "Error: group admin exists"
echo
echo 'Please remove admin user account before proceeding.'
echo 'If you want to do it automatically run installer with -f option:'
echo "Example: bash $0 --force"
exit 1
fi
# Check OS type
if [ -e '/etc/redhat-release' ]; then
type="rhel"
fi
if [ -e '/etc/lsb-release' ] && [ -e '/etc/debian_version' ]; then
type="ubuntu"
fi
if [ -z "$type" ]; then
os=$(head -n1 /etc/issue | cut -f 1 -d ' ')
if [ "$os" == 'Debian' ]; then
type="debian"
fi
fi
# Check type
if [ -z "$type" ]; then
echo 'Error: only RHEL,CentOS, Ubuntu LTS and Debian 7 is supported'
exit 1
fi
# Check wget
if [ -e '/usr/bin/wget' ]; then
wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
if [ "$?" -eq '0' ]; then
bash vst-install-$type.sh $*
exit
else
echo "Error: vst-install-$type.sh download failed."
exit 1
fi
fi
# Check curl
if [ -e '/usr/bin/curl' ]; then
curl -O http://vestacp.com/pub/vst-install-$type.sh
if [ "$?" -eq '0' ]; then
bash vst-install-$type.sh $*
exit
else
echo "Error: vst-install-$type.sh download failed."
exit 1
fi
fi
# Let's try to install wget automaticaly
if [ "$type" = 'rhel' ]; then
yum -y install wget
if [ $? -ne 0 ]; then
echo "Error: can't install wget"
exit 1
fi
else
apt-get -y install wget
if [ $? -ne 0 ]; then
echo "Error: can't install wget"
exit 1
fi
fi
# OK, last try
if [ -e '/usr/bin/wget' ]; then
wget http://vestacp.com/pub/vst-install-$type.sh -O vst-install-$type.sh
if [ "$?" -eq '0' ]; then
bash vst-install-$type.sh $*
exit
else
echo "Error: vst-install-$type.sh download failed."
exit 1
fi
else
echo "Error: /usr/bin/wget not found"
exit 1
fi
exit