github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/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")/.integration-daemon-start" 18 source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch" 19 20 : ${DOCKER_RELEASE_DIR:=$DEST} 21 YUMDIR=$DOCKER_RELEASE_DIR/yum/repo 22 : ${GPG_KEYID:=releasedocker} 23 24 # manage the repos for each distribution separately 25 distros=( fedora centos opensuse oraclelinux ) 26 27 # get the release 28 release="main" 29 30 if [[ "$VERSION" == *-rc* ]]; then 31 release="testing" 32 fi 33 34 if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then 35 release="experimental" 36 fi 37 38 for distro in "${distros[@]}"; do 39 # Setup the yum repo 40 REPO=$YUMDIR/$release/$distro 41 42 for dir in contrib/builder/rpm/${PACKAGE_ARCH}/$distro-*/; do 43 version="$(basename "$dir")" 44 suite="${version##*-}" 45 46 # if the directory does not exist, initialize the yum repo 47 if [[ ! -d $REPO/$suite/Packages ]]; then 48 mkdir -p "$REPO/$suite/Packages" 49 50 createrepo --pretty "$REPO/$suite" 51 fi 52 53 # path to rpms 54 RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm ) 55 56 # if we have a $GPG_PASSPHRASE we may as well 57 # sign the rpms before adding to repo 58 if [ ! -z $GPG_PASSPHRASE ]; then 59 # export our key to rpm import 60 gpg --armor --export "$GPG_KEYID" > /tmp/gpg 61 rpm --import /tmp/gpg 62 63 # sign the rpms 64 echo "yes" | setsid rpm \ 65 --define "_gpg_name $GPG_KEYID" \ 66 --define "_signature gpg" \ 67 --define "__gpg_check_password_cmd /bin/true" \ 68 --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}" \ 69 --resign "${RPMFILE[@]}" 70 fi 71 72 # copy the rpms to the packages folder 73 cp "${RPMFILE[@]}" "$REPO/$suite/Packages" 74 75 # update the repo 76 createrepo --pretty --update "$REPO/$suite" 77 done 78 done