Enhance Apt-Get downloading using an external download accelerator(axel/prozilla/aget)

Posted in Hacks, Linux, Open Source, Programming, Python by sandaruwan on February 14th, 2007

The Apt-Get in debian systems use their own downloading system to download packages from the internet. It supports file resuming and pipelining. However, it doesn’t support downloading using multiple threads, and it won’t allow you to external applications to download.

However, the http downloader is a separate application(/usr/lib/apt/methods/http) from apt-get, and the apt-get spawns the executable to download the files. Those two programs communicate via stdin and stdout. I have written a new downloading application which can communicate with the apt-get. So, I just copied the executable to /usr/lib/apt/methods/http. The new application spawns another program(In my case a shell script) with two arguments; the url and the local file.

So, after all my shell script calls a python script. My program doesn’t call the python script directly because when the python scripts gives some output to stdout/stderr the apt-get program crashes. So, my shell script redirects the all output to /dev/null. Then, the python script will get the url, do a HEAD request, get the file size. If the file size is less than 100K, it’ll execute wget, if not it’ll execute axel. So, the files will get downloaded and apt-get will install the software.

The apt-get update command fetches many small files from the same server. Since the original downloader uses pipelining, it’s much faster. I have to modify my code to do something about pipelining.

Files :

scripts.tar.gz

apt.tar.gz

5 Responses to “Enhance Apt-Get downloading using an external download accelerator(axel/prozilla/aget)”

  1. Kerry_s Says:

    Have you done any further work on this script? I would also like to get the pipelining + axel/proz to work, but i don’t know crap about python programming. I’ve asked for help from my fellow ubuntor’s, but have no answers yet.-> http://www.ubuntuforums.org/showthread.php?t=374732

    March 3rd, 2007 at 1:02 pm

  2. sjkwizard Says:

    Your script is very useful but it doesn’t seem to work on feisty fawn. Did you ever try the script on feisty?

    April 26th, 2007 at 11:37 am

  3. Natilous Says:

    Does “synaptic package manager” work this script ?

    February 2nd, 2008 at 7:48 am

  4. Kamyar Says:

    This is just the thing I’ve been lookin for. But seems pretty out-dated. Any plans for further development?! Any ideas of a similar project?

    May 4th, 2008 at 1:40 pm

  5. sandaruwan Says:

    Kamyar,

    Sorry, I won’t probably be improving this.. You can use “apt-get –print-uris install package” to generate list of url and write a small shell script to do the downloadings.. the packages should be downloaded to /var/cache/apt/archives/

    ~ Sandaruwan

    May 4th, 2008 at 1:50 pm

Leave a Reply