github.com/docker/docker-ce@v17.12.1-ce-rc2+incompatible/components/packaging/deb/build-deb (about) 1 #!/usr/bin/env bash 2 set -x 3 set -e 4 # I want to rip this install-binaries script out so badly 5 cd engine 6 TMP_GOPATH="/go" bash hack/dockerfile/install-binaries.sh runc-dynamic containerd-dynamic proxy-dynamic tini 7 if [[ $? -ne 0 ]]; then 8 echo "Binaries required for package building not installed correctly." 9 echo "Exiting..." 10 exit 1 11 fi 12 cd - 13 echo VERSION AAA $VERSION 14 15 VERSION=${VERSION:-$( cat engine/VERSION )} 16 17 echo VERSION bbb $VERSION 18 export TZ=UTC 19 20 tilde='~' # ouch Bash 4.2 vs 4.3, you keel me 21 # git running in different directories, backwards compatible too 22 GIT_COMMAND="git --git-dir=/root/build-deb/engine/.git --work-tree=/root/build-deb/engine/" 23 debVersion="${VERSION//-/$tilde}" # using \~ or '~' here works in 4.3, but not 4.2; just ~ causes $HOME to be inserted, hence the $tilde 24 # if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better 25 if [[ "$VERSION" == *-dev ]]; then 26 # TODO: Re-introduce git commit time into version number 27 todaysDate="$(date +'%Y%m%d.%H%M%S')" 28 # We're guaranteed to have DOCKER_GITCOMMIT in the env 29 gitVersion="git${todaysDate}.0.${DOCKER_GITCOMMIT}" 30 # gitVersion is now something like 'git20150128.112847.0.17e840a' 31 debVersion="$debVersion~$gitVersion" 32 33 # $ dpkg --compare-versions 1.5.0 gt 1.5.0~rc1 && echo true || echo false 34 # true 35 # $ dpkg --compare-versions 1.5.0~rc1 gt 1.5.0~git20150128.112847.17e840a && echo true || echo false 36 # true 37 # $ dpkg --compare-versions 1.5.0~git20150128.112847.17e840a gt 1.5.0~dev~git20150128.112847.17e840a && echo true || echo false 38 # true 39 40 # ie, 1.5.0 > 1.5.0~rc1 > 1.5.0~git20150128.112847.17e840a > 1.5.0~dev~git20150128.112847.17e840a 41 fi 42 debSource="$(awk -F ': ' '$1 == "Source" { print $2; exit }' debian/control)" 43 debMaintainer="$(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' debian/control)" 44 debDate="$(date --rfc-2822)" 45 46 cat > "debian/changelog" <<-EOF 47 $debSource (${debVersion}-0~${DISTRO}) $SUITE; urgency=low 48 * Version: $VERSION 49 -- $debMaintainer $debDate 50 EOF 51 # The space above at the start of the line for the debMaintainer is very important 52 53 # Give the script a git commit because it wants it 54 export DOCKER_GITCOMMIT=${DOCKER_GITCOMMIT-$($GIT_COMMAND rev-parse --short HEAD)} 55 56 echo VERSION BBB $VERSION 57 dpkg-buildpackage -uc -us -I.git 58 destination="/build" 59 mkdir -p "$destination" 60 mv -v /root/docker-ce* "$destination"