Binary is named docker inside tar, docker.exe inside zip package

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Guillaume Tardif 2020-09-22 17:13:56 +02:00
parent 2e6d739fc8
commit dd57e9e646
2 changed files with 8 additions and 4 deletions

View File

@ -32,14 +32,16 @@ GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
BINARY?=bin/docker
BINARY_WITH_EXTENSION=$(BINARY)$(EXTENSION)
WORK_DIR:=$(shell mktemp -d)
TAGS:=
ifdef BUILD_TAGS
TAGS=-tags $(BUILD_TAGS)
endif
TAR_TRANSFORM:=--transform s/packaging/docker/ --transform s/bin/docker/
TAR_TRANSFORM:=--transform s/packaging/docker/ --transform s/bin/docker/ --transform s/docker-linux-amd64/docker/ --transform s/docker-darwin-amd64/docker/
ifneq ($(findstring bsd,$(shell tar --version)),)
TAR_TRANSFORM=-s /packaging/docker/ -s /bin/docker/
TAR_TRANSFORM=-s /packaging/docker/ -s /bin/docker/ -s /docker-linux-amd64/docker/ -s /docker-darwin-amd64/docker/
endif
all: cli
@ -83,4 +85,6 @@ package: cross
mkdir -p dist
tar -czf dist/docker-linux-amd64.tar.gz $(TAR_TRANSFORM) packaging/LICENSE $(BINARY)-linux-amd64
tar -czf dist/docker-darwin-amd64.tar.gz $(TAR_TRANSFORM) packaging/LICENSE $(BINARY)-darwin-amd64
rm -f dist/docker-windows-amd64.zip && zip dist/docker-windows-amd64.zip -j packaging/LICENSE $(BINARY)-windows-amd64.exe
cp $(BINARY)-windows-amd64.exe $(WORK_DIR)/docker.exe
rm -f dist/docker-windows-amd64.zip && zip dist/docker-windows-amd64.zip -j packaging/LICENSE $(WORK_DIR)/docker.exe
rm -r $(WORK_DIR)

View File

@ -115,7 +115,7 @@ if [ $(is_new_cli "docker") -eq 1 ]; then
download_dir=$($sh_c 'mktemp -d')
$sh_c "${download_cmd} ${download_dir}/docker-compose-cli.tar.gz ${DOWNLOAD_URL}"
$sh_c "tar xzf ${download_dir}/docker-compose-cli.tar.gz -C ${download_dir} --strip-components 1"
$sudo_sh_c "install -m 775 ${download_dir}/docker-linux-amd64 /usr/local/bin/docker"
$sudo_sh_c "install -m 775 ${download_dir}/docker /usr/local/bin/docker"
exit 0
fi
echo "You already have the Docker Compose CLI installed, in a different location."