.deb
包,因为它们包含一致的功能单元(应用程序、文档等),使得安装和维护更容易。所以了解它们是什么及如何使用它们是个好主意。
dpkg
命令直接处理;而后者则包含程序的源代码,以及创建二进制包的指令。
ar
、tar
和 xz
或者有时候是 gzip
或 bzip2
的 Unix 系统上,它的内容都可以被解压。这是个看起来琐碎的属性对移植和灾难恢复是非常重要的。
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 sidebar 工具 dpkg
、APT
和 ar
). If by some misfortune one or more of the programs ar
, tar
or gzip
/xz
/bzip2
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). If your system suffered some even more outrageous misfortune, and even these don't work (maybe the deepest system libraries are missing?), you should try the static version of busybox
(provided in the busybox-static package), which is even more self-contained, and provides subcommands such as busybox ar
, busybox tar
and busybox xz
.
.deb
文件的内容:
$
ar t dpkg_1.21.22_amd64.deb
debian-binary control.tar.gz data.tar.xz $
ar x dpkg_1.21.22_amd64.deb
$
ls
control.tar.gz data.tar.xz debian-binary dpkg_1.21.22_amd64.deb $
tar tJf data.tar.xz | head -n 16
./ ./etc/ ./etc/alternatives/ ./etc/alternatives/README ./etc/cron.daily/ ./etc/cron.daily/dpkg ./etc/dpkg/ ./etc/dpkg/dpkg.cfg ./etc/dpkg/dpkg.cfg.d/ ./etc/logrotate.d/ ./etc/logrotate.d/alternatives ./etc/logrotate.d/dpkg ./lib/ ./lib/systemd/ ./lib/systemd/system/ ./lib/systemd/system/dpkg-db-backup.service $
tar tJf control.tar.xz
./ ./conffiles ./control ./md5sums ./postinst ./postrm ./prerm $
cat debian-binary
2.0
ar
存档格式由三个文件组成:
Debian 二进制文件
.deb
file package format version. In Debian Bookworm it is still version 2.0.
control.tar.xz
data.tar.xz
, data.tar.bz2
, data.tar.gz
xz
、bzip2
或 gzip
。