2017-02-13 14:01:54 -05:00
|
|
|
#!/usr/bin/env bash
|
2015-06-01 20:21:09 -04:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# This script creates the apt repos for the .deb files generated by hack/make/build-deb
|
|
|
|
#
|
|
|
|
# The following can then be used as apt sources:
|
|
|
|
# deb http://apt.dockerproject.org/repo $distro-$release $version
|
|
|
|
#
|
|
|
|
# For example:
|
2015-12-20 10:00:53 -05:00
|
|
|
# deb http://apt.dockerproject.org/repo ubuntu-trusty main
|
|
|
|
# deb http://apt.dockerproject.org/repo ubuntu-trusty testing
|
2015-06-01 20:21:09 -04:00
|
|
|
# deb http://apt.dockerproject.org/repo debian-wheezy experimental
|
|
|
|
# deb http://apt.dockerproject.org/repo debian-jessie main
|
|
|
|
#
|
|
|
|
# ... and so on and so forth for the builds created by hack/make/build-deb
|
|
|
|
|
|
|
|
: ${DOCKER_RELEASE_DIR:=$DEST}
|
2015-08-25 15:27:25 -04:00
|
|
|
: ${GPG_KEYID:=releasedocker}
|
2015-06-01 20:21:09 -04:00
|
|
|
APTDIR=$DOCKER_RELEASE_DIR/apt/repo
|
|
|
|
|
|
|
|
# setup the apt repo (if it does not exist)
|
2016-06-09 09:22:49 -04:00
|
|
|
mkdir -p "$APTDIR/conf" "$APTDIR/db" "$APTDIR/dists"
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2015-09-01 21:26:56 -04:00
|
|
|
# supported arches/sections
|
2017-01-30 17:44:33 -05:00
|
|
|
arches=( amd64 i386 armhf ppc64le s390x )
|
2015-11-04 20:17:37 -05:00
|
|
|
|
|
|
|
# Preserve existing components but don't add any non-existing ones
|
|
|
|
for component in main testing experimental ; do
|
2016-06-02 10:38:32 -04:00
|
|
|
exists=$(find "$APTDIR/dists" -mindepth 2 -maxdepth 2 -type d -name "$component" -print -quit)
|
|
|
|
if [ -n "$exists" ] ; then
|
2015-11-04 20:17:37 -05:00
|
|
|
components+=( $component )
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# set the component for the version being released
|
|
|
|
component="main"
|
|
|
|
|
|
|
|
if [[ "$VERSION" == *-rc* ]]; then
|
|
|
|
component="testing"
|
|
|
|
fi
|
|
|
|
|
2016-10-06 10:09:54 -04:00
|
|
|
if [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
|
2015-11-04 20:17:37 -05:00
|
|
|
component="experimental"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure our component is in the list of components
|
|
|
|
if [[ ! "${components[*]}" =~ $component ]] ; then
|
|
|
|
components+=( $component )
|
|
|
|
fi
|
2015-09-01 21:26:56 -04:00
|
|
|
|
2016-02-23 18:22:03 -05:00
|
|
|
# create apt-ftparchive file on every run. This is essential to avoid
|
|
|
|
# using stale versions of the config file that could cause unnecessary
|
|
|
|
# refreshing of bits for EOL-ed releases.
|
|
|
|
cat <<-EOF > "$APTDIR/conf/apt-ftparchive.conf"
|
|
|
|
Dir {
|
|
|
|
ArchiveDir "${APTDIR}";
|
|
|
|
CacheDir "${APTDIR}/db";
|
|
|
|
};
|
|
|
|
|
|
|
|
Default {
|
|
|
|
Packages::Compress ". gzip bzip2";
|
|
|
|
Sources::Compress ". gzip bzip2";
|
|
|
|
Contents::Compress ". gzip bzip2";
|
|
|
|
};
|
|
|
|
|
|
|
|
TreeDefault {
|
|
|
|
BinCacheDB "packages-\$(SECTION)-\$(ARCH).db";
|
|
|
|
Directory "pool/\$(SECTION)";
|
|
|
|
Packages "\$(DIST)/\$(SECTION)/binary-\$(ARCH)/Packages";
|
|
|
|
SrcDirectory "pool/\$(SECTION)";
|
|
|
|
Sources "\$(DIST)/\$(SECTION)/source/Sources";
|
|
|
|
Contents "\$(DIST)/\$(SECTION)/Contents-\$(ARCH)";
|
|
|
|
FileList "$APTDIR/\$(DIST)/\$(SECTION)/filelist";
|
|
|
|
};
|
|
|
|
EOF
|
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
for dir in bundles/$VERSION/build-deb/*/; do
|
2016-03-08 14:08:00 -05:00
|
|
|
version="$(basename "$dir")"
|
|
|
|
suite="${version//debootstrap-}"
|
|
|
|
|
2016-02-23 18:22:03 -05:00
|
|
|
cat <<-EOF
|
|
|
|
Tree "dists/${suite}" {
|
|
|
|
Sections "${components[*]}";
|
|
|
|
Architectures "${arches[*]}";
|
|
|
|
}
|
2015-09-01 21:26:56 -04:00
|
|
|
|
2016-02-23 18:22:03 -05:00
|
|
|
EOF
|
|
|
|
done >> "$APTDIR/conf/apt-ftparchive.conf"
|
2015-09-01 21:26:56 -04:00
|
|
|
|
2016-06-02 10:38:32 -04:00
|
|
|
cat <<-EOF > "$APTDIR/conf/docker-engine-release.conf"
|
|
|
|
APT::FTPArchive::Release::Origin "Docker";
|
2016-06-21 14:57:33 -04:00
|
|
|
APT::FTPArchive::Release::Components "${components[*]}";
|
2016-06-02 10:38:32 -04:00
|
|
|
APT::FTPArchive::Release::Label "Docker APT Repository";
|
|
|
|
APT::FTPArchive::Release::Architectures "${arches[*]}";
|
|
|
|
EOF
|
2015-09-01 21:26:56 -04:00
|
|
|
|
2015-06-01 20:21:09 -04:00
|
|
|
# release the debs
|
2016-08-10 17:05:04 -04:00
|
|
|
for dir in bundles/$VERSION/build-deb/*/; do
|
2015-06-01 20:21:09 -04:00
|
|
|
version="$(basename "$dir")"
|
|
|
|
codename="${version//debootstrap-}"
|
|
|
|
|
2016-06-02 23:55:53 -04:00
|
|
|
tempdir="$(mktemp -d /tmp/tmp-docker-release-deb.XXXXXXXX)"
|
2016-08-10 17:05:04 -04:00
|
|
|
DEBFILE=( "$dir/docker-engine"*.deb )
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-06-02 23:55:53 -04:00
|
|
|
# add the deb for each component for the distro version into the
|
|
|
|
# pool (if it is not there already)
|
2015-09-03 16:17:21 -04:00
|
|
|
mkdir -p "$APTDIR/pool/$component/d/docker-engine/"
|
2016-06-02 23:55:53 -04:00
|
|
|
for deb in ${DEBFILE[@]}; do
|
|
|
|
d=$(basename "$deb")
|
|
|
|
# We do not want to generate a new deb if it has already been
|
|
|
|
# copied into the APTDIR
|
|
|
|
if [ ! -f "$APTDIR/pool/$component/d/docker-engine/$d" ]; then
|
|
|
|
cp "$deb" "$tempdir/"
|
|
|
|
# if we have a $GPG_PASSPHRASE we may as well
|
|
|
|
# dpkg-sign before copying the deb into the pool
|
|
|
|
if [ ! -z "$GPG_PASSPHRASE" ]; then
|
2016-11-04 12:45:13 -04:00
|
|
|
dpkg-sig -g "--no-tty --digest-algo 'sha512' --passphrase '$GPG_PASSPHRASE'" \
|
2016-06-02 23:55:53 -04:00
|
|
|
-k "$GPG_KEYID" --sign builder "$tempdir/$d"
|
|
|
|
fi
|
|
|
|
mv "$tempdir/$d" "$APTDIR/pool/$component/d/docker-engine/"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -rf "$tempdir"
|
2015-09-01 21:26:56 -04:00
|
|
|
|
2016-04-22 15:28:15 -04:00
|
|
|
# build the right directory structure, needed for apt-ftparchive
|
|
|
|
for arch in "${arches[@]}"; do
|
2016-08-10 17:05:04 -04:00
|
|
|
for c in "${components[@]}"; do
|
|
|
|
mkdir -p "$APTDIR/dists/$codename/$c/binary-$arch"
|
|
|
|
done
|
2016-04-22 15:28:15 -04:00
|
|
|
done
|
|
|
|
|
2015-09-01 21:26:56 -04:00
|
|
|
# update the filelist for this codename/component
|
|
|
|
find "$APTDIR/pool/$component" \
|
2016-10-27 14:04:38 -04:00
|
|
|
-name *~${codename}*.deb -o \
|
2015-09-01 21:26:56 -04:00
|
|
|
-name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist"
|
|
|
|
done
|
|
|
|
|
|
|
|
# run the apt-ftparchive commands so we can have pinning
|
|
|
|
apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"
|
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
for dir in bundles/$VERSION/build-deb/*/; do
|
2015-09-01 21:26:56 -04:00
|
|
|
version="$(basename "$dir")"
|
2015-10-13 18:34:43 -04:00
|
|
|
codename="${version//debootstrap-}"
|
2015-09-01 21:26:56 -04:00
|
|
|
|
|
|
|
apt-ftparchive \
|
2016-06-21 14:57:33 -04:00
|
|
|
-c "$APTDIR/conf/docker-engine-release.conf" \
|
2015-09-01 21:26:56 -04:00
|
|
|
-o "APT::FTPArchive::Release::Codename=$codename" \
|
|
|
|
-o "APT::FTPArchive::Release::Suite=$codename" \
|
|
|
|
release \
|
|
|
|
"$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release"
|
|
|
|
|
|
|
|
for arch in "${arches[@]}"; do
|
|
|
|
apt-ftparchive \
|
2016-06-21 14:57:33 -04:00
|
|
|
-c "$APTDIR/conf/docker-engine-release.conf" \
|
2015-09-01 21:26:56 -04:00
|
|
|
-o "APT::FTPArchive::Release::Codename=$codename" \
|
|
|
|
-o "APT::FTPArchive::Release::Suite=$codename" \
|
2016-06-21 14:57:33 -04:00
|
|
|
-o "APT::FTPArchive::Release::Components=$component" \
|
2015-09-01 21:26:56 -04:00
|
|
|
-o "APT::FTPArchive::Release::Architecture=$arch" \
|
|
|
|
release \
|
|
|
|
"$APTDIR/dists/$codename/$component/binary-$arch" > "$APTDIR/dists/$codename/$component/binary-$arch/Release"
|
|
|
|
done
|
2015-06-01 20:21:09 -04:00
|
|
|
done
|