|
APT Package Reference: Digging Deeper into the Debian Package Sys- Pdf ko'rish
|
bet | 124/174 | Sana | 15.01.2024 | Hajmi | 11,68 Mb. | | #137314 |
Bog'liq Kali-Linux-Revealed-2021-edition8.4. APT Package Reference: Digging Deeper into the Debian Package Sys-
tem
Now it is time to dive really deep into Debian and Kali’s package system. At this point, we are
going to move beyond tools and syntax and focus more on the nuts and bolts of the packaging
system. This behind-the-scenes view will help you understand how APT works at its foundation
and will give you insight into how to seriously streamline and customize your Kali system. You
may not necessarily memorize all the material in this section, but the walk-through and reference
material will serve you well as you grow in your mastery of the Kali Linux system.
So far, you have interacted with APT’s package data through the various tools designed to interface
with it. Next, we will dig deeper and take a look inside the packages and look at the internal meta-
information (or information about other information) used by the package management tools.
This combination of a file archive and of meta-information is directly visible in the structure of a
.deb
file, which is simply an ar archive, concatenating three files:
$ ar t /var/cache/apt/archives/apt_1.4~beta1_amd64.deb
debian-binary
control.tar.gz
data.tar.xz
The
debian-binary
file contains a single version number describing the format of the archive:
$ ar p /var/cache/apt/archives/apt_1.4~beta1_amd64.deb debian-binary
2.0
The
control.tar.gz
archive contains meta-information:
$ ar p /var/cache/apt/archives/apt_1.4~beta1_amd64.deb control.tar.gz | tar -tzf -
./
210
Kali Linux Revealed
./conffiles
./control
./md5sums
./postinst
./postrm
./preinst
./prerm
./shlibs
./triggers
And finally, the
data.tar.xz
archive (the compression format might vary) contains the actual
files to be installed on the file system:
$ ar p /var/cache/apt/archives/apt_1.4~beta1_amd64.deb data.tar.xz | tar -tJf -
./
./etc/
./etc/apt/
./etc/apt/apt.conf.d/
./etc/apt/apt.conf.d/01autoremove
./etc/apt/preferences.d/
./etc/apt/sources.list.d/
./etc/apt/trusted.gpg.d/
./etc/cron.daily/
./etc/cron.daily/apt-compat
./etc/kernel/
./etc/kernel/postinst.d/
./etc/kernel/postinst.d/apt-auto-removal
./etc/logrotate.d/
./etc/logrotate.d/apt
./lib/
./lib/systemd/
[...]
Note that in this example, you are viewing a
.deb
package in APT’s archive cache and that your
archive may contain files with different version numbers than what is shown.
In this section, we will introduce this meta-information contained in each package and show you
how to leverage it.
8.4.1. The
control
File
We will begin by looking at the
control
file, which is contained in the
control.tar.gz
archive.
The
control
file contains the most vital information about the package. It uses a structure similar
to email headers and can be viewed with the
dpkg -I
command. For example, the
control
file
for apt looks like this:
211
Chapter 8 — Debian Package Management
$ dpkg -I apt_1.4~beta1_amd64.deb control
Package: apt
Version: 1.4~beta1
Architecture: amd64
Maintainer: APT Development Team
Installed-Size: 3478
Depends: adduser, gpgv | gpgv2 | gpgv1, debian-archive-keyring, init-system-helpers (>=
å
1.18~), libapt-pkg5.0 (>= 1.3~rc2), libc6 (>= 2.15), libgcc1 (>= 1:3.0),
å
libstdc++6 (>= 5.2)
Recommends: gnupg | gnupg2 | gnupg1
Suggests: apt-doc, aptitude | synaptic | wajig, dpkg-dev (>= 1.17.2), powermgmt-base,
å
python-apt
Breaks: apt-utils (<< 1.3~exp2~)
Replaces: apt-utils (<< 1.3~exp2~)
Section: admin
Priority: important
Description: commandline package manager
This package provides commandline tools for searching and
managing as well as querying information about packages
as a low-level access to all features of the libapt-pkg library.
.
These include:
* apt-get for retrieval of packages and information about them
from authenticated sources and for installation, upgrade and
removal of packages together with their dependencies
* apt-cache for querying available information about installed
as well as installable packages
* apt-cdrom to use removable media as a source for packages
* apt-config as an interface to the configuration settings
* apt-key as an interface to manage authentication keys
In this section, we will walk you through the control file and explain the various fields. Each of
these will give you a better understanding of the packaging system, give you more fine-tuned
configuration control, and provide you with insight needed to troubleshoot problems that may
occur.
|
| |