Amazon linux support

This commit is contained in:
Serghey Rodin 2018-02-14 17:10:14 +02:00
parent 26c311b773
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 \
broadcast $broadcast label $iface
# Adding RHEL/CentOS/Fedora startup script
if [ -e "/etc/redhat-release" ]; then
# Adding RHEL/CentOS/Fedora/Amazon startup script
if [ -d "/etc/sysconfig" ]; then
sys_ip="# Added by vesta"
sys_ip="$sys_ip\nDEVICE=$iface"
sys_ip="$sys_ip\nBOOTPROTO=static"

View file

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

View file

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

View file

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

View file

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

View file

@ -191,7 +191,7 @@ fi
# Checking MAIL ANTIVIRUS
if [ ! -z "$ANTIVIRUS_SYSTEM" ] && [ "$ANTIVIRUS_SYSTEM" != 'remote' ]; then
if [ -e "/etc/redhat-release" ]; then
if [ -d "/etc/sysconfig" ]; then
if [ "$ANTIVIRUS_SYSTEM" == 'clamav' ];then
ANTIVIRUS_SYSTEM='clamd'
fi
@ -220,7 +220,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'remote' ]; then
proc_name=''
service="$db"
if [ "$service" = 'mysql' ]; then
if [ -e "/etc/redhat-release" ]; then
if [ -d "/etc/sysconfig" ]; then
service='mysqld'
proc_name='mysqld'
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
service='postgresql'
proc_name='postmaster'
if [ ! -e "/etc/redhat-release" ]; then
if [ ! -d "/etc/sysconfig" ]; then
proc_name='postgres'
fi
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 -)
# Checking installed vesta version
if [ -e "/etc/redhat-release" ]; then
if [ -d "/etc/sysconfig" ]; then
rpm_format="VERSION='%{VERSION}'"
rpm_format="$rpm_format RELEASE='%{RELEASE}'"
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'"
# Checking installed vesta-php version
if [ -e "/etc/redhat-release" ]; then
if [ -d "/etc/sysconfig" ]; then
eval $(rpm --queryformat="$rpm_format" -q vesta-php)
DATE=$(date -d @$UTIME +%F)
TIME=$(date -d @$UTIME +%T)
@ -107,7 +107,7 @@ data="$data ARCH='$ARCH' UPDATED='$UPDATED' DESCR='php interpreter'"
data="$data TIME='$TIME' DATE='$DATE'"
# Checking installed vesta-nginx version
if [ -e "/etc/redhat-release" ]; then
if [ -d "/etc/sysconfig" ]; then
eval $(rpm --queryformat="$rpm_format" -q vesta-nginx)
DATE=$(date -d @$UTIME +%F)
TIME=$(date -d @$UTIME +%T)
@ -126,7 +126,7 @@ data="$data TIME='$TIME' DATE='$DATE'"
# Checking installed vesta-ioncube version
if [ "$SOFTACULOUS" = 'yes' ]; then
if [ -e "/etc/redhat-release" ]; then
if [ -d "/etc/sysconfig" ]; then
eval $(rpm --queryformat="$rpm_format" -q vesta-ioncube)
DATE=$(date -d @$UTIME +%F)
TIME=$(date -d @$UTIME +%T)
@ -146,7 +146,7 @@ fi
# Checking installed vesta-softaculous version
if [ "$SOFTACULOUS" = 'yes' ]; then
if [ -e "/etc/redhat-release" ]; then
if [ -d "/etc/sysconfig" ]; then
eval $(rpm --queryformat="$rpm_format" -q vesta-softaculous)
DATE=$(date -d @$UTIME +%F)
TIME=$(date -d @$UTIME +%T)

View file

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

View file

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

View file

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

View file

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

View file

@ -33,7 +33,11 @@ esac
# Detecting release
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
if [ "$version" = 'ubuntu' ]; then
release=$(lsb_release -r |awk '{print $2}')