github.com/raychaser/docker@v1.5.0/project/make/.dockerinit (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  # dockerinit still needs to be a static binary, even if docker is dynamic
     5  go build \
     6  	-o "$DEST/dockerinit-$VERSION" \
     7  	"${BUILDFLAGS[@]}" \
     8  	-ldflags "
     9  		$LDFLAGS
    10  		$LDFLAGS_STATIC
    11  		-extldflags \"$EXTLDFLAGS_STATIC\"
    12  	" \
    13  	./dockerinit
    14  echo "Created binary: $DEST/dockerinit-$VERSION"
    15  ln -sf "dockerinit-$VERSION" "$DEST/dockerinit"
    16  
    17  sha1sum=
    18  if command -v sha1sum &> /dev/null; then
    19  	sha1sum=sha1sum
    20  elif command -v shasum &> /dev/null; then
    21  	# Mac OS X - why couldn't they just use the same command name and be happy?
    22  	sha1sum=shasum
    23  else
    24  	echo >&2 'error: cannot find sha1sum command or equivalent'
    25  	exit 1
    26  fi
    27  
    28  # sha1 our new dockerinit to ensure separate docker and dockerinit always run in a perfect pair compiled for one another
    29  export DOCKER_INITSHA1="$($sha1sum $DEST/dockerinit-$VERSION | cut -d' ' -f1)"