github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/hack/make/.integration-daemon-stop (about)

     1  #!/usr/bin/env bash
     2  
     3  if [ ! "$(go env GOOS)" = 'windows' ]; then
     4  	for pidFile in $(find "$DEST" -name docker.pid); do
     5  		pid=$(
     6  			[ -n "$TESTDEBUG" ] && set -x
     7  			cat "$pidFile"
     8  		)
     9  		(
    10  			[ -n "$TESTDEBUG" ] && set -x
    11  			kill "$pid"
    12  		)
    13  		if ! wait "$pid"; then
    14  			echo >&2 "warning: PID $pid from $pidFile had a nonzero exit code"
    15  		fi
    16  		root=$(dirname "$pidFile")/root
    17  		if [ -d "$root" ]; then
    18  			umount "$root" || true
    19  		fi
    20  	done
    21  
    22  	if [ -z "$DOCKER_TEST_HOST" ]; then
    23  		# Stop apparmor if it is enabled
    24  		if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
    25  			(
    26  				[ -n "$TESTDEBUG" ] && set -x
    27  				/etc/init.d/apparmor stop || true
    28  			)
    29  		fi
    30  	fi
    31  else
    32  	# Note this script is not actionable on Windows to Linux CI. Instead the
    33  	# DIND daemon under test is torn down by the Jenkins tear-down script
    34  	echo "INFO: Not stopping daemon on Windows CI"
    35  fi