2017-02-13 19:01:54 +00:00
|
|
|
#!/usr/bin/env bash
|
2014-12-19 07:20:59 +00:00
|
|
|
|
2019-01-10 01:23:38 +00:00
|
|
|
if [ ! "$(go env GOOS)" = 'windows' ]; then
|
2016-01-05 18:52:59 +00:00
|
|
|
for pidFile in $(find "$DEST" -name docker.pid); do
|
2020-03-03 03:27:49 +00:00
|
|
|
pid=$(
|
|
|
|
[ -n "$TESTDEBUG" ] && set -x
|
|
|
|
cat "$pidFile"
|
|
|
|
)
|
2017-07-06 21:20:41 +00:00
|
|
|
(
|
2019-01-10 01:23:38 +00:00
|
|
|
[ -n "$TESTDEBUG" ] && set -x
|
2017-07-06 21:20:41 +00:00
|
|
|
kill "$pid"
|
|
|
|
)
|
2016-01-05 18:52:59 +00:00
|
|
|
if ! wait "$pid"; then
|
|
|
|
echo >&2 "warning: PID $pid from $pidFile had a nonzero exit code"
|
|
|
|
fi
|
2019-08-05 23:55:30 +00:00
|
|
|
root=$(dirname "$pidFile")/root
|
2019-10-09 10:55:25 +00:00
|
|
|
if [ -d "$root" ]; then
|
|
|
|
umount "$root" || true
|
|
|
|
fi
|
2016-01-05 18:52:59 +00:00
|
|
|
done
|
2015-05-04 20:20:01 +00:00
|
|
|
|
2019-01-10 01:23:38 +00:00
|
|
|
if [ -z "$DOCKER_TEST_HOST" ]; then
|
2016-01-05 18:52:59 +00:00
|
|
|
# Stop apparmor if it is enabled
|
2019-01-10 01:23:38 +00:00
|
|
|
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
|
2016-01-05 18:52:59 +00:00
|
|
|
(
|
2019-01-10 01:23:38 +00:00
|
|
|
[ -n "$TESTDEBUG" ] && set -x
|
2020-01-09 17:49:11 +00:00
|
|
|
/etc/init.d/apparmor stop || true
|
2016-01-05 18:52:59 +00:00
|
|
|
)
|
|
|
|
fi
|
2015-05-04 20:20:01 +00:00
|
|
|
fi
|
2016-01-05 18:52:59 +00:00
|
|
|
else
|
2020-03-03 03:27:49 +00:00
|
|
|
# Note this script is not actionable on Windows to Linux CI. Instead the
|
2016-01-05 18:52:59 +00:00
|
|
|
# DIND daemon under test is torn down by the Jenkins tear-down script
|
|
|
|
echo "INFO: Not stopping daemon on Windows CI"
|
2015-05-04 20:20:01 +00:00
|
|
|
fi
|