fedora: fix selinux configuration

The SELinux Python package has been renamed to python2-selinux
which means that Fedora jobs are currently failing.

This patch adds a conditional to be able to handle Fedora while
keeping support for CentOS.

Change-Id: I47d252c3db4d0071e90f9b1c566ab26b00635592
This commit is contained in:
Mohammed Naser 2019-04-07 14:32:53 -04:00
parent bc5fd28340
commit 394d3597bf

View File

@ -255,8 +255,14 @@ setup_ara
# Ensure that SElinux bindings are linked into the venv
source /etc/os-release || source /usr/lib/os-release
if [[ ${ID,,} =~ (centos|rhel|fedora) ]]; then
if [ "${ID}" == "fedora" ]; then
SELINUX_PKG="python2-libselinux"
else
SELINUX_PKG="libselinux-python"
fi
PYTHON_FOLDER=$(find ${VIRTUAL_ENV}/lib -maxdepth 1 -type d -name "python*")
SELINUX_FOLDER=$(rpm -ql libselinux-python | egrep '^.*python2.7.*/(site|dist)-packages/selinux$')
SELINUX_FOLDER=$(rpm -ql ${SELINUX_PKG} | egrep '^.*python2.7.*/(site|dist)-packages/selinux$')
echo "RHEL variant found. Linking ${PYTHON_FOLDER}/site-packages/selinux to ${SELINUX_FOLDER}..."
ln -sfn ${SELINUX_FOLDER} ${PYTHON_FOLDER}/site-packages/selinux
fi