Skip to content

Instantly share code, notes, and snippets.

@kroq-gar78
Created December 9, 2013 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kroq-gar78/7875613 to your computer and use it in GitHub Desktop.
Save kroq-gar78/7875613 to your computer and use it in GitHub Desktop.
Get package URLs from a list of packages from a certain Ubuntu/Debian repository. Used for a manual method of apt-mirroring (apt-cacher-ng)
#!/bin/sh
# retrieves all package URLs for i386 and amd64 architectures
PKGLIST=$1 # lists can be found at http://us.archive.ubuntu.com/ubuntu/indices/
OUTFILE=$2
# get all URLs for i386
#for i in `cat $PKGLIST|awk '{print $1}'|sed -e 's/$/:i386/'`
for i in `cat $PKGLIST|awk '{print $1}'`
do
apt-cache show ${i}:i386 |grep "Filename:"|cut -f 2 -d" "
apt-cache show ${i}:amd64 |grep "Filename:"|cut -f 2 -d" "
done | uniq > $OUTFILE
# wget http://archive.ubuntu.com/ubuntu/$URI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment