github.com/ncdc/docker@v0.10.1-0.20160129113957-6c6729ef5b74/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-trusty main 11 # deb http://apt.dockerproject.org/repo ubuntu-trusty 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 : ${GPG_KEYID:=releasedocker} 19 APTDIR=$DOCKER_RELEASE_DIR/apt/repo 20 21 # setup the apt repo (if it does not exist) 22 mkdir -p "$APTDIR/conf" "$APTDIR/db" 23 24 # supported arches/sections 25 arches=( amd64 i386 ) 26 27 # Preserve existing components but don't add any non-existing ones 28 for component in main testing experimental ; do 29 if ls "$APTDIR/dists/*/$component" >/dev/null 2>&1 ; then 30 components+=( $component ) 31 fi 32 done 33 34 # set the component for the version being released 35 component="main" 36 37 if [[ "$VERSION" == *-rc* ]]; then 38 component="testing" 39 fi 40 41 if [ "$DOCKER_EXPERIMENTAL" ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then 42 component="experimental" 43 fi 44 45 # Make sure our component is in the list of components 46 if [[ ! "${components[*]}" =~ $component ]] ; then 47 components+=( $component ) 48 fi 49 50 # create/update apt-ftparchive file 51 if [ ! -f "$APTDIR/conf/apt-ftparchive.conf" ]; then 52 cat <<-EOF > "$APTDIR/conf/apt-ftparchive.conf" 53 Dir { 54 ArchiveDir "${APTDIR}"; 55 CacheDir "${APTDIR}/db"; 56 }; 57 58 Default { 59 Packages::Compress ". gzip bzip2"; 60 Sources::Compress ". gzip bzip2"; 61 Contents::Compress ". gzip bzip2"; 62 }; 63 64 TreeDefault { 65 BinCacheDB "packages-\$(SECTION)-\$(ARCH).db"; 66 Directory "pool/\$(SECTION)"; 67 Packages "\$(DIST)/\$(SECTION)/binary-\$(ARCH)/Packages"; 68 SrcDirectory "pool/\$(SECTION)"; 69 Sources "\$(DIST)/\$(SECTION)/source/Sources"; 70 Contents "\$(DIST)/\$(SECTION)/Contents-\$(ARCH)"; 71 FileList "$APTDIR/\$(DIST)/\$(SECTION)/filelist"; 72 }; 73 EOF 74 75 for suite in $(exec contrib/reprepro/suites.sh); do 76 cat <<-EOF 77 Tree "dists/${suite}" { 78 Sections "${components[*]}"; 79 Architectures "${arches[*]}"; 80 } 81 82 EOF 83 done >> "$APTDIR/conf/apt-ftparchive.conf" 84 fi 85 86 if [ ! -f "$APTDIR/conf/docker-engine-release.conf" ]; then 87 cat <<-EOF > "$APTDIR/conf/docker-engine-release.conf" 88 APT::FTPArchive::Release::Origin "Docker"; 89 APT::FTPArchive::Release::Components "${components[*]}"; 90 APT::FTPArchive::Release::Label "Docker APT Repository"; 91 APT::FTPArchive::Release::Architectures "${arches[*]}"; 92 EOF 93 fi 94 95 # release the debs 96 for dir in contrib/builder/deb/*/; do 97 version="$(basename "$dir")" 98 codename="${version//debootstrap-}" 99 100 DEBFILE=( "bundles/$VERSION/build-deb/$version/docker-engine"*.deb ) 101 102 # if we have a $GPG_PASSPHRASE we may as well 103 # dpkg-sign before copying the deb into the pool 104 if [ ! -z "$GPG_PASSPHRASE" ]; then 105 dpkg-sig -g "--no-tty --passphrase '$GPG_PASSPHRASE'" \ 106 -k "$GPG_KEYID" --sign builder "${DEBFILE[@]}" 107 fi 108 109 # add the deb for each component for the distro version into the pool 110 mkdir -p "$APTDIR/pool/$component/d/docker-engine/" 111 cp "${DEBFILE[@]}" "$APTDIR/pool/$component/d/docker-engine/" 112 113 # update the filelist for this codename/component 114 mkdir -p "$APTDIR/dists/$codename/$component" 115 find "$APTDIR/pool/$component" \ 116 -name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist" 117 done 118 119 # clean the databases 120 apt-ftparchive clean "$APTDIR/conf/apt-ftparchive.conf" 121 122 # run the apt-ftparchive commands so we can have pinning 123 apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf" 124 125 for dir in contrib/builder/deb/*/; do 126 version="$(basename "$dir")" 127 codename="${version//debootstrap-}" 128 129 apt-ftparchive \ 130 -o "APT::FTPArchive::Release::Codename=$codename" \ 131 -o "APT::FTPArchive::Release::Suite=$codename" \ 132 -c "$APTDIR/conf/docker-engine-release.conf" \ 133 release \ 134 "$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release" 135 136 for arch in "${arches[@]}"; do 137 mkdir -p "$APTDIR/dists/$codename/$component/binary-$arch" 138 apt-ftparchive \ 139 -o "APT::FTPArchive::Release::Codename=$codename" \ 140 -o "APT::FTPArchive::Release::Suite=$codename" \ 141 -o "APT::FTPArchive::Release::Component=$component" \ 142 -o "APT::FTPArchive::Release::Architecture=$arch" \ 143 -c "$APTDIR/conf/docker-engine-release.conf" \ 144 release \ 145 "$APTDIR/dists/$codename/$component/binary-$arch" > "$APTDIR/dists/$codename/$component/binary-$arch/Release" 146 done 147 done