There's a very handy utility called
CheckInstall. It let's you easily pack a custom compiled program into a package and install+remove it like it was part of the distribution. Makes life a lot easier if you've to remove something that you had to install from source (via
make install).
I've found a bug regarding the Debian packaging part and the handling of files that get installed into
/etc.
In a Debian package one of the control files is called
conffiles. It's a list of configuration files (usually placed in
/etc) that the package management system will not overwrite when the package is upgraded. However
checkinstall uses the following command to generate
conffiles:
# Tag files in /etc to be conffiles
find $BUILD_DIR/etc 2> /dev/null | sed -e "s,$BUILD_DIR,," | \
grep -v '^/etc$' > $BUILD_DIR/DEBIAN/conffiles
The problem is that this listing might contain directories too (if the install process created directories in
/etc) and during the installation of the deb package (that you created with
checkinstall) the creation of the configfiles inside that directory will fail, because
dpkg skips the parent directory (because the directory is listed in
conffiles).
Eg. let's assume that your program's
make install would create the following directories and files in
/etc:
/etc/demo/
/etc/demo/listener.cfg
/etc/demo/myconfig.cfg
Checkinstall creates a
conffiles with the following content:
/etc/demo
/etc/demo/listener.cfg
/etc/demo/myconfig.cfg
And during the installation of the generated deb package you'll receive an error message like this:
dpkg: error processing demo_1.0.0-1_i386.deb (--install):
unable to create `./etc/demo/listener.cfg': No such file or directory
And this pretty much prevents you from installing the package.
The problem is caused by the missing
/etc/demo directory. If you run
dpkg in debug mode, you'll see that the
/etc/demo directory is created (or at least so it seems):
D000100: setupvnamevbs main=`/etc/demo' tmp=`/etc/demo.dpkg-tmp' new=`/etc/demo.dpkg-new'
D000100: tarobject nonexistent
D000010: ensure_pathname_nonexisting `/etc/demo.dpkg-new'
D000010: ensure_pathname_nonexisting `/etc/demo.dpkg-tmp'
D000100: tarobject Directory creating
But actually only
/etc/demo.dpkg-new is created and since the directory is listed in
conffiles, the
*-new dir is not renamed to the
/etc/demo final name.
To solve the problem we've to patch
checkinstall to not include directories in
conffiles. Here's a diff for the currently available latest
checkinstall from Ubuntu (it's v1.6.1-8):
--- checkinstall 2009-01-14 21:24:21.000000000 +0100
+++ checkinstall.new 2009-01-14 21:24:47.000000000 +0100
@@ -2444,8 +2444,8 @@
fi
# Tag files in /etc to be conffiles
-find $BUILD_DIR/etc 2> /dev/null | sed -e "s,$BUILD_DIR,," | \
- grep -v '^/etc$' > $BUILD_DIR/DEBIAN/conffiles
+find $BUILD_DIR/etc ! -type d 2> /dev/null | sed -e "s,$BUILD_DIR,," | \
+ > $BUILD_DIR/DEBIAN/conffiles
# The package will be saved here:
DEBPKG="${DIRECTORIO_FUENTE}/${NAME}_${VERSION}-${RELEASE}_${ARCHITECTURE}.deb"
Rebuild your deb package with the patched
checkinstall and the deb installation should complete successfully (supposing there're no other problems with your package

).
Comments
Patching and building checkinstall in Karmic and later
As described here, I had difficulties building the
checkinstallpackage with a simpledpkg-buildpackagecommand.Here's what worked for me (I went straight for the "cutting edge"
wget 'http://archive.ubuntu.com/ubuntu/pool/universe/c/checkinstall/checkinstall_1.6.2.orig.tar.gz'wget 'http://archive.ubuntu.com/ubuntu/pool/universe/c/checkinstall/checkinstall_1.6.2-1.debian.tar.gz'
wget 'http://archive.ubuntu.com/ubuntu/pool/universe/c/checkinstall/checkinstall_1.6.2-1.dsc'
dpkg-source -x checkinstall_1.6.2-1.dsc
# note in the output of the above step that patches were already applied and thus the build process depends on this!
cd checkinstall-1.6.2
export QUILT_PATCHES=debian/patches
quilt new fix-etc.diff
quilt add checkinstall
###
# here I edited the contents of the checkinstall file as described in my original post
###
quilt refresh
debuild -uc -us -b
Please report to upstream BTS
Thanks
Re: Please report to upstream BTS
I'll try and do my best.
As for your email: of course my checkinstall patch can be licensed via GPL (or whatever license checkinstall comes with). The generic CC license message in the footer of my blog is there so people won't be allowed to just grab any idea/code from my blog and get rich by selling/using it.
Re: Please report to upstream BTS
And the ticket in Debian's BTS is here.