Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search

5. Double Check

Now that you have gotten a first impression and build your own binary package, it is time to get a little bit more serious and have a look at the quality of the package that we have produced.

5.1. lintian

Luckily for us the Debian project provides a 'lint' like tool for checking Debian packages. This tool is named 'lintian'. If you have not installed it yet on your system, this is a good moment (apt-get install lintian).

Now we use this little treasure tool on our new package file:

$ lintian linuxstatus_1.1-1_all.deb
E: linuxstatus: binary-without-manpage linuxstatus
E: linuxstatus: no-copyright-file
W: linuxstatus: prerm-does-not-remove-usr-doc-link
W: linuxstatus: postinst-does-not-set-usr-doc-link

Uh, doesn't look so perfect. We miss a man page, copyright file, and also those 'prerm' and 'postinst' scripts.

5.2. Minimal Documentation

This is not the place to say much about writing and creating man pages, there are many books that have one or another chapter related to this topic and there is also The Linux MAN-PAGE-HOWTO online. So lets do a little time warp and assume you have now a perfect man page for your script at location ./man/man1/linuxstatus.1.

The same for a 'copyright' file. You can find enough examples under the /usr/share/doc directory with this command: find /usr/share/doc -name "copyright"

So here is our own example of a 'copyright' file:


Copyright: Chr. Clemens Lee <>


The home page of linuxstatus is at:

The entire code base may be distributed under the terms of the GNU General
Public License (GPL), which appears immediately below.  Alternatively, all
of the source code as any code derived from that code may instead be
distributed under the GNU Lesser General Public License (LGPL), at the
choice of the distributor. The complete text of the LGPL appears at the
bottom of this file.

See /usr/share/common-licenses/(GPL|LGPL)

For the 'prerm' and 'postinst' scripts we copy one to one the examples from the 'parted' package above into files with the same name in our own project directory. These files should work for us just as well.

Now we create the debian package again. In the 'control' file we first increase the version number from 1.1-1 to 1.2-1 (since we have written a new man page we increase our internal release number). We also need to copy the new files to their appropriate places:

$ mkdir -p ./debian/usr/share/man/man1
$ mkdir -p ./debian/usr/share/doc/linuxstatus
$ find ./debian -type d | xargs chmod 755
$ cp ./man/man1/linuxstatus.1 ./debian/usr/share/man/man1
$ cp ./copyright ./debian/usr/share/doc/linuxstatus
$ cp ./prerm ./postinst ./debian/DEBIAN
$ gzip --best ./debian/usr/share/man/man1/linuxstatus.1
$ dpkg-deb --build debian
dpkg-deb: building package `linuxstatus' in `debian.deb'.
$ mv debian.deb linuxstatus_1.2-1_all.deb

Gzip is necessary because lintian expects man page files to be compressed as small as possible.

5.3. fakeroot

Now lets see if our package has become a better Debian citizen:

$ lintian linuxstatus_1.2-1_all.deb
E: linuxstatus: control-file-has-bad-owner prerm clemens/clemens != root/root
E: linuxstatus: control-file-has-bad-owner postinst clemens/clemens != root/root
E: linuxstatus: bad-owner-for-doc-file usr/share/doc/linuxstatus/ clemens/clemens != root/root
E: linuxstatus: bad-owner-for-doc-file usr/share/doc/linuxstatus/copyright clemens/clemens != root/root
E: linuxstatus: debian-changelog-file-missing

Ups, new complains. OK, we will not give up. Actually most errors seem to be the same problem. Our files are all packaged for user and group 'clemens', while I assume most people would prefer having them installed as 'root/root'. But this is easily fixed using the tool 'fakeroot'. So lets fix and check this quickly (while ignoring the changelog issue):

$ fakeroot dpkg-deb --build debian
dpkg-deb: building package `linuxstatus' in `debian.deb'.
$ mv debian.deb linuxstatus_1.2-1_all.deb
$ lintian linuxstatus_1.2-1_all.deb
E: linuxstatus: debian-changelog-file-missing

Fine, but we have yet another file to add to the package.

5.4. More Documentation

Let me tell you already that next to a 'changelog' file in the 'doc/linuxstatus' directory a 'changelog.Debian' file is also required. Both should be gzipped as well.

Here are two example files, 'changelog':

linuxstatus (1.2-1)

  * Made Debian package lintian clean.

 -- Chr. Clemens Lee <>  2002-12-13

and 'changelog.Debian':

linuxstatus Debian maintainer and upstream author are identical.
Therefore see also normal changelog file for Debian changes.

The Debian Policy file has more details regarding the format of the changelog file.

Now hopefully our last step will be:

$ cp ./changelog ./changelog.Debian ./debian/usr/share/doc/linuxstatus
$ gzip --best ./debian/usr/share/doc/linuxstatus/changelog 
$ gzip --best ./debian/usr/share/doc/linuxstatus/changelog.Debian
$ fakeroot dpkg-deb --build ./debian
dpkg-deb: building package `linuxstatus' in `debian.deb'.
$ mv debian.deb linuxstatus_1.2-1_all.deb
$ lintian linuxstatus_1.2-1_all.deb

Ah, we get no more complains :-). As root you can install now this package over the old one, again with the standard 'dpkg -i' command.

root# dpkg -i ./linuxstatus_1.2-1_all.deb
(Reading database ... 97124 files and directories currently installed.)
Preparing to replace linuxstatus 1.1-1 (using linuxstatus_1.2-1_all.deb) ...
Unpacking replacement linuxstatus ...
Setting up linuxstatus (1.2-1) ...