Skip to content

Commit 4cc3c1d

Browse files
author
Serghey Rodin
committed
Amazon linux support
1 parent 26c311b commit 4cc3c1d

12 files changed

+34
-31
lines changed

bin/v-add-sys-ip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ if [ -z "$sys_ip_check" ]; then
6060
/sbin/ip addr add $ip/$cidr dev $interface \
6161
broadcast $broadcast label $iface
6262

63-
# Adding RHEL/CentOS/Fedora startup script
64-
if [ -e "/etc/redhat-release" ]; then
63+
# Adding RHEL/CentOS/Fedora/Amazon startup script
64+
if [ -d "/etc/sysconfig" ]; then
6565
sys_ip="# Added by vesta"
6666
sys_ip="$sys_ip\nDEVICE=$iface"
6767
sys_ip="$sys_ip\nBOOTPROTO=static"

bin/v-add-sys-quota

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ source $VESTA/conf/vesta.conf
2121
# Checking quota package
2222
quota=$(which --skip-alias --skip-functions quota 2>/dev/null)
2323
if [ $? -ne 0 ]; then
24-
if [ -e "/etc/redhat-release" ]; then
24+
if [ -d "/etc/sysconfig" ]; then
2525
yum -y install quota >/dev/null 2>&1
2626
check_result $? "quota package installation failed" $E_UPDATE
2727
else

bin/v-add-vesta-softaculous

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fi
4646
#----------------------------------------------------------#
4747

4848
# Cleaning yum cache
49-
if [ -e "/etc/redhat-release" ]; then
49+
if [ -d "/etc/sysconfig" ]; then
5050
yum -q clean all
5151
yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta"
5252
else
@@ -57,7 +57,7 @@ fi
5757

5858
# Updating php pacakge
5959
if [ -z "$($VESTA/php/bin/php -v|grep 'PHP 5.6')" ]; then
60-
if [ -e "/etc/redhat-release" ]; then
60+
if [ -d "/etc/sysconfig" ]; then
6161
$yum -y update vesta-php
6262
check_result $? "vesta-php package upgrade failed" $E_UPDATE
6363
else
@@ -67,7 +67,7 @@ if [ -z "$($VESTA/php/bin/php -v|grep 'PHP 5.6')" ]; then
6767
fi
6868

6969
# Adding vesta-ioncube package
70-
if [ -e "/etc/redhat-release" ]; then
70+
if [ -d "/etc/sysconfig" ]; then
7171
rpm -q vesta-ioncube >/dev/null 2>&1
7272
if [ $? -ne 0 ]; then
7373
$yum -y install vesta-ioncube >/dev/null 2>&1
@@ -82,7 +82,7 @@ else
8282
fi
8383

8484
# Adding vesta-softaculous package
85-
if [ -e "/etc/redhat-release" ]; then
85+
if [ -d "/etc/sysconfig" ]; then
8686
rpm -q vesta-softaculous >/dev/null 2>&1
8787
if [ $? -ne 0 ]; then
8888
$yum -y install vesta-softaculous >/dev/null 2>&1

bin/v-change-sys-hostname

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,16 @@ is_format_valid 'domain'
3131

3232
hostname $domain
3333

34-
# RHEL/CentOS
35-
if [ -e "/etc/redhat-release" ]; then
34+
if [ -d "/etc/sysconfig" ]; then
35+
# RHEL/CentOS/Amazon
3636
touch /etc/sysconfig/network
3737
if [ -z "$(grep HOSTNAME /etc/sysconfig/network)" ]; then
3838
echo "HOSTNAME='$domain'" >> /etc/sysconfig/network
3939
else
4040
sed -i "s/HOSTNAME=.*/HOSTNAME='$domain'/" /etc/sysconfig/network
4141
fi
42-
fi
43-
44-
# Debian/Ubuntu
45-
if [ ! -e "/etc/redhat-release" ]; then
42+
else
43+
# Debian/Ubuntu
4644
echo "$domain" > /etc/hostname
4745
fi
4846

bin/v-list-sys-info

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ csv_list() {
5656
HOSTNAME=$(hostname)
5757

5858
# Check OS/Release
59-
if [ -e '/etc/redhat-release' ]; then
60-
if [ ! -z "$(grep CentOS /etc/redhat-release)" ]; then
59+
if [ -d '/etc/sysconfig' ]; then
60+
if [ -e '/etc/redhat-release' ]; then
6161
OS='CentOS'
62+
VERSION=$(cat /etc/redhat-release |tr ' ' '\n' |grep [0-9])
6263
else
63-
OS="RHEL"
64+
OS="Amazon"
65+
VERSION=$(cat /etc/issue |tr ' ' '\n' |grep [0-9])
6466
fi
65-
VERSION=$(cat /etc/redhat-release| tr ' ' '\n' |grep [0-9])
6667
else
6768
if [ "$(lsb_release -si)" == "Ubuntu" ] && [ -e '/etc/debian_version' ]; then
6869
OS="Ubuntu"
69-
VERSION=$(grep DISTRIB_RELEASE /etc/lsb-release| cut -f 2 -d '=')
70+
VERSION=$(grep DISTRIB_RELEASE /etc/lsb-release |cut -f 2 -d '=')
7071
else
7172
distro=$(head -n1 /etc/issue |cut -f 1 -d ' ')
7273
if [ "$distro" = 'Debian' ]; then

bin/v-list-sys-services

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ fi
191191

192192
# Checking MAIL ANTIVIRUS
193193
if [ ! -z "$ANTIVIRUS_SYSTEM" ] && [ "$ANTIVIRUS_SYSTEM" != 'remote' ]; then
194-
if [ -e "/etc/redhat-release" ]; then
194+
if [ -d "/etc/sysconfig" ]; then
195195
if [ "$ANTIVIRUS_SYSTEM" == 'clamav' ];then
196196
ANTIVIRUS_SYSTEM='clamd'
197197
fi
@@ -220,7 +220,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'remote' ]; then
220220
proc_name=''
221221
service="$db"
222222
if [ "$service" = 'mysql' ]; then
223-
if [ -e "/etc/redhat-release" ]; then
223+
if [ -d "/etc/sysconfig" ]; then
224224
service='mysqld'
225225
proc_name='mysqld'
226226
if [ -e "/usr/lib/systemd/system/mariadb.service" ]; then
@@ -231,7 +231,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'remote' ]; then
231231
if [ "$service" == 'pgsql' ]; then
232232
service='postgresql'
233233
proc_name='postmaster'
234-
if [ ! -e "/etc/redhat-release" ]; then
234+
if [ ! -d "/etc/sysconfig" ]; then
235235
proc_name='postgres'
236236
fi
237237
if [ ! -e '/etc/init.d/postgresql' ]; then

