github.com/shiroyuki/docker@v1.9.0/hack/make/tgz (about)

     1  #!/bin/bash
     2  
     3  CROSS="$DEST/../cross"
     4  
     5  set -e
     6  
     7  if [ ! -d "$CROSS/linux/amd64" ]; then
     8  	echo >&2 'error: binary and cross must be run before tgz'
     9  	false
    10  fi
    11  
    12  for d in "$CROSS/"*/*; do
    13  	GOARCH="$(basename "$d")"
    14  	GOOS="$(basename "$(dirname "$d")")"
    15  	BINARY_NAME="docker-$VERSION"
    16  	BINARY_EXTENSION="$(export GOOS && binary_extension)"
    17  	BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
    18  	mkdir -p "$DEST/$GOOS/$GOARCH"
    19  	TGZ="$DEST/$GOOS/$GOARCH/$BINARY_NAME.tgz"
    20  
    21  	mkdir -p "$DEST/build"
    22  
    23  	mkdir -p "$DEST/build/usr/local/bin"
    24  	cp -L "$d/$BINARY_FULLNAME" "$DEST/build/usr/local/bin/docker$BINARY_EXTENSION"
    25  
    26  	tar --numeric-owner --owner 0 -C "$DEST/build" -czf "$TGZ" usr
    27  
    28  	hash_files "$TGZ"
    29  
    30  	rm -rf "$DEST/build"
    31  
    32  	echo "Created tgz: $TGZ"
    33  done