Amazon linux support

This commit is contained in:
Serghey Rodin 2018-02-14 17:10:14 +02:00
commit 4cc3c1d287
12 changed files with 34 additions and 31 deletions

View file

@ -60,8 +60,8 @@ if [ -z "$sys_ip_check" ]; then
/sbin/ip addr add $ip/$cidr dev $interface \ /sbin/ip addr add $ip/$cidr dev $interface \
broadcast $broadcast label $iface broadcast $broadcast label $iface
# Adding RHEL/CentOS/Fedora startup script # Adding RHEL/CentOS/Fedora/Amazon startup script
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
sys_ip="# Added by vesta" sys_ip="# Added by vesta"
sys_ip="$sys_ip\nDEVICE=$iface" sys_ip="$sys_ip\nDEVICE=$iface"
sys_ip="$sys_ip\nBOOTPROTO=static" sys_ip="$sys_ip\nBOOTPROTO=static"

View file

@ -21,7 +21,7 @@ source $VESTA/conf/vesta.conf
# Checking quota package # Checking quota package
quota=$(which --skip-alias --skip-functions quota 2>/dev/null) quota=$(which --skip-alias --skip-functions quota 2>/dev/null)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
yum -y install quota >/dev/null 2>&1 yum -y install quota >/dev/null 2>&1
check_result $? "quota package installation failed" $E_UPDATE check_result $? "quota package installation failed" $E_UPDATE
else else

View file

@ -46,7 +46,7 @@ fi
#----------------------------------------------------------# #----------------------------------------------------------#
# Cleaning yum cache # Cleaning yum cache
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
yum -q clean all yum -q clean all
yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta" yum="yum -q -y --noplugins --disablerepo=* --enablerepo=vesta"
else else
@ -57,7 +57,7 @@ fi
# Updating php pacakge # Updating php pacakge
if [ -z "$($VESTA/php/bin/php -v|grep 'PHP 5.6')" ]; then if [ -z "$($VESTA/php/bin/php -v|grep 'PHP 5.6')" ]; then
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
$yum -y update vesta-php $yum -y update vesta-php
check_result $? "vesta-php package upgrade failed" $E_UPDATE check_result $? "vesta-php package upgrade failed" $E_UPDATE
else else
@ -67,7 +67,7 @@ if [ -z "$($VESTA/php/bin/php -v|grep 'PHP 5.6')" ]; then
fi fi
# Adding vesta-ioncube package # Adding vesta-ioncube package
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
rpm -q vesta-ioncube >/dev/null 2>&1 rpm -q vesta-ioncube >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
$yum -y install vesta-ioncube >/dev/null 2>&1 $yum -y install vesta-ioncube >/dev/null 2>&1
@ -82,7 +82,7 @@ else
fi fi
# Adding vesta-softaculous package # Adding vesta-softaculous package
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
rpm -q vesta-softaculous >/dev/null 2>&1 rpm -q vesta-softaculous >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
$yum -y install vesta-softaculous >/dev/null 2>&1 $yum -y install vesta-softaculous >/dev/null 2>&1

View file

@ -31,18 +31,16 @@ is_format_valid 'domain'
hostname $domain hostname $domain
# RHEL/CentOS if [ -d "/etc/sysconfig" ]; then
if [ -e "/etc/redhat-release" ]; then # RHEL/CentOS/Amazon
touch /etc/sysconfig/network touch /etc/sysconfig/network
if [ -z "$(grep HOSTNAME /etc/sysconfig/network)" ]; then if [ -z "$(grep HOSTNAME /etc/sysconfig/network)" ]; then
echo "HOSTNAME='$domain'" >> /etc/sysconfig/network echo "HOSTNAME='$domain'" >> /etc/sysconfig/network
else else
sed -i "s/HOSTNAME=.*/HOSTNAME='$domain'/" /etc/sysconfig/network sed -i "s/HOSTNAME=.*/HOSTNAME='$domain'/" /etc/sysconfig/network
fi fi
fi else
# Debian/Ubuntu
# Debian/Ubuntu
if [ ! -e "/etc/redhat-release" ]; then
echo "$domain" > /etc/hostname echo "$domain" > /etc/hostname
fi fi

View file

