2015-06-02 03:21:09 +03: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-20 02:27:02 +03: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-02 03:21:09 +03:00
|
|
|
# http://yum.dockerproject.org/repo/main/centos/7
|
|
|
|
#
|
|
|
|
# ... and so on and so forth for the builds created by hack/make/build-rpm
|
|
|
|
|
2016-03-25 17:54:36 +03:00
|
|
|
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
|
2016-02-08 21:57:04 +03:00
|
|
|
source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
|
|
|
|
|
2015-06-02 03:21:09 +03:00
|
|
|
: ${DOCKER_RELEASE_DIR:=$DEST}
|
|
|
|
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo
|
2015-08-25 22:27:25 +03:00
|
|
|
: ${GPG_KEYID:=releasedocker}
|
2015-06-02 03:21:09 +03:00
|
|
|
|
2015-08-08 01:24:18 +03:00
|
|
|
# manage the repos for each distribution separately
|
2015-09-15 23:13:22 +03:00
|
|
|
distros=( fedora centos opensuse oraclelinux )
|
2015-06-02 03:21:09 +03:00
|
|
|
|
|
|
|
# get the release
|
|
|
|
release="main"
|
|
|
|
|
|
|
|
if [[ "$VERSION" == *-rc* ]]; then
|
|
|
|
release="testing"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
|
|
|
|
release="experimental"
|
|
|
|
fi
|
|
|
|
|
|
|
|
for distro in "${distros[@]}"; do
|
|
|
|
# Setup the yum repo
|
|
|
|
REPO=$YUMDIR/$release/$distro
|
|
|
|
|
2015-11-23 22:00:43 +03:00
|
|
|
for dir in contrib/builder/rpm/${PACKAGE_ARCH}/$distro-*/; do
|
2015-06-02 03:21:09 +03:00
|
|
|
version="$(basename "$dir")"
|
|
|
|
suite="${version##*-}"
|
|
|
|
|
2015-08-08 01:24:18 +03:00
|
|
|
# if the directory does not exist, initialize the yum repo
|
2015-06-02 03:21:09 +03:00
|
|
|
if [[ ! -d $REPO/$suite/Packages ]]; then
|
|
|
|
mkdir -p "$REPO/$suite/Packages"
|
|
|
|
|
|
|
|
createrepo --pretty "$REPO/$suite"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# path to rpms
|
2015-09-03 18:58:33 +03:00
|
|
|
RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm )
|
2015-06-02 03:21:09 +03: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
|
2015-08-25 22:27:25 +03:00
|
|
|
gpg --armor --export "$GPG_KEYID" > /tmp/gpg
|
2015-06-02 03:21:09 +03:00
|
|
|
rpm --import /tmp/gpg
|
|
|
|
|
|
|
|
# sign the rpms
|
2015-08-07 01:58:53 +03:00
|
|
|
echo "yes" | setsid rpm \
|
2015-08-25 22:27:25 +03:00
|
|
|
--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}" \
|
2015-06-02 03:21:09 +03:00
|
|
|
--resign "${RPMFILE[@]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# copy the rpms to the packages folder
|
2015-10-20 01:14:44 +03:00
|
|
|
cp "${RPMFILE[@]}" "$REPO/$suite/Packages"
|
2015-06-02 03:21:09 +03:00
|
|
|
|
|
|
|
# update the repo
|
|
|
|
createrepo --pretty --update "$REPO/$suite"
|
|
|
|
done
|
|
|
|
done
|