Merge pull request #97 from nsacyber/issue-90

Modify build scripts to enable installation on Amazon Linux
This commit is contained in:
iadgovuser26 2019-03-28 11:06:33 -04:00 committed by GitHub
commit 6dba37be80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 11 deletions

View File

@ -0,0 +1,17 @@
FROM amazonlinux:2
MAINTAINER apl.dev3@jhuapl.edu
# Install packages for building HIRS
RUN yum -y update && yum clean all
RUN yum groupinstall -y "Development Tools"
RUN yum install -y wget java-1.8.0-openjdk-devel protobuf-compiler rpm-build cmake make git gcc-c++ doxygen graphviz python libssh2-devel openssl protobuf-devel tpm2-tss-devel trousers-devel libcurl-devel
# Install EPEL
WORKDIR /tmp
RUN wget -O epel.rpm -nv https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install -y ./epel.rpm
RUN yum install -y cppcheck log4cplus-devel re2-devel
# Set Environment Variables
ENV JAVA_HOME /usr/lib/jvm/java

View File

@ -40,6 +40,11 @@ jobs:
script: docker run --rm -v $(pwd):/HIRS hirs/hirs-ci:ubuntu18 /bin/bash -c "cd /HIRS; ./package/package.ubuntu.sh"
env: null
name: "Package Ubuntu"
# TODO: Explore reason behind Building/Packaging Failing on Amazon Linux
# - stage: Packaging and System Tests
# script: docker run --rm -v $(pwd):/HIRS hirs/hirs-ci:amazonlinux2 /bin/bash -c "cd /HIRS; ./package/package.centos.sh"
# env: null
# name: "Package Amazon Linux"
- stage: Packaging and System Tests
script: .ci/system-tests/./run-system-tests.sh
env: null

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