@ -56,17 +56,18 @@ csv_list() {
HOSTNAME=$(hostname) HOSTNAME=$(hostname)
# Check OS/Release # Check OS/Release
if [ -e '/etc/redhat-release' ]; then if [ -d '/etc/sysconfig' ]; then
if [ ! -z "$(grep CentOS /etc/redhat-release)" ]; then if [ -e '/etc/redhat-release' ]; then
OS='CentOS' OS='CentOS'
VERSION=$(cat /etc/redhat-release |tr ' ' '\n' |grep [0-9])
else else
OS="RHEL" OS="Amazon"
VERSION=$(cat /etc/issue |tr ' ' '\n' |grep [0-9])
fi fi
VERSION=$(cat /etc/redhat-release| tr ' ' '\n' |grep [0-9])
else else
if [ "$(lsb_release -si)" == "Ubuntu" ] && [ -e '/etc/debian_version' ]; then if [ "$(lsb_release -si)" == "Ubuntu" ] && [ -e '/etc/debian_version' ]; then
OS="Ubuntu" OS="Ubuntu"
VERSION=$(grep DISTRIB_RELEASE /etc/lsb-release| cut -f 2 -d '=') VERSION=$(grep DISTRIB_RELEASE /etc/lsb-release |cut -f 2 -d '=')
else else
distro=$(head -n1 /etc/issue |cut -f 1 -d ' ') distro=$(head -n1 /etc/issue |cut -f 1 -d ' ')
if [ "$distro" = 'Debian' ]; then if [ "$distro" = 'Debian' ]; then

View file

@ -191,7 +191,7 @@ fi
# Checking MAIL ANTIVIRUS # Checking MAIL ANTIVIRUS
if [ ! -z "$ANTIVIRUS_SYSTEM" ] && [ "$ANTIVIRUS_SYSTEM" != 'remote' ]; then if [ ! -z "$ANTIVIRUS_SYSTEM" ] && [ "$ANTIVIRUS_SYSTEM" != 'remote' ]; then
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
if [ "$ANTIVIRUS_SYSTEM" == 'clamav' ];then if [ "$ANTIVIRUS_SYSTEM" == 'clamav' ];then
ANTIVIRUS_SYSTEM='clamd' ANTIVIRUS_SYSTEM='clamd'
fi fi
@ -220,7 +220,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'remote' ]; then
proc_name='' proc_name=''
service="$db" service="$db"
if [ "$service" = 'mysql' ]; then if [ "$service" = 'mysql' ]; then
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
service='mysqld' service='mysqld'
proc_name='mysqld' proc_name='mysqld'
if [ -e "/usr/lib/systemd/system/mariadb.service" ]; then if [ -e "/usr/lib/systemd/system/mariadb.service" ]; then
@ -231,7 +231,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'remote' ]; then
if [ "$service" == 'pgsql' ]; then if [ "$service" == 'pgsql' ]; then
service='postgresql' service='postgresql'
proc_name='postmaster' proc_name='postmaster'
if [ ! -e "/etc/redhat-release" ]; then if [ ! -d "/etc/sysconfig" ]; then
proc_name='postgres' proc_name='postgres'
fi fi
if [ ! -e '/etc/init.d/postgresql' ]; then if [ ! -e '/etc/init.d/postgresql' ]; then

View file

