mirror of
https://github.com/genuinetools/reg.git
synced 2024-10-03 22:01:45 -04:00
8e5eba8735
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
60 lines
2.4 KiB
Bash
Executable file
60 lines
2.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -x
|
|
set -e
|
|
# I want to rip this install-binaries script out so badly
|
|
cd engine
|
|
TMP_GOPATH="/go" bash hack/dockerfile/install-binaries.sh runc-dynamic containerd-dynamic proxy-dynamic tini
|
|
if [[ $? -ne 0 ]]; then
|
|
echo "Binaries required for package building not installed correctly."
|
|
echo "Exiting..."
|
|
exit 1
|
|
fi
|
|
cd -
|
|
echo VERSION AAA $VERSION
|
|
|
|
VERSION=${VERSION:-$( cat engine/VERSION )}
|
|
|
|
echo VERSION bbb $VERSION
|
|
export TZ=UTC
|
|
|
|
tilde='~' # ouch Bash 4.2 vs 4.3, you keel me
|
|
# git running in different directories, backwards compatible too
|
|
GIT_COMMAND="git --git-dir=/root/build-deb/engine/.git --work-tree=/root/build-deb/engine/"
|
|
debVersion="${VERSION//-/$tilde}" # using \~ or '~' here works in 4.3, but not 4.2; just ~ causes $HOME to be inserted, hence the $tilde
|
|
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
|
|
if [[ "$VERSION" == *-dev ]]; then
|
|
# TODO: Re-introduce git commit time into version number
|
|
todaysDate="$(date +'%Y%m%d.%H%M%S')"
|
|
# We're guaranteed to have DOCKER_GITCOMMIT in the env
|
|
gitVersion="git${todaysDate}.0.${DOCKER_GITCOMMIT}"
|
|
# gitVersion is now something like 'git20150128.112847.0.17e840a'
|
|
debVersion="$debVersion~$gitVersion"
|
|
|
|
# $ dpkg --compare-versions 1.5.0 gt 1.5.0~rc1 && echo true || echo false
|
|
# true
|
|
# $ dpkg --compare-versions 1.5.0~rc1 gt 1.5.0~git20150128.112847.17e840a && echo true || echo false
|
|
# true
|
|
# $ dpkg --compare-versions 1.5.0~git20150128.112847.17e840a gt 1.5.0~dev~git20150128.112847.17e840a && echo true || echo false
|
|
# true
|
|
|
|
# ie, 1.5.0 > 1.5.0~rc1 > 1.5.0~git20150128.112847.17e840a > 1.5.0~dev~git20150128.112847.17e840a
|
|
fi
|
|
debSource="$(awk -F ': ' '$1 == "Source" { print $2; exit }' debian/control)"
|
|
debMaintainer="$(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' debian/control)"
|
|
debDate="$(date --rfc-2822)"
|
|
|
|
cat > "debian/changelog" <<-EOF
|
|
$debSource (${debVersion}-0~${DISTRO}) $SUITE; urgency=low
|
|
* Version: $VERSION
|
|
-- $debMaintainer $debDate
|
|
EOF
|
|
# The space above at the start of the line for the debMaintainer is very important
|
|
|
|
# Give the script a git commit because it wants it
|
|
export DOCKER_GITCOMMIT=${DOCKER_GITCOMMIT-$($GIT_COMMAND rev-parse --short HEAD)}
|
|
|
|
echo VERSION BBB $VERSION
|
|
dpkg-buildpackage -uc -us -I.git
|
|
destination="/build"
|
|
mkdir -p "$destination"
|
|
mv -v /root/docker-ce* "$destination"
|