1

I'm not an apt user, but I'm in a scenario, where I need to grab a .deb package off of a repo.

I'm not a user of a deb-based distro, so I can't easily install a deb repo for what I need it. This would also be impractical for other reasons.

Instead, I thought simply grabbing the package and then unpacking it, might be a simpler solution, but I'm having quite some trouble "deciphering" the repo entry in the sources.list.d directory:

deb [arch=amd64] http://apt.domain.de/ stable ubuntu

How do I turn this into some sort of URL that I can probe for things like a list of available packages or if I know the package name, just the URL to that?

In essence, it is in my case more practical too access a debian repo manually and grab that one package off of it, for unpacking and inspection, etc. rather than installing apt, and then install packages through that, etc.

1 Answer 1

4

The structure of the entry is:

deb [arch=architecture] base-URL version repo-sections...

When you have a sources.list.d entry:

deb [arch=amd64] http://apt.domain.de/ stable ubuntu

that indicates:

  • base-URL is http://apt.domain.de/
  • version codename is stable
  • architecture is amd64
  • only one repository section ubuntu is listed.

It indicates that the list of relevant binary packages is located at <base-URL>/dists/<version>/<repository-section>/binary-<arch>/Packages.(gz|xz), so:

http://apt.domain.de/dists/stable/ubuntu/binary-amd64/Packages.(gz|xz)

and that the actual packages are (most likely) at <base-URL>/pool/<repository-section>:

http://apt.domain.de/pool/ubuntu/

If the repository contains a large number of packages, it may have been split into a number of sub-directories under the second URL:

  1. named with a single character, matching the initial character in the names of packages contained within
  2. named as libX where X is a single character, containing library packages whose name without the lib prefix begins with the same character (i.e. libX*)

If there is a really large number of packages in the repository, there may be further sub-divisions.

So, if you were looking for package "foo", you would first download the file http://apt.domain.de/dists/stable/ubuntu/binary-amd64/Packages.gz or http://apt.domain.de/dists/stable/ubuntu/binary-amd64/Packages.xz, and read it to find out which version of that package is considered to be current in the ubuntu section of the stable version of that repository.

You would find something like this:

Package: foo
Source: foo (1.2.3-4)
Version: 1.2.3-4+b1
Installed-Size: 12345
Maintainer: The Developer Guy <email.address@domain.example>
Architecture: amd64
Depends: libfoo (>= 1.2.3-4+b1)
...
Filename: pool/ubuntu/f/foo/foo_1.2.3-4+b1_amd64.deb
...

From this, you would know:

  • that the relevant package is foo-1.2.3-4+b1.deb

  • that it depends on package libfoo, version 1.2.3-4+b1 or greater

  • and that the package can be found at:

    http://apt.domain.de/pool/ubuntu/f/foo/foo_1.2.3-4+b1_amd64.deb

You could then download the package to a temporary directory and start extracting it:

mkdir workdir
cd workdir
wget http://apt.domain.de/pool/ubuntu/f/foo/foo_1.2.3-4+b1_amd64.deb
ar x foo_1.2.3-4+b1_amd64.deb

This will give you three files: control.tar.xz, data.tar.xz and debian-binary. The last of those contains just a version number of the package format, and can usually be ignored.

The data.tar.xz contains the actual files that the package would install.

The control.tar.xz contains any pre/post install/remove scripts if the package requires them, and some metadata for the package manager.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.