52379fa76d
This is especially important for distributions like NixOS where `/bin/bash` doesn't exist, or for MacOS users who've installed a newer version of Bash than the one that comes with their OS. Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
27 lines
809 B
Bash
27 lines
809 B
Bash
#!/usr/bin/env bash
|
|
|
|
if [ ! "$(go env GOOS)" = 'windows' ]; then
|
|
trap - EXIT # reset EXIT trap applied in .integration-daemon-start
|
|
|
|
for pidFile in $(find "$DEST" -name docker.pid); do
|
|
pid=$(set -x; cat "$pidFile")
|
|
( set -x; kill "$pid" )
|
|
if ! wait "$pid"; then
|
|
echo >&2 "warning: PID $pid from $pidFile had a nonzero exit code"
|
|
fi
|
|
done
|
|
|
|
if [ -z "$DOCKER_TEST_HOST" ]; then
|
|
# Stop apparmor if it is enabled
|
|
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
|
|
(
|
|
set -x
|
|
/etc/init.d/apparmor stop
|
|
)
|
|
fi
|
|
fi
|
|
else
|
|
# Note this script is not actionable on Windows to Linux CI. Instead the
|
|
# DIND daemon under test is torn down by the Jenkins tear-down script
|
|
echo "INFO: Not stopping daemon on Windows CI"
|
|
fi
|