3 # Run this script from the root of the systemd's git repository
4 # or set REPO_ROOT to a correct path.
6 # Example execution on Fedora:
7 # dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
8 # dnf install -y docker-ce
9 # systemctl start docker
10 # export CONT_NAME="my-fancy-container"
11 # travis-ci/managers/fedora.sh SETUP RUN CLEANUP
13 PHASES
=(${@:-SETUP RUN CLEANUP})
14 FEDORA_RELEASE
="${FEDORA_RELEASE:-rawhide}"
15 CONT_NAME
="${CONT_NAME:-fedora-$FEDORA_RELEASE-$RANDOM}"
16 DOCKER_EXEC
="${DOCKER_EXEC:-docker exec -it $CONT_NAME}"
17 DOCKER_RUN
="${DOCKER_RUN:-docker run}"
18 REPO_ROOT
="${REPO_ROOT:-$PWD}"
19 ADDITIONAL_DEPS
=(dnf-plugins-core python2 iputils hostname libasan
)
22 echo -e "\033[33;1m$1\033[0m"
27 for phase
in "${PHASES[@]}"; do
31 info
"Using Fedora $FEDORA_RELEASE"
32 MACHINE_ID
="/etc/machine-id"
33 if [ ! -f $MACHINE_ID ]; then
34 MACHINE_ID
="/var/lib/dbus/machine-id"
36 # Pull a Docker image and start a new container
37 docker pull fedora
:$FEDORA_RELEASE
38 info
"Starting container $CONT_NAME"
39 $DOCKER_RUN -v $REPO_ROOT:/build
:rw \
40 -v $MACHINE_ID:/etc
/machine-id
:ro \
41 -w /build
--privileged=true
--name $CONT_NAME \
42 -dit --net=host fedora
:$FEDORA_RELEASE /sbin
/init
43 $DOCKER_EXEC dnf makecache
44 # Install necessary build/test requirements
45 $DOCKER_EXEC dnf
-y install "${ADDITIONAL_DEPS[@]}"
46 $DOCKER_EXEC dnf
-y builddep systemd
51 $DOCKER_EXEC meson build
52 $DOCKER_EXEC ninja
-C build
54 $DOCKER_EXEC ninja
-C build
test
58 docker stop
$CONT_NAME
59 docker
rm -f $CONT_NAME
62 echo >&2 "Unknown phase '$phase'"