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
#1 by Kerry_s on March 3rd, 2007
Quote
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
#2 by sjkwizard on April 26th, 2007
Quote
Your script is very useful but it doesn’t seem to work on feisty fawn. Did you ever try the script on feisty?
#3 by Natilous on February 2nd, 2008
Quote
Does “synaptic package manager” work this script ?
#4 by Kamyar on May 4th, 2008
Quote
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?
#5 by Sandaruwan Gunathilake on May 4th, 2008
Quote
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
#6 by Karthik on February 13th, 2009
Quote
Hi Sandaruwan,
I am using Ubuntu 8.0.4 hardy. I downloaded your scripts, created a directory /home/sandaruwan ,to avoid recompiling, and copied the a.sh and download.py. I also replaced the /usr/lib/apt/methods/http with your http executable ( i didnt recompile).
I then ran sudo apt-get upgrade and found that many files arent getting downloaded properly. Infact all of them were failing. I found the below list in /var/cache/apt/archives/partial directory.
hplip_2.8.2-0ubuntu8.1_i386.deb.FAILED
hplip-data_2.8.2-0ubuntu8.1_all.deb
initramfs-tools_0.85eubuntu39.3_all.deb.FAILED
language-pack-en_1%3a8.04+20090105.1_all.deb.FAILED
language-pack-en-base_1%3a8.04+20090105_all.deb.FAILED
language-pack-gnome-en_1%3a8.04+20090105.1_all.deb.FAILED
language-pack-gnome-en-base_1%3a8.04+20090105_all.deb.FAILED
libglib2.0-0_2.16.6-0ubuntu1_i386.deb.FAILED
libgtk2.0-common_2.12.9-3ubuntu5_all.deb.FAILED
libpango1.0-common_1.20.5-0ubuntu1_all.deb
libpcre3_7.4-1ubuntu2.1_i386.deb.FAILED
libsnmp15_5.4.1~dfsg-4ubuntu4.2_i386.deb.FAILED
libsnmp-base_5.4.1~dfsg-4ubuntu4.2_all.deb.FAILED
libssl0.9.8_0.9.8g-4ubuntu3.4_i386.deb.FAILED
linux-image-2.6.24-19-generic_2.6.24-19.41_i386.deb.FAILED
module-init-tools_3.3-pre11-4ubuntu5.8.04.1_i386.deb.FAILED
openoffice.org-calc_1%3a2.4.1-1ubuntu2.1_i386.deb.FAILED
openoffice.org-draw_1%3a2.4.1-1ubuntu2.1_i386.deb.FAILED
openoffice.org-impress_1%3a2.4.1-1ubuntu2.1_i386.deb.FAILED
Please let me know what could have gone wrong. Should i first compile the cc file ? or do i need to turn on logging in your scripts ?
Please let me know.
Thanks & Regards,
Karthik
#7 by ajay on November 17th, 2009
Quote
hello am new to ubuntu am usin ubuntu 9.10 i liked ur idea and tried to compile did not completely install as it showed some error in the midst but after that am not able to use synaptic itself!it shows unknown failur 32512 for all packages……is there any way to revert it back ?.can u kindly help?