Format of a Package
Introduction
The Debian file format is 100% based on standard Unix tools: ar, tar, and gz.
The newer Debian Packages also support bz2, lzma, and xz compressions for the data tarball.
Package
The .deb file, the package, is an ar archive. The type of archive used for static libraries. It includes a small set of files. The type of archive is very well adapt for the .deb file as it does not require any information about the files other than a name (i.e. the ar format does not save information about the file such as permissions and owner, nor supports a folder name.)
The files found in the .deb archive are:
- debian-binary
The version of this Debian Package. This is a text file that defines a version. At this time the version is 2.0. The exact content should be:
0x32 0x2E 0x30 0x0A
- control.tar.gz
The control file is a compressed tarball. It includes files that are used to install, manage, uninstall the package. It does not include any data that is directly installed, although it may include scripts that make further changes to the system as required (install data in the registry.)
The control.tar.gz file must include the control file. This is the file that defines parameters such as the software name, version, and dependencies. Once in a binary file, control files are fully defined. When created in your project, control files may include variables and expressions. Variables can be specified on the command line with --field-variables. Expressions can also be used with the --verify-fields command line option.
The control.tar.gz file also includes the md5sum file. This is a list of all the regular files1 defined in the data.tar.gz file and their corresponding md5sum. When installing files on a system, their md5sum is checked first. If invalid, then the installation doesn't occur.
The control.tar.gz file can also include pre and post installation scripts, and when uninstalling, pre and post removal scripts.
-
data.tar.gz
The data tarball includes all the files to be installed on the target system. This is a standard tarball.
The folder specification starts from the root (the / folder in Unix). Under MS-Windows, it starts at the drive specification. However, in most cases, when creating a new package you are not going to install the files in their final expected location. For this reason we support a first level of folders that are named after drives c/... d/... e/... etc. For this to work, the control file must include a specific flag: MSDOS-Drive: True.
- 1. Note that special files and directories do not get a corresponding md5sum because all the information for these files is found in the tar header.