Packages

Dernier packages installés :

  zgrep -h 'status installed' /var/log/dpkg.log* | sort | tail -n 100

Pour savoir à quel package un programme ou un fichier il appartient :

  dpkg -S <file_name>

Voir plus d'info sur un package :

  apt-cache showpkg <package_name>.deb

Lister le contenu d'un package :

  ar tv <package_name>.deb

Un .deb est en fait un fichier archive AR, pour décompresser :

  ar xv <package_name>_1.4.24-4_i386.deb

Pour le fichier control :

  tar zxvf control.tar.gz

Pour data :

  xz -d data.tar.xz

...ensuite :

  tar xvf data.tar

Affiche une liste des packages installés :

  dpkg-query --list | grep '^ii' | awk '{print $2 ";" $3}'
  dpkg --list
  apt-file list "package"

The hard way

If you don't have the Debian tools, build an archive of the files you want to package called data.tar.gz, a separate archive of the control files called control.tar.gz (no subdirectories), and a text file called debian-binary and containing the text 2.0.

  cd mypackage-42
  tar czf ../data.tar.gz [a-z]*
  cd DEBIAN
  tar czf ../../control.tar.gz *
  cd ../..
  echo 2.0 > debian-binary
  ar r mypackage-42.deb debian-binary control.tar.gz data.tar.gz

Package création summary

Not to get confused, let us recapture all steps we have taken to build our binary Debian package.

Prerequisite files:

one or more binary executable or shell script files

a man page for each executable file

a 'control' file

a 'copyright' file

a 'changelog' and 'changelog.Debian' file

Setup temporary 'debian' directories:

create 'debian/usr/bin' directory (or wherever you plan to place your executable files)

create 'debian/usr/share/man/man1' (or whatever section your man page belongs into)

create 'debian/DEBIAN' directory

create 'debian/usr/share/doc/<package_name>'

make sure all sub directories of 'debian' have file permission 0755

Copy files into temporary 'debian' tree:

copy executable file into 'debian/usr/bin' directory (or wherever you plan to place your executable files)

copy man page file into 'debian/usr/share/man/man1' directory

copy 'control' file into 'debian/DEBIAN' directory

copy 'copyright', 'changelog', and 'changelog.Debian' files into 'debian/usr/share/doc/<package_name>'

gzip man page, 'copyright', 'changelog', and 'changelog.Debian' files with option '--best' inside the temporary 'debian' tree

Build and check binary Debian package:

invoke 'dpkg-deb --build' using 'fakeroot' on the 'debian' directory

rename resulting 'debian.deb' file to its final package name including version and architecture information

check resulting .deb package file for Debian policy compliance using 'lintian'