# NOTE: Docker uses their own versions of several programs, installed as docker-* # They could be installed separately, and linked with their docker-* names, # but docker is very picky about exactly which commit of these it's running. # As such, I will bundle the docker-specific versions in this package, # instead of spreading them over multiple packages. # The exact commit number for these programs is specified in # components/engine/hack/dockerfile/binaries-commits in the docker archive. name=docker version=17.09.0-ce version_runc=3f2f8b84a77f73d38244dd690525642a72156c64 version_containerd=06b9cb35161009dcb7123345749fef02f7cea8e0 version_tini=949e6facb77383876aeff8a6944dde66b3089574 version_libnetwork=7b2b1feb1de4817d522cc372af149ff48d25028e update_url="https://github.com/$name/$name-ce/releases" update_names="/archive/v$version.tar.gz" dlextract "https://github.com/$name/$name-ce/archive/v$version/$name-$version.tar.gz" \ 'e0df90392b2daa545562342dabf181cf' dlextract "https://github.com/opencontainers/runc/archive/$version_runc/runc-$version_runc.tar.gz" \ '0dc3b1eafba193280d6cf6ffa46c2521' dlextract "https://github.com/containerd/containerd/archive/$version_containerd/containerd-$version_containerd.tar.gz" \ '202389709618a6b181216e99718f0132' dlextract "https://github.com/krallin/tini/archive/$version_tini/tini-$version_tini.tar.gz" \ '9873191fc835a79cb94b24377391667e' dlextract "https://github.com/$name/libnetwork/archive/$version_libnetwork/libnetwork-$version_libnetwork.tar.gz" \ 'a9beb9207b291373dc4e376f04056e8a' _ # Verify that the dependency programs' versions match # This should avoid the packager to have to manually check the file every update ( . "$name-ce-$version/components/engine/hack/dockerfile/binaries-commits" mismatches="" for dependency in runc containerd tini libnetwork; do if [ "$(eval echo \${version_$dependency})" != \ "$(eval echo \${$(echo $dependency | tr a-z A-Z)_COMMIT})" ]; then mismatches+="$dependency: $(eval echo \${$(echo $dependency | tr a-z A-Z)_COMMIT}) " fi done if [ "$mismatches" ]; then echo "Error: Mismatching commit for one or more dependencies" printf "%s" "$mismatches" exit 1 fi ) # Some scripts apparently like to pick up and misuse LDFLAGS for go unset LDFLAGS # Set up a fake GOPATH mkdir -p ".gopath/src/github.com/$name" \ '.gopath/src/github.com/opencontainers' \ '.gopath/src/github.com/containerd' ln -rs "$name-ce-$version/components/cli" ".gopath/src/github.com/$name/cli" ln -rs "$name-ce-$version/components/engine" ".gopath/src/github.com/$name/$name" ln -rs "runc-$version_runc" '.gopath/src/github.com/opencontainers/runc' ln -rs "containerd-$version_containerd" '.gopath/src/github.com/containerd/containerd' ln -rs "libnetwork-$version_libnetwork" ".gopath/src/github.com/$name/libnetwork" export GOPATH="$PWD/.gopath" # Build engine ( cd "$name-ce-$version/components/engine" DOCKER_GITCOMMIT="$version" \ DOCKER_BUILDTAGS='seccomp' \ hack/make.sh dynbinary ) # Build cli ( cd "$name-ce-$version/components/cli" DISABLE_WARN_OUTSIDE_CONTAINER=1 make VERSION="$version" GITCOMMIT="$version" dynbinary mkdir -p man/man1 go build -o gen-manpages "github.com/$name/cli/man" ./gen-manpages --root . --target man/man1 if command -v go-md2man 2> /dev/null; then ./man/md2man-all.sh -q fi ) # Build runc ( cd "$GOPATH/src/github.com/opencontainers/runc" make BUILDTAGS='seccomp' \ GIT_BRANCH=HEAD \ COMMIT_NO="$version_runc" \ COMMIT="$version_runc" ) # Build containerd ( cd "$GOPATH/src/github.com/containerd/containerd" make BUILDTAGS='seccomp' \ GIT_BRANCH=HEAD \ GIT_COMMIT="$version_containerd" ) # Build tini ( cd "tini-$version_tini" cmake . sed -i -e '/^#define TINI_GIT/d' tiniConfig.h echo "#define TINI_GIT \" - git.$(echo "$version_tini" | cut -c -7)\"" >> tiniConfig.h make tini-static ) # Build proxy ( cd "libnetwork-$version_libnetwork" go build -v -ldflags="-linkmode=external" -o proxy ./cmd/proxy ) # Install engine ( cd "$name-ce-$version/components/engine" install -Dm755 -t "$dir_install/$dir_prefix/$dir_bin" "bundles/latest/dynbinary-daemon/${name}d" install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/vim/vimfiles/syntax" \ contrib/syntax/vim/syntax/dockerfile.vim install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/vim/vimfiles/ftdetect" \ contrib/syntax/vim/ftdetect/dockerfile.vim ) # Install cli ( cd "$name-ce-$version/components/cli" install -Dm755 -t "$dir_install/$dir_prefix/$dir_bin" "build/$name" install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/bash-completion/completions" \ "contrib/completion/bash/$name" install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/zsh/site-functions" \ "contrib/completion/zsh/_$name" install -Dm644 -t "$dir_install/$dir_prefix/$dir_data/fish/vendor_completions.d" \ "contrib/completion/fish/$name.fish" mkdir -p "$dir_install/$dir_prefix/$dir_man" cp -at "$dir_install/$dir_prefix/$dir_man" man/man* ) # Install runc install -Dm755 "runc-$version_runc/runc" \ "$dir_install/$dir_prefix/$dir_bin/$name-runc" # Install containerd install -Dm755 "containerd-$version_containerd/bin/containerd" \ "$dir_install/$dir_prefix/$dir_bin/$name-containerd" install -Dm755 "containerd-$version_containerd/bin/containerd-shim" \ "$dir_install/$dir_prefix/$dir_bin/$name-containerd-shim" install -Dm755 "containerd-$version_containerd/bin/ctr" \ "$dir_install/$dir_prefix/$dir_bin/$name-containerd-ctr" # Install tini install -Dm755 "tini-$version_tini/tini-static" \ "$dir_install/$dir_prefix/$dir_bin/$name-init" # Install proxy install -Dm755 "libnetwork-$version_libnetwork/proxy" \ "$dir_install/$dir_prefix/$dir_bin/$name-proxy" # vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: