Creating Dummy Packages On Debian

One of my favorite things about Debian is its awesome package management system. Apt is one of the reasons I have used Debian for servers for so many years and eased my initial transition to Ubuntu (which as most people know was initially a Debian fork). Apt is a great tool as long as you aren’t building packages from source (and not making debs out of them). I have packaged a whole bunch of debs, but sometimes it just isn’t necessary. So if you haven’t used equivs, then you need to check it out.

Essentially it allows you to create dummy debs to provide packages that you installed from source (circumvent dependency checking). It can get dirty when time comes to do dist-upgrades, but it has its usefulness. For example, I wanted to install altermime and I had installed the latest Postfix from source and altermime requires an MTA to be installed otherwise it would install exim (amongst other packages). So I built a dummy packages doing the following:

# apt-get install equivs
# equivs-control postfix

That will create a file named postfix in the current directory. Make the file look similar to this:

Section: misc
Priority: optional
Standards-Version: 2.3.3

Package: postfix-dummy
Version: 2.7.0
Section: mail
Maintainer: Eric Lubow
Provides: mail-transport-agent
Architecture: all
Description: Dummy Postfix package

Then go ahead and build your dummy package:

# equivs-build postfix
dh_testdir
dh_testroot
dh_clean -k
dh_testdir
dh_testroot
dh_install
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
dpkg-deb: building package `postfix-dummy' in `../postfix-dummy_2.7.0_all.deb'.

The package has been created.
Attention, the package has been created in the current directory,
not in ".." as indicated by the message above!

Then I just installed the postfix-dummy package with:

# dpkg -i postfix-dummy_2.7.0_all.deb

And everything worked beautifully. I installed altermime with no problem and we were off to the races.