debmirror and Sections

If you want to create a debian mirror, but you don’t want to have the whole 9GB that stable takes up (currently), you can specify the --exclude-deb-section flag to debmirror.

My first question was; what sections are there to start with?

Well, it’s easy to figure out. First, you want to get the package list for the distribution in question. Let’s say you’re working on etch. You go to the /etc/apt/sources.list file and grab the line for the main stuff:

deb http://www.uk.debian.org/debian/ etch main

That’s what it is on my box, anyway. OK, next, you need to download the Packages file based on that. How do you know where it is? You can work it out from the sources.list line, so taking the above as an example, you stick dists/ after the URL, and a slash (/) character after both etch and main. So far then, we’ve got this:

http://ftp.uk.debian.org/debian/dists/etch/main/

Next, you want to put the architecture on the end, in format binary-arch where ‘arch’ is your architecture. Do you have no idea what I mean? It’ll most likely be i386, then. After that, another slash and ‘Packages.gz’. So, the URL is now:

http://ftp.uk.debian.org/debian/dists/woody/main/binary-i386/Packages.gz

Download it, any way you want. Next, we want to run a simple Perl script against the downloaded (and ungzipped) file. This is the current one I’m using so should do as a starter for you.

The script will output each Section and how many packages are in that Section. That might help you decide which Sections you don’t want to bother mirroring, as it will likely just waste your bandwidth.

Once you’ve altered the @wanted array to contain the Sections you are interested in mirroring, you can then copy the part at the bottom (which is the list of Sections you don’t want to mirror) when running the debmirror command to start the download.

Leave a Reply