github.com/skf/moby@v1.13.1/hack/make/clean-apt-repo (about) 1 #!/bin/bash 2 set -e 3 4 # This script cleans the experimental pool for the apt repo. 5 # This is useful when there are a lot of old experimental debs and you only want to keep the most recent. 6 # 7 8 : ${DOCKER_RELEASE_DIR:=$DEST} 9 APTDIR=$DOCKER_RELEASE_DIR/apt/repo/pool/experimental 10 : ${DOCKER_ARCHIVE_DIR:=$DEST/archive} 11 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 12 13 latest_versions=$(dpkg-scanpackages "$APTDIR" /dev/null 2>/dev/null | awk -F ': ' '$1 == "Filename" { print $2 }') 14 15 # get the latest version 16 latest_docker_engine_file=$(echo "$latest_versions" | grep docker-engine) 17 latest_docker_engine_version=$(basename ${latest_docker_engine_file%~*}) 18 19 echo "latest docker-engine version: $latest_docker_engine_version" 20 21 # remove all the files that are not that version in experimental 22 pool_dir=$(dirname "$latest_docker_engine_file") 23 old_pkgs=( $(ls "$pool_dir" | grep -v "^${latest_docker_engine_version}" | grep "${latest_docker_engine_version%%~git*}") ) 24 25 echo "${old_pkgs[@]}" 26 27 mkdir -p "$DOCKER_ARCHIVE_DIR" 28 for old_pkg in "${old_pkgs[@]}"; do 29 echo "moving ${pool_dir}/${old_pkg} to $DOCKER_ARCHIVE_DIR" 30 mv "${pool_dir}/${old_pkg}" "$DOCKER_ARCHIVE_DIR" 31 done 32 33 echo 34 echo "$pool_dir now has contents:" 35 ls "$pool_dir" 36 37 # now regenerate release files for experimental 38 export COMPONENT=experimental 39 source "${DIR}/update-apt-repo" 40 41 echo "You will now want to: " 42 echo " - re-sign the repo with hack/make/sign-repo" 43 echo " - re-generate index files with hack/make/generate-index-listing"