[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Downloading deb's



On Wed, 20 Feb 2002 07:21:33 +0700 (WIT)
Oki DZ <okidz@pindad.com> wrote:

>  On Tue, 19 Feb 2002, Ayman Haidar wrote:
>  > the easiest way if you don't want to use apt-get is :
>  > 	wget -i debs_file
>  > 
>  > where debs_file is a file with url's for the debs that you want.
> 
>  This would be a bit impractical; first, I have to go to www.debian.org,
>  searching for the right deb. Secondly, I have to memorize (or jot down)
>  the url. I'd be lucky if there's no other deb's in the dependencies. If it
>  is, then I have to search again for them.

SPAM: scroll down for the simple answer.

I have a non-standard apt setup that points my /etc/apt/sources.list to
a local Packages.gz file. Around this Packages.gz I have built a local
archive containing only .deb's that are already installed in my system.
If I apt-get a package that isn't installed, apt-get will spout an error
message with the URL.

(1) Relevant etc/apt/sources.list line:
deb file:/archive/deb/http.us.debian.org/debian testing main

(2) Packages file:
/archive/deb/http.us.debian.org/debian/dists/testing/main/binary-i386/Packages.gz

(3) Sample .deb package in archive:
/archive/deb/http.us.debian.org/debian/pool/main/r/regexplorer/regexplorer_0.1.6-1.2_i386.deb

(4) tcsh session showing the effects of apt-get on a package I haven't
downloaded yet:

# apt-get install hello
Reading Package Lists... Done
Building Dependency Tree... Done
The following NEW packages will be installed:
  hello 
0 packages upgraded, 1 newly installed, 0 to remove and 0  not upgraded.
Need to get 0B/19.7kB of archives. After unpacking 86.0kB will be used.
Err file: testing/main hello 1.3-18
  File not found
Failed to fetch file:/archive/deb/http.us.debian.org/debian/pool/main/h/hello/hello_1.3-18_i386.deb  File not found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

As you can see, apt-get is trying to fetch the package "hello" from my
local archive. To wget the required .deb, I first do some simple shell
tricks on the stderr, basically trimming the bit before "http.us" and
after ".deb" and appending an http://. The resulting URL is what I feed
to wget..

To get wget to download and put the file in its proper place, I issue:

wget -cxP /archive/deb \
  http://http.us.debian.org/debian/pool/main/h/hello/hello_1.3-18_i386.deb

where -x means force directory creation and -P is the path to the local
archive. A similar wget command is used to download an updated
Packages.gz:

wget --timestamping -cxP /archive/deb \
  http://http.us.debian.org/debian/dists/testing/main/binary-i386/Packages.gz

I don't need to write down or remember any URLs. OTOH you can spare
yourself the trouble and install apt-zip.



Reply to: