Browse code

Fix installation using make install

The following command fails when the target directory does not exist.

$ sudo make install DOCKER_MAKE_INSTALL_PREFIX=/opt/docker AUTO_GOPATH=1
KEEPBUNDLE=1 hack/make.sh install-binary
# WARNING! I don't seem to be running in a Docker container.
# The result of this command might be an incorrect build, and will not be
# officially supported.
#
# Try this instead: make all
#

---> Making bundle: install-binary (in bundles/1.14.0-dev/install-binary)
Installing docker to /opt/docker/bin/
cp: cannot create regular file '/opt/docker/bin/': No such file or directory
make: *** [Makefile:119: install] Error 1

The patch installs the target directory before copying any binaries.

$ sudo make install DOCKER_MAKE_INSTALL_PREFIX=/opt/docker AUTO_GOPATH=1
KEEPBUNDLE=1 hack/make.sh install-binary
# WARNING! I don't seem to be running in a Docker container.
# The result of this command might be an incorrect build, and will not be
# officially supported.
#
# Try this instead: make all
#

---> Making bundle: install-binary (in bundles/1.14.0-dev/install-binary)
Installing docker to /opt/docker/bin/
Installing dockerd to /opt/docker/bin/
Installing docker-runc to /opt/docker/bin/
Installing docker-containerd to /opt/docker/bin/
Installing docker-containerd-ctr to /opt/docker/bin/
Installing docker-containerd-shim to /opt/docker/bin/
Installing docker-proxy to /opt/docker/bin/
Installing docker-init to /opt/docker/bin/

Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>

Gaël PORTAY authored on 2017/01/28 06:54:33
Showing 1 changed files
... ...
@@ -251,6 +251,7 @@ install_binary() {
251 251
 	target="${DOCKER_MAKE_INSTALL_PREFIX:=/usr/local}/bin/"
252 252
 	if [ "$(go env GOOS)" == "linux" ]; then
253 253
 		echo "Installing $(basename $file) to ${target}"
254
+		mkdir -p "$target"
254 255
 		cp -L "$file" "$target"
255 256
 	else
256 257
 		echo "Install is only supported on linux"