The Debian package format is designed so that its content may be extracted on any Unix system that has the classic commands ar, tar, and gzip. This seemingly trivial property is important for portability and disaster recovery.
Imagine, for example, that you mistakenly deleted the dpkg program, and that you could thus no longer install Debian packages. dpkg being a Debian package itself, it would seem your system would be done for... Fortunately, you know the format of a package and can therefore download the .deb file of the dpkg package and install it manually (see the “TOOLS” sidebar). If by some misfortune one or more of the programs ar, tar or gzip have disappeared, you will only need to copy the missing program from another system (since each of these operates in a completely autonomous manner, without dependencies, a simple copy will suffice).
dpkg is the program that handles .deb files, notably extracting, analyzing, and unpacking them.
APT is a group of programs that allows the execution of higher-level modifications to the system: installing or removing a package (while keeping dependencies satisfied), updating the system, listing the available packages, etc.
As for the ar program, it allows handling files of the same name: ar t
# ar x dpkg_1.15.8.5_i386.deb
# tar -C / -p -xzf data.tar.gz
It can be confusing for beginners to find references to “ar(1)” in the literature. This is generally a convenient means of referring to the man page entitled ar in section 1.
Sometimes this notation is also used to remove ambiguities, for example to distinguish between the printf command that can also be indicated by printf(1) and the printf function in the C programming language, which can also be referred to as printf(3).
Chapter 7,
Have a look at the content of a .deb file:
$ ar t dpkg_1.15.8.5_i386.deb
debian-binary
control.tar.gz
data.tar.gz
$ ar x dpkg_1.15.8.5_i386.deb
$ ls
control.tar.gz data.tar.gz debian-binary dpkg_1.15.8.5_i386.deb
$ tar tzf data.tar.gz | head -15
./
./var/
./var/lib/
./var/lib/dpkg/
./var/lib/dpkg/updates/
./var/lib/dpkg/parts/
./var/lib/dpkg/info/
./var/lib/dpkg/alternatives/
./sbin/
./sbin/start-stop-daemon
./usr/
./usr/sbin/
./usr/sbin/install-info
./usr/bin/
./usr/bin/dpkg-split
$ tar tzf control.tar.gz
./
./control
./preinst
./md5sums
./conffiles
./postrm
./postinst
$ cat debian-binary
2.0
As you can see, the ar archive of a Debian package is comprised of three files:
debian-binary. This is a text file which simply indicates the version of the .deb file used (in 2011: version 2.0).
control.tar.gz. This archive file contains all of the available meta-information. In it, package management tools find, among other things, the name and version of the package. Some of this meta-information allows them to determine if it is possible to install or uninstall the programs inside, for example according to the list of packages already on the machine.
data.tar.gz. This archive contains all of the files to be extracted from the package; this is where the executable files, documentation, etc., are all stored. Some packages may use other compression formats, in which case the file will be named differently (data.tar.bz2 for bzip2, data.tar.xz for XZ, data.tar.lzma for LZMA).
5.2. Package Meta-Information
The Debian package is not only an archive of files intended for installation. It is part of a larger whole, and it describes its relationship with other Debian packages (dependencies, conflicts, suggestions). It also provides scripts that enable the execution of commands at different stages in the package's lifecycle (installation, removal, upgrades). These data used by the package management tools are not part of the packaged software, but are, within the package, what is called its “meta-information” (information about other information).
Вильям Л Саймон , Вильям Саймон , Наталья Владимировна Макеева , Нора Робертс , Юрий Викторович Щербатых
Зарубежная компьютерная, околокомпьютерная литература / ОС и Сети, интернет / Короткие любовные романы / Психология / Прочая справочная литература / Образование и наука / Книги по IT / Словари и Энциклопедии