mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
.travis/preinstall: Add python3-selinux
Add python3-selinux to the packages-to-be-installed list if venv python matches system python.
This commit is contained in:
parent
c94fea7617
commit
b563a09cb4
3 changed files with 38 additions and 10 deletions
|
|
@ -1,4 +1,11 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
export LSR_MOLECULE_DEPS='-rmolecule_requirements.txt'
|
||||
#
|
||||
# Use this file to specify custom configuration for a project. Generally, this
|
||||
# involves the modification of the content of LSR_* environment variables, see
|
||||
#
|
||||
# * .travis/preinstall:
|
||||
#
|
||||
# - LSR_EXTRA_PACKAGES
|
||||
#
|
||||
|
||||
LSR_EXTRA_PACKAGES='python3-selinux'
|
||||
export LSR_MOLECULE_DEPS='-rmolecule_requirements.txt'
|
||||
|
|
|
|||
|
|
@ -1,18 +1,30 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
set -ex
|
||||
# Install package specified by user in LSR_EXTRA_PACKAGES. Executed by Travis
|
||||
# during before_install phase.
|
||||
#
|
||||
# LSR_EXTRA_PACKAGES, set by user in .travis/config.sh, is a space separated
|
||||
# list of packages to be installed on the Travis build environment (Ubuntu).
|
||||
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
CONFIG=${SCRIPTDIR}/config.sh
|
||||
set -e
|
||||
|
||||
if [[ -f ${CONFIG} ]]; then
|
||||
. ${CONFIG}
|
||||
SCRIPTDIR=$(readlink -f $(dirname $0))
|
||||
|
||||
. ${SCRIPTDIR}/utils.sh
|
||||
|
||||
# Add python3-selinux package (needed by Molecule on selinux enabled systems,
|
||||
# because Molecule is using `copy` and `file` Ansible modules to setup the
|
||||
# container).
|
||||
if lsr_venv_python_matches_system_python; then
|
||||
LSR_EXTRA_PACKAGES='python3-selinux'
|
||||
fi
|
||||
|
||||
. ${SCRIPTDIR}/config.sh
|
||||
|
||||
# Install extra dependencies.
|
||||
if [[ "${LSR_EXTRA_PACKAGES}" ]]; then
|
||||
set -x
|
||||
sudo apt-get update
|
||||
for P in ${LSR_EXTRA_PACKAGES}; do
|
||||
sudo apt-get install -y ${P} || :
|
||||
done
|
||||
sudo apt-get install -y ${LSR_EXTRA_PACKAGES}
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -134,3 +134,12 @@ function lsr_compare_pythons() {
|
|||
lsr_compare_versions \
|
||||
$(lsr_get_python_version $1) $2 $(lsr_get_python_version $3)
|
||||
}
|
||||
|
||||
##
|
||||
# lsr_venv_python_matches_system_python
|
||||
#
|
||||
# Exit with 0 if virtual environment Python version matches the system Python
|
||||
# version.
|
||||
function lsr_venv_python_matches_system_python() {
|
||||
lsr_compare_pythons python -eq /usr/bin/python3
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue