mongo/evergreen/selinux_test_setup.sh
Nick Jefferies 9f3133e98b SERVER-116221: Reference python3.13 in v5 toolchain (#47179)
GitOrigin-RevId: d810136e7a469c63fa0051464b29f88924512d22
2026-02-05 16:39:17 +00:00

42 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# This script is loaded on the target machine, which is running tests
# Purpose: install mongod and shell from packages
set -o xtrace
set -o errexit
function apply_selinux_policy() {
echo "==== Applying SELinux policy now"
rm -rf mongodb-selinux
git clone https://github.com/mongodb/mongodb-selinux
cd mongodb-selinux
make
sudo make install
}
# on evergreen images /tmp is usually linked to /data/tmp, which interferes
# with selinux, as it does not recognize it as tmp_t domain
if [ -L /tmp ]; then
sudo --non-interactive rm /tmp
sudo --non-interactive mkdir /tmp
sudo --non-interactive systemctl start tmp.mount
fi
apply_selinux_policy
pkg="$(find "$HOME"/repo -name 'mongodb-*-server-*.x86_64.rpm' | tee /dev/stderr)"
if ! sudo --non-interactive rpm --install --verbose --verbose --hash --nodeps "$pkg"; then
if [ "$?" -gt "1" ]; then exit 1; fi # exit code 1 is OK
fi
# install packages needed by check_has_tag.py
PYTHON=/opt/mongodbtoolchain/v5/bin/python3.13
if [[ (-f "$PYTHON" || -L "$PYTHON") && -x "$PYTHON" ]]; then
echo "==== Found python3 in $PYTHON"
$PYTHON -m pip install pyyaml
else
echo "==== Could not find $PYTHON; needed by SELinux tests"
exit 1
fi