2015-06-01 20:21:09 -04:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# This script creates the yum repos for the .rpm files generated by hack/make/build-rpm
|
|
|
|
#
|
|
|
|
# The following can then be used as a yum repo:
|
|
|
|
# http://yum.dockerproject.org/repo/$release/$distro/$distro-version
|
|
|
|
#
|
|
|
|
# For example:
|
2015-12-19 18:27:02 -05:00
|
|
|
# http://yum.dockerproject.org/repo/main/fedora/23
|
|
|
|
# http://yum.dockerproject.org/repo/testing/centos/7
|
|
|
|
# http://yum.dockerproject.org/repo/experimental/fedora/23
|
2015-06-01 20:21:09 -04:00
|
|
|
# http://yum.dockerproject.org/repo/main/centos/7
|
|
|
|
#
|
|
|
|
# ... and so on and so forth for the builds created by hack/make/build-rpm
|
|
|
|
|
|
|
|
: ${DOCKER_RELEASE_DIR:=$DEST}
|
|
|
|
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo
|
2015-08-25 15:27:25 -04:00
|
|
|
: ${GPG_KEYID:=releasedocker}
|
2015-06-01 20:21:09 -04:00
|
|
|
|
|
|
|
# get the release
|
|
|
|
release="main"
|
|
|
|
|
|
|
|
if [[ "$VERSION" == *-rc* ]]; then
|
|
|
|
release="testing"
|
|
|
|
fi
|
|
|
|
|
2016-10-06 10:09:54 -04:00
|
|
|
if [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
|
2015-06-01 20:21:09 -04:00
|
|
|
release="experimental"
|
|
|
|
fi
|
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
# Setup the yum repo
|
|
|
|
for dir in bundles/$VERSION/build-rpm/*/; do
|
|
|
|
version="$(basename "$dir")"
|
|
|
|
suite="${version##*-}"
|
2016-08-12 19:50:10 -04:00
|
|
|
distro="${version%-*}"
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-08-12 19:50:10 -04:00
|
|
|
REPO=$YUMDIR/$release/$distro
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
# if the directory does not exist, initialize the yum repo
|
|
|
|
if [[ ! -d $REPO/$suite/Packages ]]; then
|
|
|
|
mkdir -p "$REPO/$suite/Packages"
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
createrepo --pretty "$REPO/$suite"
|
|
|
|
fi
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
# path to rpms
|
|
|
|
RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm )
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
# if we have a $GPG_PASSPHRASE we may as well
|
|
|
|
# sign the rpms before adding to repo
|
|
|
|
if [ ! -z $GPG_PASSPHRASE ]; then
|
|
|
|
# export our key to rpm import
|
|
|
|
gpg --armor --export "$GPG_KEYID" > /tmp/gpg
|
|
|
|
rpm --import /tmp/gpg
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
# sign the rpms
|
|
|
|
echo "yes" | setsid rpm \
|
|
|
|
--define "_gpg_name $GPG_KEYID" \
|
|
|
|
--define "_signature gpg" \
|
|
|
|
--define "__gpg_check_password_cmd /bin/true" \
|
|
|
|
--define "__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --passphrase '$GPG_PASSPHRASE' --no-secmem-warning -u '%{_gpg_name}' --sign --detach-sign --output %{__signature_filename} %{__plaintext_filename}" \
|
|
|
|
--resign "${RPMFILE[@]}"
|
|
|
|
fi
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
# copy the rpms to the packages folder
|
|
|
|
cp "${RPMFILE[@]}" "$REPO/$suite/Packages"
|
2015-06-01 20:21:09 -04:00
|
|
|
|
2016-08-10 17:05:04 -04:00
|
|
|
# update the repo
|
|
|
|
createrepo --pretty --update "$REPO/$suite"
|
2015-06-01 20:21:09 -04:00
|
|
|
done
|