2015-06-01 20:21:09 -04:00
|
|
|
#!/bin/bash
|
|
|
|
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:
|
|
|
|
# deb http://apt.dockerproject.org/repo ubuntu-trusy main
|
|
|
|
# deb http://apt.dockerproject.org/repo ubuntu-vivid testing
|
|
|
|
# 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)
|
|
|
|
mkdir -p "$APTDIR/conf" "$APTDIR/db"
|
|
|
|
|
2015-09-01 21:26:56 -04:00
|
|
|
# supported arches/sections
|
|
|
|
arches=( amd64 i386 )
|
|
|
|
components=( main testing experimental )
|
|
|
|
|
2015-06-01 20:21:09 -04:00
|
|
|
# create/update distributions file
|
2015-09-01 21:26:56 -04:00
|
|
|
if [ ! -f "$APTDIR/conf/distributions" ]; then
|
2015-07-27 19:26:35 -04:00
|
|
|
for suite in $(exec contrib/reprepro/suites.sh); do
|
|
|
|
cat <<-EOF
|
|
|
|
Origin: Docker
|
|
|
|
Suite: $suite
|
|
|
|
Codename: $suite
|
2015-09-01 21:26:56 -04:00
|
|
|
Architectures: ${arches[*]}
|
|
|
|
Components: ${components[*]}
|
2015-07-27 19:26:35 -04:00
|
|
|
Description: Docker APT Repository
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2015-07-27 19:26:35 -04:00
|
|
|
EOF
|
|
|
|
done > "$APTDIR/conf/distributions"
|
|
|
|
fi
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2015-09-01 21:26:56 -04:00
|
|
|
# create/update distributions file
|
|
|
|
if [ ! -f "$APTDIR/conf/apt-ftparchive.conf" ]; then
|
|
|
|
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
|
|
|
|
|
|
|
|
for suite in $(exec contrib/reprepro/suites.sh); do
|
|
|
|
cat <<-EOF
|
|
|
|
Tree "dists/${suite}" {
|
|
|
|
Sections "main testing experimental";
|
|
|
|
Architectures "${arches[*]}";
|
|
|
|
}
|
|
|
|
|
|
|
|
EOF
|
|
|
|
done >> "$APTDIR/conf/apt-ftparchive.conf"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$APTDIR/conf/docker-engine-release.conf" ]; then
|
|
|
|
cat <<-EOF > "$APTDIR/conf/docker-engine-release.conf"
|
|
|
|
APT::FTPArchive::Release::Origin "Docker";
|
|
|
|
APT::FTPArchive::Release::Components "${components[*]}";
|
|
|
|
APT::FTPArchive::Release::Label "Docker APT Repository";
|
|
|
|
APT::FTPArchive::Release::Architectures "${arches[*]}";
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2015-06-01 20:21:09 -04:00
|
|
|
# set the component and priority for the version being released
|
|
|
|
component="main"
|
|
|
|
priority=700
|
2015-08-06 17:43:58 -04:00
|
|
|
options="--keepunreferencedfiles"
|
2015-06-01 20:21:09 -04:00
|
|
|
|
|
|
|
if [[ "$VERSION" == *-rc* ]]; then
|
|
|
|
component="testing"
|
|
|
|
priority=650
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
|
|
|
|
component="experimental"
|
|
|
|
priority=600
|
2015-08-06 17:43:58 -04:00
|
|
|
options=
|
2015-06-01 20:21:09 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
# release the debs
|
|
|
|
for dir in contrib/builder/deb/*/; do
|
|
|
|
version="$(basename "$dir")"
|
|
|
|
codename="${version//debootstrap-}"
|
|
|
|
|
|
|
|
DEBFILE=( "bundles/$VERSION/build-deb/$version/docker-engine"*.deb )
|
|
|
|
|
|
|
|
# if we have a $GPG_PASSPHRASE we may as well
|
2015-09-03 16:17:21 -04:00
|
|
|
# dpkg-sign before copying the deb into the pool
|
2015-06-01 20:21:09 -04:00
|
|
|
if [ ! -z "$GPG_PASSPHRASE" ]; then
|
|
|
|
dpkg-sig -g "--passphrase $GPG_PASSPHRASE" \
|
2015-08-25 15:27:25 -04:00
|
|
|
-k "$GPG_KEYID" --sign builder "${DEBFILE[@]}"
|
2015-06-01 20:21:09 -04:00
|
|
|
fi
|
|
|
|
|
2015-09-03 16:17:21 -04:00
|
|
|
# add the deb for each component for the distro version into the pool
|
|
|
|
mkdir -p "$APTDIR/pool/$component/d/docker-engine/"
|
|
|
|
cp "${DEBFILE[@]}" "$APTDIR/pool/$component/d/docker-engine/"
|
2015-09-01 21:26:56 -04:00
|
|
|
|
|
|
|
# update the filelist for this codename/component
|
|
|
|
find "$APTDIR/pool/$component" \
|
|
|
|
-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"
|
|
|
|
|
|
|
|
for dir in contrib/builder/deb/*/; do
|
|
|
|
version="$(basename "$dir")"
|
|
|
|
codename="${version//debootstrap-}"
|
|
|
|
|
|
|
|
apt-ftparchive \
|
|
|
|
-o "APT::FTPArchive::Release::Codename=$codename" \
|
|
|
|
-o "APT::FTPArchive::Release::Suite=$codename" \
|
|
|
|
-c "$APTDIR/conf/docker-engine-release.conf" \
|
|
|
|
release \
|
|
|
|
"$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release"
|
|
|
|
|
|
|
|
for arch in "${arches[@]}"; do
|
|
|
|
apt-ftparchive \
|
|
|
|
-o "APT::FTPArchive::Release::Codename=$codename" \
|
|
|
|
-o "APT::FTPArchive::Release::Suite=$codename" \
|
|
|
|
-o "APT::FTPArchive::Release::Component=$component" \
|
|
|
|
-o "APT::FTPArchive::Release::Architecture=$arch" \
|
|
|
|
-c "$APTDIR/conf/docker-engine-release.conf" \
|
|
|
|
release \
|
|
|
|
"$APTDIR/dists/$codename/$component/binary-$arch" > "$APTDIR/dists/$codename/$component/binary-$arch/Release"
|
|
|
|
done
|
2015-06-01 20:21:09 -04:00
|
|
|
done
|