Skip to content

Commit 12a7181

Browse files
committed
improved preinstall validation
1 parent 9e8dec0 commit 12a7181

File tree

2 files changed

+59
-16
lines changed

2 files changed

+59
-16
lines changed

install/vst-install-ubuntu.sh

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ export DEBIAN_FRONTEND=noninteractive
1010
RHOST='apt.vestacp.com'
1111
CHOST='c.vestacp.com'
1212
VERSION='0.9.8/ubuntu'
13-
if [ "$(arch)" != 'x86_64' ]; then
14-
arch='i386'
15-
else
16-
arch="amd64"
17-
fi
18-
os=$(head -n 1 /etc/issue | cut -f 1 -d ' ')
19-
release=$(head -n 1 /etc/issue | cut -f 2 -d ' ' )
20-
codename=$(lsb_release -cs)
21-
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
2213
software="nginx apache2 apache2-utils apache2.2-common apache2-suexec-custom
2314
libapache2-mod-ruid2 libapache2-mod-rpaf libapache2-mod-fcgid bind9 idn
2415
mysql-server mysql-common mysql-client php5-common php5-cgi php5-mysql
@@ -90,11 +81,43 @@ if [ -e '/etc/redhat-release' ]; then
9081
fi
9182

9283
# Check supported OS
84+
if [ "$(arch)" != 'x86_64' ]; then
85+
arch='i386'
86+
else
87+
arch="amd64"
88+
fi
89+
os=$(head -n 1 /etc/issue | cut -f 1 -d ' ')
90+
release=$(head -n 1 /etc/issue | cut -f 2 -d ' ' )
91+
if [ -e "/usr/bin/lsb_release" ]; then
92+
codename=$(lsb_release -cs)
93+
else
94+
codename='unknown'
95+
fi
9396
if [ $codename != 'precise' ] && [ $codename != 'raring' ]; then
9497
echo 'Error: only Ubuntu LTS 12.04 and Ubuntu 13.04 is supported'
9598
exit 1
9699
fi
97100

101+
# Check admin user account
102+
if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ "$force" != 'yes' ]; then
103+
echo "Error: user admin exists"
104+
echo
105+
echo 'Please remove admin user account before proceeding.'
106+
echo 'If you want to do it automatically run installer with -f option:'
107+
echo "Example: bash $0 --force"
108+
exit 1
109+
fi
110+
111+
# Check admin user account
112+
if [ ! -z "$(grep ^admin: /etc/group)" ] && [ "$force" != 'yes' ]; then
113+
echo "Error: user admin exists"
114+
echo
115+
echo 'Please remove admin user account before proceeding.'
116+
echo 'If you want to do it automatically run installer with -f option:'
117+
echo "Example: bash $0 --force"
118+
exit 1
119+
fi
120+
98121
# Check wget
99122
if [ ! -e '/usr/bin/wget' ]; then
100123
apt-get -y install wget
@@ -136,6 +159,7 @@ if [ ! -z "$conflicts" ] && [ -z "$force" ]; then
136159
fi
137160

138161
# Check server type
162+
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
139163
if [ "$memory" -lt '350000' ] && [ -z "$force" ]; then
140164
echo "Error: not enough memory to install Vesta Control Panel."
141165
echo -e "\nMinimum RAM required: 350Mb"

install/vst-install.sh

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Vesta installer v.03
3+
# Vesta RHEL/CentOS installer v.03
44

55
#----------------------------------------------------------#
66
# Variables&Functions #
@@ -11,11 +11,6 @@ CHOST='c.vestacp.com'
1111
REPO='cmmnt'
1212
VERSION='0.9.8/rhel'
1313
YUM_REPO='/etc/yum.repos.d/vesta.repo'
14-
arch=$(uname -i)
15-
os=$(cut -f 1 -d ' ' /etc/redhat-release)
16-
release=$(grep -o "[0-9]" /etc/redhat-release |head -n1)
17-
codename="${os}_$release"
18-
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
1914
software="nginx httpd mod_ssl mod_ruid2 mod_extract_forwarded mod_fcgid
2015
php php-bcmath php-cli php-common php-gd php-imap php-mbstring php-mcrypt
2116
php-mysql php-pdo php-soap php-tidy php-xml php-xmlrpc php-pecl-apc
@@ -25,7 +20,6 @@ software="nginx httpd mod_ssl mod_ruid2 mod_extract_forwarded mod_fcgid
2520
ImageMagick sqlite pcre sudo bc jwhois mailx lsof tar telnet rsync
2621
rrdtool GeoIP freetype ntp openssh-clients vesta vesta-nginx vesta-php"
2722

28-
2923
help() {
3024
echo "usage: $0 [OPTIONS]
3125
-d, --disable-remi Disable remi
@@ -92,10 +86,34 @@ if [ ! -e '/etc/redhat-release' ]; then
9286
fi
9387

9488
# Check supported OS
89+
arch=$(uname -i)
90+
os=$(cut -f 1 -d ' ' /etc/redhat-release)
91+
release=$(grep -o "[0-9]" /etc/redhat-release |head -n1)
92+
codename="${os}_$release"
9593
if [ $os != 'CentOS' ] && [ $os != 'Red' ]; then
9694
echo 'Error: sorry, we currently support RHEL and CentOS only'
9795
fi
9896

97+
# Check admin user account
98+
if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ "$force" != 'yes' ]; then
99+
echo "Error: user admin exists"
100+
echo
101+
echo 'Please remove admin user account before proceeding.'
102+
echo 'If you want to do it automatically run installer with -f option:'
103+
echo "Example: bash $0 --force"
104+
exit 1
105+
fi
106+
107+
# Check admin user account
108+
if [ ! -z "$(grep ^admin: /etc/group)" ] && [ "$force" != 'yes' ]; then
109+
echo "Error: user admin exists"
110+
echo
111+
echo 'Please remove admin user account before proceeding.'
112+
echo 'If you want to do it automatically run installer with -f option:'
113+
echo "Example: bash $0 --force"
114+
exit 1
115+
fi
116+
99117
# Check wget
100118
if [ ! -e '/usr/bin/wget' ]; then
101119
yum -y install wget
@@ -137,6 +155,7 @@ if [ ! -z "$conflicts" ] && [ -z "$force" ]; then
137155
fi
138156

139157
# Check server type
158+
memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
140159
if [ "$memory" -lt '350000' ] && [ -z "$force" ]; then
141160
echo "Error: not enough memory to install Vesta Control Panel."
142161
echo -e "\nMinimum RAM required: 350Mb"

0 commit comments

Comments
 (0)