github.com/kaisenlinux/docker@v0.0.0-20230510090727-ea55db55fac7/engine/hack/vendor.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # This file is just wrapper around vndr (github.com/LK4D4/vndr) tool.
     4  # For updating dependencies you should change `vendor.conf` file in root of the
     5  # project. Please refer to https://github.com/LK4D4/vndr/blob/master/README.md for
     6  # vndr usage.
     7  
     8  set -e
     9  
    10  if ! hash vndr; then
    11  	echo "Please install vndr with \"go get github.com/LK4D4/vndr\" and put it in your \$GOPATH"
    12  	exit 1
    13  fi
    14  
    15  if [ $# -eq 0 ] || [ "$1" = "archive/tar" ]; then
    16  	echo "update vendored copy of archive/tar"
    17  	: "${GO_VERSION:=$(awk -F '[ =]' '$1 == "ARG" && $2 == "GO_VERSION" { print $3; exit }' ./Dockerfile)}"
    18  	rm -rf vendor/archive
    19  	mkdir -p ./vendor/archive/tar
    20  	echo "downloading: https://golang.org/dl/go${GO_VERSION%.0}.src.tar.gz"
    21  	curl -fsSL "https://golang.org/dl/go${GO_VERSION%.0}.src.tar.gz" \
    22  		| tar --extract --gzip --directory=vendor/archive/tar --strip-components=4 go/src/archive/tar
    23  	patch --strip=4 --directory=vendor/archive/tar --input="$PWD/patches/0001-archive-tar-do-not-populate-user-group-names.patch"
    24  fi
    25  
    26  if [ $# -eq 0 ] || [ "$1" != "archive/tar" ]; then
    27  	vndr -whitelist=^archive/tar "$@"
    28  fi