Debian checkinstall ignores install=no; how to have it build, but NOT autoinstall a package

checkinstalldebian

Ok, here is one thing that puzzles me… I'm trying to build a package from source, and then use checkinstall to generate a .deb package. Note that I want to just create the .deb package, but I do NOT want to install it.

So, here's an example – I'm on Ubuntu 11.04, and first I install it's feh package from the default repositories; which has a version number apparently being 1.3.4.dfsg.1-3

Then I'm trying to build feh from source; got make to pass, and can run the new feh from the command line; splendid.

Now finally, to create a deb package, I use the following command line:

sudo checkinstall -D -y \
  --install=no \
  --fstrans=no \
  --reset-uids=yes \
  --pkgname=feh \
  --pkgversion=2.7 \
  --pkgrelease="tar.bz2" \
  --arch=i386 \
  --pkglicense=GPL \
  --maintainer="Debian PhotoTools Maintainers <pkg-phototools-devel@lists.alioth.debian.org>" \
  --pakdir=../.. \
  --requires=libc6,libice6,libsm6,libx11-6,libxaw7,libxext6,libxmu6,libxt6,dpkg,install-info

OK, notice that I've used --install=no there? Even man checkinstall says:

–install Toggle installation of the created package.

Well, this is what this checkinstall command replies:

checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.

/usr/bin/checkinstall: eval: line 598: syntax error near unexpected token `newline'
/usr/bin/checkinstall: eval: line 598: `echo Debian PhotoTools Maintainers <pkg-phototools-devel@lists.alioth.debian.org>'

The package documentation directory ./doc-pak does not exist. 
Should I create a default set of package docs?  [y]: y

Preparing package documentation...OK

*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values: 

0 -  Maintainer: [ root@mypc ]
1 -  Summary: [ Package created with checkinstall 1.6.2 ]
2 -  Name:    [ feh ]
3 -  Version: [ 2.7 ]
4 -  Release: [ tar.bz2 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ feh-2.7 ]
9 -  Alternate source location: [  ]
10 - Requires: [ libc6,libice6,libsm6,libx11-6,libxaw7,libxext6,libxmu6,libxt6,dpkg,install-info ]
11 - Provides: [ feh ]
12 - Conflicts: [  ]
13 - Replaces: [  ]

Enter a number to change any of them or press ENTER to continue: 

Installing with make install...

========================= Installation results ===========================
installing manuals to /usr/local/share/man
installing docs to /usr/local/share/doc/feh
installing executables to /usr/local/bin
installing fonts to /usr/local/share/feh/fonts
installing images to /usr/local/share/feh/images
installing examples to /usr/local/share/doc/feh/examples

======================== Installation successful ==========================

NOOOOOOOOOOOOOOOOO!!!!!!!!!!

I did NOT want the damn package to INSTALL — THAT IS WHY I USED --install=no FOR CRYIN OUT LOUD!!!

And then, apparently in an attempt to be sarcastic, the log continues:

Copying documentation directory...
./
./TODO
./AUTHORS
./COPYING
./ChangeLog
./README

Copying files to the temporary directory...OK

Stripping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

NOTE: The package will not be installed

You must be kidding with this "NOTE: The package will not be installed", right, Mr. checkinstall? Sure you are; after this is done, note what I get:

$ apt-cache show feh | grep Version
Version: 1.10-1

$ feh --version
feh version 2.7
Compile-time switches: curl xinerama 

$ which feh
/usr/local/bin/feh

Not sure where that 1.10-1 came from (it should have been at least 1.3.4, as per above?) – but its damn obvious that the 2.7 DID get installed, IN SPITE of my instruction NOT to install…

Surely, I can try to remove afterwards:

$ sudo dpkg -r feh
(Reading database ... 202193 files and directories currently installed.)
Removing feh ...
$ sudo dpkg --purge feh
(Reading database ... 202163 files and directories currently installed.)
Removing feh ...
Purging configuration files for feh ...
$ feh --version
feh version 2.7
Compile-time switches: curl xinerama 
$ which feh
/usr/local/bin/feh

… but not even dpkg --purge works (apt-get remove wouldn't work to begin with, since it's a manually installed .deb package). And besides dpkg -r not giving a version (so I'm not really sure what it is that should have been removed) – it in fact did NOT remove the bloody executable ?!

But can anyone explain what is going here – and how to get checkinstall to only generate a .deb, and NOT install it at the same time? Bonus question – how to remove ALL files, including executables in /usr/local/bin/, that got installed in this way – since apparently dpkg -r doesn't work?

Best Answer

Right; I think I finally understood what is happening - key line I missed is:

Installing with make install...

This means that the make install of the 2.7 source package was run - probably in order to "see" where those files will eventually end up, so as to write those locations in the new .deb? But in any case, the new 2.7 .deb indeed didn't get installed - and that is why it couldn't be removed with dpkg -r, and the executable was still lingering even after dpkg -r.

So to remove this installation after running checkinstall, one should actually call make uninstall from the feh source folder:

$ make uninstall
rm -f /usr/local/share/man/man1/feh.1 /usr/local/share/man/man1/feh-cam.1
rm -f /usr/local/share/man/man1/gen-cam-menu.1
rm -rf /usr/local/share/doc/feh
rm: cannot remove `/usr/local/share/doc/feh/TODO': Permission denied
rm: cannot remove `/usr/local/share/doc/feh/examples/keys': Permission denied
rm: cannot remove `/usr/local/share/doc/feh/examples/themes': Permission denied
rm: cannot remove `/usr/local/share/doc/feh/examples/buttons': Permission denied
rm: cannot remove `/usr/local/share/doc/feh/AUTHORS': Permission denied
rm: cannot remove `/usr/local/share/doc/feh/ChangeLog': Permission denied
rm: cannot remove `/usr/local/share/doc/feh/README': Permission denied
make: *** [uninstall] Error 1

$ sudo make uninstall
rm -f /usr/local/share/man/man1/feh.1 /usr/local/share/man/man1/feh-cam.1
rm -f /usr/local/share/man/man1/gen-cam-menu.1
rm -rf /usr/local/share/doc/feh
rm -f /usr/local/bin/feh /usr/local/bin/feh-cam /usr/local/bin/gen-cam-menu
rm -rf /usr/local/share/feh/fonts
rm -rf /usr/local/share/feh/images

... and then finally I can try the newly created package:

$ sudo dpkg -i feh_2.7-tar.bz2_i386.deb 
Selecting previously deselected package feh.
(Reading database ... 202165 files and directories currently installed.)
Unpacking feh (from feh_2.7-tar.bz2_i386.deb) ...
Setting up feh (2.7-tar.bz2) ...
Processing triggers for man-db ...

$ feh --version
feh version 2.7
Compile-time switches: curl xinerama 

$ sudo dpkg --purge feh
(Reading database ... 202198 files and directories currently installed.)
Removing feh ...
dpkg: warning: while removing feh, directory '/usr/local/share/doc' not empty so not removed.
Processing triggers for man-db ...

$ feh --version
bash: /usr/local/bin/feh: No such file or directory

# or in new terminal 
$ feh --version
The program 'feh' is currently not installed.  You can install it by typing:
sudo apt-get install feh

Oh well.... hope I understood correctly how the process goes now, though..

Related Question