github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/hack/make/.integration-daemon-stop (about)

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