update-apt-repo 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. set -e
  3. # This script updates the apt repo in $DOCKER_RELEASE_DIR/apt/repo.
  4. # This script is a "fix all" for any sort of problems that might have occurred with
  5. # the Release or Package files in the repo.
  6. # It should only be used in the rare case of extreme emergencies to regenerate
  7. # Release and Package files for the apt repo.
  8. #
  9. # NOTE: Always be sure to re-sign the repo with hack/make/sign-repos after running
  10. # this script.
  11. : ${DOCKER_RELEASE_DIR:=$DEST}
  12. APTDIR=$DOCKER_RELEASE_DIR/apt/repo
  13. # supported arches/sections
  14. arches=( amd64 i386 )
  15. # Preserve existing components but don't add any non-existing ones
  16. for component in main testing experimental ; do
  17. if ls "$APTDIR/dists/*/$component" >/dev/null 2>&1 ; then
  18. components+=( $component )
  19. fi
  20. done
  21. dists=( $(find "${APTDIR}/dists" -maxdepth 1 -mindepth 1 -type d) )
  22. # override component if it is set
  23. if [ "$COMPONENT" ]; then
  24. components=( $COMPONENT )
  25. fi
  26. # release the debs
  27. for version in "${dists[@]}"; do
  28. for component in "${components[@]}"; do
  29. codename="${version//debootstrap-}"
  30. # update the filelist for this codename/component
  31. find "$APTDIR/pool/$component" \
  32. -name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist"
  33. done
  34. done
  35. # run the apt-ftparchive commands so we can have pinning
  36. apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"
  37. for dist in "${dists[@]}"; do
  38. version=$(basename "$dist")
  39. for component in "${components[@]}"; do
  40. codename="${version//debootstrap-}"
  41. apt-ftparchive \
  42. -o "APT::FTPArchive::Release::Codename=$codename" \
  43. -o "APT::FTPArchive::Release::Suite=$codename" \
  44. -c "$APTDIR/conf/docker-engine-release.conf" \
  45. release \
  46. "$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release"
  47. for arch in "${arches[@]}"; do
  48. apt-ftparchive \
  49. -o "APT::FTPArchive::Release::Codename=$codename" \
  50. -o "APT::FTPArchive::Release::Suite=$codename" \
  51. -o "APT::FTPArchive::Release::Component=$component" \
  52. -o "APT::FTPArchive::Release::Architecture=$arch" \
  53. -c "$APTDIR/conf/docker-engine-release.conf" \
  54. release \
  55. "$APTDIR/dists/$codename/$component/binary-$arch" > "$APTDIR/dists/$codename/$component/binary-$arch/Release"
  56. done
  57. done
  58. done