github.com/lafolle/docker@v1.6.0/hack/make/tgz (about)

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