bin/v-list-sys-vesta-updates

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ shell_list() {
6464
latest=$(wget -q -T 1 -t 1 http://c.vestacp.com/latest.txt -O -)
6565

6666
# Checking installed vesta version
67-
if [ -e "/etc/redhat-release" ]; then
67+
if [ -d "/etc/sysconfig" ]; then
6868
rpm_format="VERSION='%{VERSION}'"
6969
rpm_format="$rpm_format RELEASE='%{RELEASE}'"
7070
rpm_format="$rpm_format ARCH='%{ARCH}'"
@@ -89,7 +89,7 @@ data="NAME='vesta' VERSION='$VERSION' RELEASE='$RELEASE' ARCH='$ARCH'"
8989
data="$data UPDATED='$UPDATED' DESCR='core package' TIME='$TIME' DATE='$DATE'"
9090

9191
# Checking installed vesta-php version
92-
if [ -e "/etc/redhat-release" ]; then
92+
if [ -d "/etc/sysconfig" ]; then
9393
eval $(rpm --queryformat="$rpm_format" -q vesta-php)
9494
DATE=$(date -d @$UTIME +%F)
9595
TIME=$(date -d @$UTIME +%T)
@@ -107,7 +107,7 @@ data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='php interpreter'"
107107
data="$data TIME='$TIME' DATE='$DATE'"
108108

109109
# Checking installed vesta-nginx version
110-
if [ -e "/etc/redhat-release" ]; then
110+
if [ -d "/etc/sysconfig" ]; then
111111
eval $(rpm --queryformat="$rpm_format" -q vesta-nginx)
112112
DATE=$(date -d @$UTIME +%F)
113113
TIME=$(date -d @$UTIME +%T)
@@ -126,7 +126,7 @@ data="$data TIME='$TIME' DATE='$DATE'"
126126

127127
# Checking installed vesta-ioncube version
128128
if [ "$SOFTACULOUS" = 'yes' ]; then
129-
if [ -e "/etc/redhat-release" ]; then
129+
if [ -d "/etc/sysconfig" ]; then
130130
eval $(rpm --queryformat="$rpm_format" -q vesta-ioncube)
131131
DATE=$(date -d @$UTIME +%F)
132132
TIME=$(date -d @$UTIME +%T)
@@ -146,7 +146,7 @@ fi
146146

147147
# Checking installed vesta-softaculous version
148148
if [ "$SOFTACULOUS" = 'yes' ]; then
149-
if [ -e "/etc/redhat-release" ]; then
149+
if [ -d "/etc/sysconfig" ]; then
150150
eval $(rpm --queryformat="$rpm_format" -q vesta-softaculous)
151151
DATE=$(date -d @$UTIME +%F)
152152
TIME=$(date -d @$UTIME +%T)

bin/v-stop-firewall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bash $tmp 2>/dev/null
5656
rm -f $tmp
5757

5858
# Saving rules to the master iptables file
59-
if [ -e "/etc/redhat-release" ]; then
59+
if [ -d "/etc/sysconfig" ]; then
6060
/sbin/iptables-save > /etc/sysconfig/iptables
6161
if [ -z "$(ls /etc/rc3.d/S*iptables 2>/dev/null)" ]; then
6262
/sbin/chkconfig iptables off

bin/v-update-firewall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ if [ ! -z "$FIREWALL_EXTENSION" ]; then
157157
fi
158158

159159
# Saving rules to the master iptables file
160-
if [ -e "/etc/redhat-release" ]; then
160+
if [ -d "/etc/sysconfig" ]; then
161161
/sbin/iptables-save > /etc/sysconfig/iptables
162162
if [ -z "$(ls /etc/rc3.d/S*iptables 2>/dev/null)" ]; then
163163
/sbin/chkconfig iptables on

bin/v-update-sys-vesta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ check_args '1' "$#" 'PACKAGE'
3333
# Action #
3434
#----------------------------------------------------------#
3535

36-
if [ -e "/etc/redhat-release" ]; then
36+
if [ -d "/etc/sysconfig" ]; then
3737
# Clean yum chache
3838
yum -q clean all
3939

0 commit comments

Comments
 (0)