2020-06-02 21:18:56 +02:00
|
|
|
#!/usr/bin/env bash
|
2020-08-03 17:14:28 +02:00
|
|
|
# SPDX-License-Identifier: MIT
|
2020-06-02 21:18:56 +02:00
|
|
|
set -ev
|
|
|
|
|
2020-06-11 19:30:39 +02:00
|
|
|
#
|
|
|
|
# We expect this to be set in the environment, but if it's not, most selinux projects
|
|
|
|
# just have the same name as upstream, so choose that.
|
|
|
|
#
|
|
|
|
export SELINUX_DIR="${SELINUX_DIR:-/root/selinux}"
|
|
|
|
|
2020-06-02 21:18:56 +02:00
|
|
|
# CI Debug output if things go squirrely.
|
|
|
|
getenforce
|
|
|
|
id -Z
|
|
|
|
nproc
|
|
|
|
pwd
|
|
|
|
|
|
|
|
# Turn off enforcing for the setup to prevent any weirdness from breaking
|
|
|
|
# the CI.
|
|
|
|
setenforce 0
|
|
|
|
|
|
|
|
dnf clean all -y
|
|
|
|
dnf install -y \
|
|
|
|
--allowerasing \
|
|
|
|
--skip-broken \
|
|
|
|
git \
|
|
|
|
audit-libs-devel \
|
|
|
|
bison \
|
|
|
|
bzip2-devel \
|
|
|
|
CUnit-devel \
|
|
|
|
diffutils \
|
|
|
|
flex \
|
|
|
|
gcc \
|
|
|
|
gettext \
|
|
|
|
glib2-devel \
|
|
|
|
make \
|
|
|
|
libcap-devel \
|
|
|
|
libcap-ng-devel \
|
|
|
|
pam-devel \
|
2021-11-23 19:32:49 +01:00
|
|
|
pcre2-devel \
|
2020-06-02 21:18:56 +02:00
|
|
|
xmlto \
|
|
|
|
python3-devel \
|
|
|
|
ruby-devel \
|
|
|
|
swig \
|
|
|
|
perl-Test \
|
|
|
|
perl-Test-Harness \
|
|
|
|
perl-Test-Simple \
|
|
|
|
selinux-policy-devel \
|
|
|
|
gcc \
|
|
|
|
libselinux-devel \
|
|
|
|
net-tools \
|
|
|
|
netlabel_tools \
|
|
|
|
iptables \
|
|
|
|
lksctp-tools-devel \
|
|
|
|
attr \
|
|
|
|
libbpf-devel \
|
|
|
|
keyutils-libs-devel \
|
|
|
|
kernel-devel \
|
|
|
|
quota \
|
|
|
|
xfsprogs-devel \
|
|
|
|
libuuid-devel \
|
2020-11-12 10:15:19 +01:00
|
|
|
e2fsprogs \
|
|
|
|
jfsutils \
|
|
|
|
dosfstools \
|
2020-06-02 21:18:56 +02:00
|
|
|
kernel-devel-"$(uname -r)" \
|
|
|
|
kernel-modules-"$(uname -r)"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Move to selinux code and build
|
|
|
|
#
|
2020-06-11 19:30:39 +02:00
|
|
|
cd "$SELINUX_DIR"
|
2020-06-02 21:18:56 +02:00
|
|
|
|
|
|
|
# Show HEAD commit for sanity checking
|
2022-05-17 15:26:22 +02:00
|
|
|
git config --global --add safe.directory "$SELINUX_DIR"
|
2020-08-11 16:42:20 +02:00
|
|
|
git log --oneline -1
|
2020-06-02 21:18:56 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build and replace userspace components
|
|
|
|
#
|
2020-12-03 09:15:12 +01:00
|
|
|
make clean distclean
|
2020-06-02 21:18:56 +02:00
|
|
|
make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install
|
|
|
|
make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 install-pywrap
|
|
|
|
make -j"$(nproc)" LIBDIR=/usr/lib64 SHLIBDIR=/lib64 relabel
|
|
|
|
|
|
|
|
#
|
2020-06-11 19:30:39 +02:00
|
|
|
# Get the selinux testsuite, but don't clone it in selinux git directory, move to $HOME
|
2020-06-02 21:18:56 +02:00
|
|
|
# first.
|
|
|
|
#
|
|
|
|
cd "$HOME"
|
2020-12-03 09:15:12 +01:00
|
|
|
rm -rf selinux-testsuite
|
2020-06-02 21:18:56 +02:00
|
|
|
git clone --depth=1 https://github.com/SELinuxProject/selinux-testsuite.git
|
|
|
|
cd selinux-testsuite
|
|
|
|
|
|
|
|
# The testsuite must be run in enforcing mode
|
|
|
|
setenforce 1
|
|
|
|
|
|
|
|
#
|
|
|
|
# Run the test suite
|
|
|
|
#
|
|
|
|
make test
|