mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-02-18 17:00:19 +00:00
Modify build scripts to accept building on Amazon Linux
This commit is contained in:
parent
30caf57edb
commit
a2e6feb15b
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
1
package/scripts/common/get_amazon_linux_major_version.sh
Normal file
1
package/scripts/common/get_amazon_linux_major_version.sh
Normal file
@ -0,0 +1 @@
|
||||
cat /etc/os-release | grep -Eo "VERSION=\"[0-9]" | tail -c 2
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user