Product SiteDocumentation Site

Bab 5. Sistem Pemaketan: Alat dan Prinsip Dasar

5.1. Struktur Paket Biner
5.2. Informasi-Meta Paket
5.2.1. Penjelasan: Berkas control
5.2.2. Skrip Konfigurasi
5.2.3. Checksums, Daftar Berkas Konfigurasi
5.3. Struktur sebuah Paket Sumber
5.3.1. Format
5.3.2. Penggunaannya dalam Debian
5.4. Manipulasi Paket dengan dpkg
5.4.1. Menginstall Paket
5.4.2. Penghapusan Paket
5.4.3. Melakukan Queri ke Basisdata dpkg dan Memeriksa Berkas .deb
5.4.4. Berkas Log dpkg
5.4.5. Dukungan Multi-Arch
5.5. Kebersamaan dengan Sistem Paket Lain
Sebagai administrator sistem Debian, Anda akan sering menangani paket .deb, mereka berisi unit fungsional yang konsisten (aplikasi, dokumentasi, dll.), yang instalasi dan perawatannya difasilitasi mereka. Oleh karena itu, ide bagus untuk mengentahui apa dan bagaimana menggunakannya.
Bab ini menjelaskan struktur dan isi paket “biner”dan “sumber”. Dahulu berkas .deb, dapat digunakan secara langsung oleh dpkg, ketika kemudian berisi kode sumber, sebagaimana petunjuk untuk membuat paket biner.

5.1. Struktur Paket Biner

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 xz (sometimes gzip or bzip2). 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 sidebar ALAT dpkg, APT dan 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 xz.
Lihatlah isi berkas .deb:
$ ar t dpkg_1.18.24_amd64.deb
debian-binary
control.tar.gz
data.tar.xz
$ ar x dpkg_1.18.24_amd64.deb
$ ls
control.tar.gz  data.tar.xz  debian-binary  dpkg_1.18.24_amd64.deb
$ tar tJf data.tar.xz | head -n 15
./
./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/dpkg
./sbin/
./sbin/start-stop-daemon
./usr/
./usr/bin/
$ tar tzf control.tar.gz
./
./conffiles
./postinst
./md5sums
./prerm
./control
./postrm
$ cat debian-binary
2.0
Seperti yang dapat Anda lihat, arsip ar pada paket Debian mengompres tiga berkas:
  • debian-binary. This is a text file which simply indicates the version of the .deb file used (in 2017: version 2.0).
  • control.tar.gz. Arsip ini berisi seluruh informasi-meta yang tersedia, seperti nama dan versi paket. Beberapa informasi-meta ini memungkinkan alat manajemen paket untuk menentukan jika memungkinkan untuk menginstall atau menguninstallnya, contohnya berdasarkan daftar paket yang telah ada di mesin.
  • data.tar.xz. 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.gz for gzip).