#!/bin/sh # # Use apt-get and wget to download archive files regardless of whether # they're already installed on the system # unset PARTIAL if [ -d `pwd`/partial ] ; then PARTIAL=1 else mkdir `pwd`/partial fi exec apt-get --print-uris --reinstall -q --download-only \ -o dir::cache::archives="`pwd`" -o dir::etc::status=/dev/null install "$@" \ | tee /tmp/apt-download-$$.tmp sed "s/[^']*'/'/" /tmp/apt-download-$$.tmp \ | egrep "^'(http|ftp)://" \ | sed "s/'\([^ ]*\)' .*/\1/" \ | while read url; do echo "downloading $url"; wget --continue $url; done rm -f /tmp/apt-download-$$.tmp test -z "$PARTIAL" && rmdir partial 2>/dev/null