I'm working on a script called "populator". This script will be run on a linux box with the single purpose to download a set of packages (i.e. "ubuntu-desktop" metapackage) to trigger the caching by a deb-proxy.
The reason is to pre-cache the proxy in advance, thus reducing the amount of time to install the first production Linux box, not necessarily going to be installed immediately after deb-proxy deployment.
As for now, the script is extremely rough and simple:
1. clean the apt-get cache
2. run apt-get install with specified parameters to force reinstall, download only, output urls
3. pass the url list to wget and throw everything in /dev/null
with the specified parameters the script does the job. The only problem regards dependency handling: they are downloaded just the first time, even after apt-cache clean. I need apt-get to re-download dependencies as well. THIS is the real need.
# Script to pre-populate apt-get proxy for faster later downloads.
# It uses apt-get and wget to pull all the specified packages.
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "You're not root, are you?" 1>&2
PKGLIST="exaile" # specify needed packages
apt-get clean -qq # cache should be cleaned first to force package download even if already installed, else they will be ignored
apt-get update -qq # apt-get update should be run first for up-to-date cache and thus packages
apt-get install --reinstall -d --print-uris --yes $PKGLIST | grep ^\' | cut -d \' -f2 > output.txt # force apt-get to reinstall (and thus redownload) selected packages and send readable urls to temp file for later processing
wget --quiet -i output.txt --directory-prefix /dev/null # download debs from url list and send files to bit-bucket (we don't need them)
rm output.txt # spring cleanings