Modify build scripts to accept building on Amazon Linux

This commit is contained in:
Michael Tsai 2019-02-21 16:35:32 -05:00
parent 30caf57edb
commit a2e6feb15b
5 changed files with 25 additions and 11 deletions

View File

@ -3,8 +3,8 @@ set -e
# Check packager OS is Centos
OS_NAME=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
if [ "$OS_NAME" != "\"CentOS Linux\"" ]; then
echo "Error: RPMs must be built with CentOS"
if [ "$OS_NAME" != "\"CentOS Linux\"" ] && [ "$OS_NAME" != "\"Amazon Linux\"" ] ; then
echo "Error: RPMs must be built with CentOS or Amazon Linux"
exit 1
fi

View File

@ -23,13 +23,17 @@ else
service $SQL_SERVICE start
fi
if [[ -f /etc/redhat-release ]] ; then
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
elif [[ -f /etc/os-release ]] ; then
AMAZON_VER=`/opt/hirs/scripts/common/get_amazon_linux_major_version.sh`
fi
if [ $CENTOS_VER -eq "6" ] ; then
DB_CREATE_SCRIPT=/opt/hirs/scripts/common/db_create.sql.el6
elif [ $CENTOS_VER -eq "7" ] ; then
elif [ $CENTOS_VER -eq "7" ] || [ $AMAZON_VER -eq "2" ] ; then
DB_CREATE_SCRIPT=/opt/hirs/scripts/common/db_create.sql.el7
else
echo "Unsupported CentOS version: ${CENTOS_VER}"
echo "Unsupported Linux detected"
exit 1
fi

View File

@ -3,7 +3,11 @@ if ! [ $(id -u) = 0 ]; then
exit 1
fi
if [[ -f /etc/redhat-release ]] ; then
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
elif [[ -f /etc/os-release ]] ; then
AMAZON_VER=`/opt/hirs/scripts/common/get_amazon_linux_major_version.sh`
fi
if [ $CENTOS_VER -eq "6" ] ; then
checkHTTPS=`iptables-save | grep -- "--dport 8443 -j ACCEPT"`
@ -12,10 +16,11 @@ if [ $CENTOS_VER -eq "6" ] ; then
iptables -I INPUT 1 -p tcp -m tcp --dport 8443 -j ACCEPT
service iptables save
fi
elif [ $CENTOS_VER -eq "7" ] ; then
elif [ $CENTOS_VER -eq "7" ] || [ $AMAZON_VER -eq "2" ] ; then
firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 -p tcp --dport 8443 -j ACCEPT
firewall-cmd --reload
else
echo "Unsupported CentOS version: ${CENTOS_VER}"
echo "Unsupported Linux detected"
exit 1
fi
fi

View File

@ -0,0 +1 @@
cat /etc/os-release | grep -Eo "VERSION=\"[0-9]" | tail -c 2

View File

@ -219,13 +219,17 @@ if [[ $1 = "server" ]]; then
chmod -R 770 $MYSQL_CERT_DIR
# update MySQL/MariaDB SSL and index configuration
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
if [[ -f /etc/redhat-release ]] ; then
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
elif [[ -f /etc/os-release ]] ; then
AMAZON_VER=`/opt/hirs/scripts/common/get_amazon_linux_major_version.sh`
fi
if [ $CENTOS_VER -eq "6" ] ; then
MYSQL_ADDITIONS_FILE=/opt/hirs/scripts/common/my.cnf.el6
elif [ $CENTOS_VER -eq "7" ] ; then
elif [ $CENTOS_VER -eq "7" ] || [ $AMAZON_VER -eq "2" ] ; then
MYSQL_ADDITIONS_FILE=/opt/hirs/scripts/common/my.cnf.el7
else
echo "Unsupported CentOS version: ${CENTOS_VER}"
echo "Unsupported Linux detected"
exit 1
fi
@ -246,4 +250,4 @@ if [[ $1 = "server" ]]; then
service $SQL_SERVICE restart
fi
fi
fi
fi