github.com/mheon/docker@v0.11.2-0.20150922122814-44f47903a831/hack/make/release-deb (about) 1 #!/bin/bash 2 set -e 3 4 # This script creates the apt repos for the .deb files generated by hack/make/build-deb 5 # 6 # The following can then be used as apt sources: 7 # deb http://apt.dockerproject.org/repo $distro-$release $version 8 # 9 # For example: 10 # deb http://apt.dockerproject.org/repo ubuntu-trusy main 11 # deb http://apt.dockerproject.org/repo ubuntu-vivid testing 12 # deb http://apt.dockerproject.org/repo debian-wheezy experimental 13 # deb http://apt.dockerproject.org/repo debian-jessie main 14 # 15 # ... and so on and so forth for the builds created by hack/make/build-deb 16 17 : ${DOCKER_RELEASE_DIR:=$DEST} 18 APTDIR=$DOCKER_RELEASE_DIR/apt/repo 19 20 # setup the apt repo (if it does not exist) 21 mkdir -p "$APTDIR/conf" "$APTDIR/db" 22 23 # supported arches/sections 24 arches=( amd64 i386 ) 25 components=( main testing experimental ) 26 27 # create/update distributions file 28 if [ ! -f "$APTDIR/conf/distributions" ]; then 29 for suite in $(exec contrib/reprepro/suites.sh); do 30 cat <<-EOF 31 Origin: Docker 32 Suite: $suite 33 Codename: $suite 34 Architectures: ${arches[*]} 35 Components: ${components[*]} 36 Description: Docker APT Repository 37 38 EOF 39 done > "$APTDIR/conf/distributions" 40 fi 41 42 # create/update distributions file 43 if [ ! -f "$APTDIR/conf/apt-ftparchive.conf" ]; then 44 cat <<-EOF > "$APTDIR/conf/apt-ftparchive.conf" 45 Dir { 46 ArchiveDir "${APTDIR}"; 47 CacheDir "${APTDIR}/db"; 48 }; 49 50 Default { 51 Packages::Compress ". gzip bzip2"; 52 Sources::Compress ". gzip bzip2"; 53 Contents::Compress ". gzip bzip2"; 54 }; 55 56 TreeDefault { 57 BinCacheDB "packages-\$(SECTION)-\$(ARCH).db"; 58 Directory "pool/\$(SECTION)"; 59 Packages "\$(DIST)/\$(SECTION)/binary-\$(ARCH)/Packages"; 60 SrcDirectory "pool/\$(SECTION)"; 61 Sources "\$(DIST)/\$(SECTION)/source/Sources"; 62 Contents "\$(DIST)/\$(SECTION)/Contents-\$(ARCH)"; 63 FileList "$APTDIR/\$(DIST)/\$(SECTION)/filelist"; 64 }; 65 EOF 66 67 for suite in $(exec contrib/reprepro/suites.sh); do 68 cat <<-EOF 69 Tree "dists/${suite}" { 70 Sections "main testing experimental"; 71 Architectures "${arches[*]}"; 72 } 73 74 EOF 75 done >> "$APTDIR/conf/apt-ftparchive.conf" 76 fi 77 78 if [ ! -f "$APTDIR/conf/docker-engine-release.conf" ]; then 79 cat <<-EOF > "$APTDIR/conf/docker-engine-release.conf" 80 APT::FTPArchive::Release::Origin "Docker"; 81 APT::FTPArchive::Release::Components "${components[*]}"; 82 APT::FTPArchive::Release::Label "Docker APT Repository"; 83 APT::FTPArchive::Release::Architectures "${arches[*]}"; 84 EOF 85 fi 86 87 # set the component and priority for the version being released 88 component="main" 89 priority=700 90 options="--keepunreferencedfiles" 91 92 if [[ "$VERSION" == *-rc* ]]; then 93 component="testing" 94 priority=650 95 fi 96 97 if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then 98 component="experimental" 99 priority=600 100 options= 101 fi 102 103 # release the debs 104 for dir in contrib/builder/deb/*/; do 105 version="$(basename "$dir")" 106 codename="${version//debootstrap-}" 107 108 DEBFILE=( "bundles/$VERSION/build-deb/$version/docker-engine"*.deb ) 109 110 # if we have a $GPG_PASSPHRASE we may as well 111 # dpkg-sign before copying the deb into the pool 112 if [ ! -z "$GPG_PASSPHRASE" ]; then 113 dpkg-sig -g "--passphrase $GPG_PASSPHRASE" \ 114 -k releasedocker --sign builder "${DEBFILE[@]}" 115 fi 116 117 # add the deb for each component for the distro version into the pool 118 mkdir -p "$APTDIR/pool/$component/d/docker-engine/" 119 cp "${DEBFILE[@]}" "$APTDIR/pool/$component/d/docker-engine/" 120 121 # update the filelist for this codename/component 122 find "$APTDIR/pool/$component" \ 123 -name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist" 124 done 125 126 127 # run the apt-ftparchive commands so we can have pinning 128 apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf" 129 130 for dir in contrib/builder/deb/*/; do 131 version="$(basename "$dir")" 132 codename="${version//debootstrap-}" 133 134 apt-ftparchive \ 135 -o "APT::FTPArchive::Release::Codename=$codename" \ 136 -o "APT::FTPArchive::Release::Suite=$codename" \ 137 -c "$APTDIR/conf/docker-engine-release.conf" \ 138 release \ 139 "$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release" 140 141 for arch in "${arches[@]}"; do 142 apt-ftparchive \ 143 -o "APT::FTPArchive::Release::Codename=$codename" \ 144 -o "APT::FTPArchive::Release::Suite=$codename" \ 145 -o "APT::FTPArchive::Release::Component=$component" \ 146 -o "APT::FTPArchive::Release::Architecture=$arch" \ 147 -c "$APTDIR/conf/docker-engine-release.conf" \ 148 release \ 149 "$APTDIR/dists/$codename/$component/binary-$arch" > "$APTDIR/dists/$codename/$component/binary-$arch/Release" 150 done 151 done