@ -64,7 +64,7 @@ shell_list() {
latest=$(wget -q -T 1 -t 1 http://c.vestacp.com/latest.txt -O -) latest=$(wget -q -T 1 -t 1 http://c.vestacp.com/latest.txt -O -)
# Checking installed vesta version # Checking installed vesta version
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
rpm_format="VERSION='%{VERSION}'" rpm_format="VERSION='%{VERSION}'"
rpm_format="$rpm_format RELEASE='%{RELEASE}'" rpm_format="$rpm_format RELEASE='%{RELEASE}'"
rpm_format="$rpm_format ARCH='%{ARCH}'" rpm_format="$rpm_format ARCH='%{ARCH}'"
@ -89,7 +89,7 @@ data="NAME='vesta' VERSION='$VERSION' RELEASE='$RELEASE' ARCH='$ARCH'"
data="$data UPDATED='$UPDATED' DESCR='core package' TIME='$TIME' DATE='$DATE'" data="$data UPDATED='$UPDATED' DESCR='core package' TIME='$TIME' DATE='$DATE'"
# Checking installed vesta-php version # Checking installed vesta-php version
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
eval $(rpm --queryformat="$rpm_format" -q vesta-php) eval $(rpm --queryformat="$rpm_format" -q vesta-php)
DATE=$(date -d @$UTIME +%F) DATE=$(date -d @$UTIME +%F)
TIME=$(date -d @$UTIME +%T) TIME=$(date -d @$UTIME +%T)
@ -107,7 +107,7 @@ data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='php interpreter'"
data="$data TIME='$TIME' DATE='$DATE'" data="$data TIME='$TIME' DATE='$DATE'"
# Checking installed vesta-nginx version # Checking installed vesta-nginx version
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
eval $(rpm --queryformat="$rpm_format" -q vesta-nginx) eval $(rpm --queryformat="$rpm_format" -q vesta-nginx)
DATE=$(date -d @$UTIME +%F) DATE=$(date -d @$UTIME +%F)
TIME=$(date -d @$UTIME +%T) TIME=$(date -d @$UTIME +%T)
@ -126,7 +126,7 @@ data="$data TIME='$TIME' DATE='$DATE'"
# Checking installed vesta-ioncube version # Checking installed vesta-ioncube version
if [ "$SOFTACULOUS" = 'yes' ]; then if [ "$SOFTACULOUS" = 'yes' ]; then
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
eval $(rpm --queryformat="$rpm_format" -q vesta-ioncube) eval $(rpm --queryformat="$rpm_format" -q vesta-ioncube)
DATE=$(date -d @$UTIME +%F) DATE=$(date -d @$UTIME +%F)
TIME=$(date -d @$UTIME +%T) TIME=$(date -d @$UTIME +%T)
@ -146,7 +146,7 @@ fi
# Checking installed vesta-softaculous version # Checking installed vesta-softaculous version
if [ "$SOFTACULOUS" = 'yes' ]; then if [ "$SOFTACULOUS" = 'yes' ]; then
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
eval $(rpm --queryformat="$rpm_format" -q vesta-softaculous) eval $(rpm --queryformat="$rpm_format" -q vesta-softaculous)
DATE=$(date -d @$UTIME +%F) DATE=$(date -d @$UTIME +%F)
TIME=$(date -d @$UTIME +%T) TIME=$(date -d @$UTIME +%T)

View file

@ -56,7 +56,7 @@ bash $tmp 2>/dev/null
rm -f $tmp rm -f $tmp
# Saving rules to the master iptables file # Saving rules to the master iptables file
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
/sbin/iptables-save > /etc/sysconfig/iptables /sbin/iptables-save > /etc/sysconfig/iptables
if [ -z "$(ls /etc/rc3.d/S*iptables 2>/dev/null)" ]; then if [ -z "$(ls /etc/rc3.d/S*iptables 2>/dev/null)" ]; then
/sbin/chkconfig iptables off /sbin/chkconfig iptables off

View file

@ -157,7 +157,7 @@ if [ ! -z "$FIREWALL_EXTENSION" ]; then
fi fi
# Saving rules to the master iptables file # Saving rules to the master iptables file
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
/sbin/iptables-save > /etc/sysconfig/iptables /sbin/iptables-save > /etc/sysconfig/iptables
if [ -z "$(ls /etc/rc3.d/S*iptables 2>/dev/null)" ]; then if [ -z "$(ls /etc/rc3.d/S*iptables 2>/dev/null)" ]; then
/sbin/chkconfig iptables on /sbin/chkconfig iptables on

View file

@ -33,7 +33,7 @@ check_args '1' "$#" 'PACKAGE'
# Action # # Action #
#----------------------------------------------------------# #----------------------------------------------------------#
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
# Clean yum chache # Clean yum chache
yum -q clean all yum -q clean all

View file

@ -62,7 +62,7 @@ build_webalizer() {
} }
build_awstats() { build_awstats() {
if [ -e "/etc/redhat-release" ]; then if [ -d "/etc/sysconfig" ]; then
awstats="/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" awstats="/usr/share/awstats/wwwroot/cgi-bin/awstats.pl"
wwwroot="/usr/share/awstats/wwwroot" wwwroot="/usr/share/awstats/wwwroot"
if [ ! -e "$awstats" ]; then if [ ! -e "$awstats" ]; then

View file

@ -33,7 +33,11 @@ esac
# Detecting release # Detecting release
if [ "$version" = 'rhel' ]; then if [ "$version" = 'rhel' ]; then
release=$(grep -o "[0-9]" /etc/redhat-release |head -n1) if [ -e '/etc/redhat-release' ]; then
release=$(grep -o "[0-9]" /etc/redhat-release |head -n1)
else
release=6
fi
fi fi
if [ "$version" = 'ubuntu' ]; then if [ "$version" = 'ubuntu' ]; then
release=$(lsb_release -r |awk '{print $2}') release=$(lsb_release -r |awk '{print $2}')