github.com/amylindburg/docker@v1.7.0/hack/make/.dockerinit-gccgo (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  IAMSTATIC="true"
     5  source "${MAKEDIR}/.go-autogen"
     6  
     7  # dockerinit still needs to be a static binary, even if docker is dynamic
     8  go build --compiler=gccgo \
     9  	-o "$DEST/dockerinit-$VERSION" \
    10  	"${BUILDFLAGS[@]}" \
    11  	--gccgoflags "
    12  		-g
    13  		-Wl,--no-export-dynamic
    14  		$EXTLDFLAGS_STATIC_DOCKER
    15  		-lnetgo
    16  	" \
    17  	./dockerinit
    18  
    19  echo "Created binary: $DEST/dockerinit-$VERSION"
    20  ln -sf "dockerinit-$VERSION" "$DEST/dockerinit"
    21  
    22  sha1sum=
    23  if command -v sha1sum &> /dev/null; then
    24  	sha1sum=sha1sum
    25  else
    26  	echo >&2 'error: cannot find sha1sum command or equivalent'
    27  	exit 1
    28  fi
    29  
    30  # sha1 our new dockerinit to ensure separate docker and dockerinit always run in a perfect pair compiled for one another
    31  export DOCKER_INITSHA1=$($sha1sum "$DEST/dockerinit-$VERSION" | cut -d' ' -f1)