Deb

building a deb package
Good looking articles:
 * How to make deb packages
 * Debian New Maintainers' Guide
 * English/BuildingWithoutHelper - Debian Women Wiki
 * Debian Binary Package Building HOWTO
 * Rolling your own Debian packages (part 1)
 * Linux.com :: Make your own packages for Debian-based systems
 * Creating .deb-Packages With Checkinstall - FalkoTimme.com
 * HOW TO: Using checkinstall for sources - Ubuntu Forums

Build deb
Create deb: dpkg -b [DIR]
 * 1) creates: [DIR].deb

Create deb with target name: dpkg -b [DIR] [NAME].deb
 * 1) creates: [NAME].deb

Package layout: [DIR]/ /etc/myfile #...etc... DEBIAN/control   # REQUIRED, similar to RPM spec file DEBIAN/postinst  # pre/post scripts

Maintainer scripts - {pre,post}{inst,rm} DEBIAN/postinst DEBIAN/preinst DEBIAN/postrm DEBIAN/prerm

NOTE: Comments do not appear to be allowed in DEBIAN/control.

DEBIAN/control: (minimal with warning) Package: deb1 Version: 1.0

DEBIAN/control: (minimal no warnings) Package: ken1 Version: 1.0 Architecture: somearch Maintainer: Kenneth  Description: This is a description with multiple lines

DEBIAN/control: Package: deb1 Version: 1.0 Section: web Priority: optional Architecture: all Essential: no Maintainer: Joe Brockmeier [jzb@dissociatedpress.net] Provides: deb1 Description: The description can contain free-form text describing the function of the program, what kind of features it has, and so on.

Debian repo archive is divided into multiple areas: main (the free software), non-free (the not really free software) and contrib (free software that depends on non-free software)

deb vs rpm

 * "I'm wondering if anyone could please tell me the differences in these two software formats and why that data makes one better than another (or perhaps makes them the same)."


 * "I don't think one is superior than the other. They are quite similar in functionality and have the same pros and limitations e.g. you have to resolve dependencies manually when installing rpms with rpm and debs with dpkg. What tends to differ is the wrappers around rpm and dpkg which provide additional functionality e.g automatic dependency checking and resolution. On most Debian based distros, apt and its related tools are the preferred wrapper and on rpm based distros, there is a wider selection e.g. yum, urpmi, yast, smart, apt etc. For years apt was the superior tool because it had a few years head start, but tools like yum, urpmi and SMART have caught up and have more or less the same features as apt.


 * The debates you see on the net about rpm vs deb, tend to be really flawed because a lot of people compare apt vs rpm instead of comparing rpm vs dpkg. Apt can be used with rpm based distros so its not unique to Debian based distros. Its just that many rpm based distros don't use it by default." (*.deb vs *.rpm - Linux Forums)


 * "Debian's package system is often considered superior to RPMs. IMHO, this is not because of technical reasons. In fact, Debian's advantage (with respect to packaging) comes from 2 issues outside of the packaging system:
 * - apt-get. Whenever you want to install a .deb, you'll get it - and its dependencies from the Debian archive. (Debian packages "in the wild" - outside of Debian or related distributions - are rare.)
 * - The Debian policy. Becoming a Debian developer requires one to agree to a "contract". Errors against the policy have a very high priority in the bug tracking system.
 * Red Hat on the other hand never enforced such a policy for RPMs. Their package format was adopted by many distributions and independent programmers, each using their own conventions. And this makes it difficult to mix packages from different sources."


 * "The packaging policies have nothing to do with it. The mechanism to create a DEB package is more powerful, understandable, and flexible than the mechanism to create an RPM package." (RPM vs DEB on technical merits alone. [LWN.net])

Commands
Install deb package: dpkg -i [package].deb

Remove package: dpkg -r [package]

Show package information: dpkg -I [package].deb

Show required dependencies: dpkg -P [package].deb # TODO: verify verify

Extract control files
DEB files are ar archives, which contain three files: debian-binary control.tar.gz data.tar.gz

Extract deb files: ar vx [PACKAGE].deb tar -tzvf control.tar.gz # list files tar -zvxf control.tar.gz

Extra data files: cat data.tar.xz | xz -d | tar -xv

One liner: ar p [PACKAGE].deb control.tar.gz | tar zx

References:
 * How to extract RPM or DEB packages - http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/

rpm to deb commands
Install package: rpm -Uvh [PACKAGE].rpm dpkg -i [PACKAGE].deb

Remove package: rpm -e [PACKAGE] dpkg -r [PACKAGE]

Package info: rpm --info [PACAKGE].rpm dpkg -I [PACKAGE].deb

List install package files: rpm -qvl [PACKAGE] dpkg -L [PACKAGE]

List deb package files: rpm -qvlp [PACKAGE].rpm dpkg -c [PACAKGE].deb

List installed packages: rpm -qa dpkg -l

Extract files from deb package: rpm2cpio [PACAKGE].rpm | cpio -dmvi dpkg -x [PACKAGE].deb [TARGETFOLDER]