github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/hack/make/release-rpm (about) 1 #!/bin/bash 2 set -e 3 4 # This script creates the yum repos for the .rpm files generated by hack/make/build-rpm 5 # 6 # The following can then be used as a yum repo: 7 # http://yum.dockerproject.org/repo/$release/$distro/$distro-version 8 # 9 # For example: 10 # http://yum.dockerproject.org/repo/main/fedora/23 11 # http://yum.dockerproject.org/repo/testing/centos/7 12 # http://yum.dockerproject.org/repo/experimental/fedora/23 13 # http://yum.dockerproject.org/repo/main/centos/7 14 # 15 # ... and so on and so forth for the builds created by hack/make/build-rpm 16 17 source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch" 18 19 : ${DOCKER_RELEASE_DIR:=$DEST} 20 YUMDIR=$DOCKER_RELEASE_DIR/yum/repo 21 : ${GPG_KEYID:=releasedocker} 22 23 # manage the repos for each distribution separately 24 distros=( fedora centos opensuse oraclelinux ) 25 26 # get the release 27 release="main" 28 29 if [[ "$VERSION" == *-rc* ]]; then 30 release="testing" 31 fi 32 33 if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then 34 release="experimental" 35 fi 36 37 for distro in "${distros[@]}"; do 38 # Setup the yum repo 39 REPO=$YUMDIR/$release/$distro 40 41 for dir in contrib/builder/rpm/${PACKAGE_ARCH}/$distro-*/; do 42 version="$(basename "$dir")" 43 suite="${version##*-}" 44 45 # if the directory does not exist, initialize the yum repo 46 if [[ ! -d $REPO/$suite/Packages ]]; then 47 mkdir -p "$REPO/$suite/Packages" 48 49 createrepo --pretty "$REPO/$suite" 50 fi 51 52 # path to rpms 53 RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm ) 54 55 # if we have a $GPG_PASSPHRASE we may as well 56 # sign the rpms before adding to repo 57 if [ ! -z $GPG_PASSPHRASE ]; then 58 # export our key to rpm import 59 gpg --armor --export "$GPG_KEYID" > /tmp/gpg 60 rpm --import /tmp/gpg 61 62 # sign the rpms 63 echo "yes" | setsid rpm \ 64 --define "_gpg_name $GPG_KEYID" \ 65 --define "_signature gpg" \ 66 --define "__gpg_check_password_cmd /bin/true" \ 67 --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}" \ 68 --resign "${RPMFILE[@]}" 69 fi 70 71 # copy the rpms to the packages folder 72 cp "${RPMFILE[@]}" "$REPO/$suite/Packages" 73 74 # update the repo 75 createrepo --pretty --update "$REPO/$suite" 76 done 77 done