Product SiteDocumentation Site

Poglavlje 5. Sustav pakiranja: Alati i osnovni principi

5.1. Struktura Binarnog paketa
5.2. Meta-informacije paketa
5.2.1. Opis: control datoteka
5.2.2. Configuration Scripts
5.2.3. Checksums, List of Configuration Files
5.3. Structure of a Source Package
5.3.1. Format
5.3.2. Usage within Debian
5.4. Manipulating Packages with dpkg
5.4.1. Installing Packages
5.4.2. Package Removal
5.4.3. Querying dpkg's Database and Inspecting .deb Files
5.4.4. dpkg's Log File
5.4.5. Multi-Arch Support
5.5. Coexistence with Other Packaging Systems
Kao Debian administrator, morati cete rutinski baratati sa .deb paketima, obzirom da oni sadrže konzistentne funkcinalne jedinice (aplikacije, dokumentaciju, itd.), čiju instalaciju i održavanje olakšavaju. Stoga je dobra ideja znati što su oni i kako ih upotrebljavati.
Ovo poglavlje opisuje strukturu i sadržaj "binarnog" i "izvornog" paketa. Binarne su .deb datoteke direktno primijenjive koristeći dpkg, dok izvorni dio sadrži izvorni kod, kao i instrukcije za kreiranje binarnog paketa.

5.1. Struktura Binarnog paketa

Format Debian paketa je dizajniran na način da njegov sadržaj može biti raspakiran na bilo kojoj Unix platformi koja podržava klasične naredbe kao ar, tar, te gzip( katkada xz ili bzip2). Ova naočigled trivijalna mogućnost je važna zbog skalabilnosti i te u slučaju povratka podataka.
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 sidebar ALATI dpkg, APT i 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 fortune, 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 gunzip.
Pogledajte u sadržaj .deb datoteke:
$ ar t dpkg_1.17.23_amd64.deb
debian-binary
control.tar.gz
data.tar.gz
$ ar x dpkg_1.17.23_amd64.deb
$ ls
control.tar.gz  data.tar.gz  debian-binary  dpkg_1.17.23_amd64.deb
$ tar tzf data.tar.gz | head -n 15
./
./var/
./var/lib/
./var/lib/dpkg/
./var/lib/dpkg/parts/
./var/lib/dpkg/info/
./var/lib/dpkg/alternatives/
./var/lib/dpkg/updates/
./etc/
./etc/logrotate.d/
./etc/logrotate.d/dpkg
./etc/dpkg/
./etc/dpkg/dpkg.cfg.d/
./etc/dpkg/dpkg.cfg
./etc/alternatives/
$ tar tzf control.tar.gz
./
./conffiles
./postinst
./md5sums
./prerm
./preinst
./control
./postrm
$ cat debian-binary
2.0
Kao što vidite, ar arhiva Debian paketa je sačinjena od tri datoteke:
  • debian-binary. This is a text file which simply indicates the version of the .deb file used (in 2015: version 2.0).
  • control.tar.gz. Ova arhiva sadrži sve dostupne meta-informacije, kao šta su ime i verzija paketa. Neke od tih meta-informacija im omogućuju procjenu da li se paket može ili ne može instalirati, kao i ukloniti, a sve to u sukladnosti sa listom postojećih paketa u sustavu.
  • 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).