This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature

CLI Magic: CheckInstall

By Joe Barr on October 10, 2005 (8:00:00 AM)

Share    Print    Comments   

OK, you one-click installers, listen up! In spite of the early dementia no doubt being brought on by living in a GUI cocoon, there's a chance you might learn something from this week's CLI Magic. Here's the thing: given the ease of installing free software apps these days, especially those installed outside your distro's package management, how do you get rid of that great game you installed from scratch last week when you learn it opens your system up to hostile takeover? Think that just removing the executable does the trick? Think again, oh rodent lover. Now you're ready to learn about CheckInstall.
All the major package management tools provide easy-on/easy-off program installation and removal, so no big deal. But no matter what your favorite distribution, if you like to sample free software offerings, someday your just-gotta-have-it app is not going to be available as a package in whatever scheme your distro uses. It doesn't matter whether your distro uses Deb, RPM, or another packaging scheme: it's going to happen. You're going to have to install from source code using ./configure, make, and make install, and the app will live outside the confines of your package manager. Such apps -- installed outside the normal package management -- become difficult to remove. Why? Because there just isn't any easy way to know exactly what has to go, and that's exactly what inspired Felipe Eduardo Sánchez Díaz Durán to write CheckInstall.

The magic in CheckInstall is that it learns everything your new app or package will add to your system, and then creates a binary installable package geared to the package manager you use, whether that be Slackware, RPM, or Debian. Optionally, it will also install the newly created package. But whether you install then or later, when the time comes that you want to remove the package from your system, all you need to do is run the appropriate command for your package manager.

CheckInstall is available for download here as a source tarball or as a Slackware, RPM, or Debian package. If you're running Slackware, you can find CheckInstall in the Package Broswer. That's how I installed it on my Slackware box. Here's how I installed from the source code on my SUSE box. Refer to the README for more detailed instructions.

After decompressing the tarball, I entered the checkinstall-1.6.0 subdirectory and from the command line entered the following commands:

make
su
make install

Finally, copy the executable script checkinstall from the installation directory to a directory in root's path. I chose /sbin. Before using CheckInstall, it's a good idea to make at least a few minimal changes to the checkinstallrc file. If you've installed from a package designed for your distribution, these changes may already be done for you. Edit the checkinstallrc-dist file found in the installation directory, then move it to /usr/local/lib/checkinstall/checkinstallrc.

Find the following text in the checkinstallrc-dist file:

# Default package type. Leave it empty to enable asking everytime
#   S : Slackware
#   R : RPM
#   D : Debian

INSTYPE=""

Then insert the appropriate code (S/R/D) between the "" marks so that the final line reads:

INSTYPE="R"

or whatever is right for you. This will prevent checkinstall from asking you what format package to build each time it's run.

Now let's give it a whirl. I downloaded and decompressed the source code tarball for the beta version of the popular arcade game, LBreakout2. Then, after entering the lbreakout2-2.6beta directory, I executed the first two commands of the familiar free software mantra, ./configure, make, and make install. NOTE: Don't do the make install, just ./configure and make.

The third command is replaced with checkinstall. Run it as root, just as you would normally do make install. Be sure you are still in the installation directory of the application you want to create a package for.

The first time you run checkinstall, the following will appear:

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

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

Hit enter to answer yes.

Next, you'll be asked for a description:

Please write a description for the package.
End your description with an empty line or EOF.
>>

I entered "Mission critical - cool arcade game" and hit enter twice.

Then the following screen appeared at my console:

**************************************
**** RPM package creation selected ***
**************************************

This package will be built according to these values:

1 - Summary: [ Mission critical cool arcade game ] 2 - Name: [ lbreakout2 ] 3 - Version: [ 2.6beta ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ Applications/System ] 7 - Architecture: [ i386 ] 8 - Source location: [ lbreakout2-2.6beta ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ lbreakout2 ]

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

Again, I simply hit enter to continue. And continue it did, with lines scrolling fast so quickly I couldn't read them all as it created a temporary directory to do it's version of "make install" into to learn the secrets of the installation. Note that the package was not really installed on my system, it merely created an RPM for me to install later. What it told me was:

 Done. The new package has been saved to

/usr/src/packages/RPMS/i386/lbreakout2-2.6beta-1.i386.rpm You can install it in your system anytime using:

rpm -i lbreakout2-2.6beta-1.i386.rpm

In reality, I found that I had to specify the complete file spec, not just the file name, but the result was the same. Not only was lbreakout2 installed on my system, the package management system was aware of it, and I could easily remove all traces of it with the rpm -e command.

There is a lot more power, and other uses, for CheckInstall. But you'll never learn any of them if you don't get started somewhere, and creating appropriate packages for your distribution is a great way to do that.

Share    Print    Comments   

Comments

on CLI Magic: CheckInstall

Note: Comments are owned by the poster. We are not responsible for their content.

rock has it

Posted by: Anonymous Coward on October 10, 2005 04:48 PM
you know, rock linux has this in a small shellscript called mkpkg:
<a href="http://www.rocklinux.net/svn/rock-linux/trunk/package/base/sysfiles/mkpkg.sh" title="rocklinux.net">http://www.rocklinux.net/svn/rock-linux/trunk/pac<nobr>k<wbr></nobr> age/base/sysfiles/mkpkg.sh</a rocklinux.net>
call it with "mkpkg foobar make install" and it creates upon others a<nobr> <wbr></nobr>/var/adm/flists/foobar listing all the files in the package.

Greetings,
blindcoder

#

On SELinux enabled systems

Posted by: Anonymous Coward on October 10, 2005 05:21 PM
Go in checkinstallrc and add<nobr> <wbr></nobr>/selinux to the EXCLUDE variable.

This way checkinstall works in Fedora Core also (for example).

#

--prefix ?

Posted by: Anonymous Coward on October 10, 2005 06:44 PM
Why not just<nobr> <wbr></nobr>./configure --prefix=/opt/program - keep it isolated anyway?

#

Re:--prefix ?

Posted by: Anonymous Coward on October 10, 2005 07:53 PM
Alas, this not always works properly. For example, back when I installed Xfce 4.0 from source to<nobr> <wbr></nobr>/usr/local, it couldn't see GTK+ themes installed under<nobr> <wbr></nobr>/usr prefix.

#

Re:--prefix ?

Posted by: Anonymous Coward on October 11, 2005 04:44 AM
How do you deal with paths then? Create symlinks in<nobr> <wbr></nobr>/usr/local/bin,<nobr> <wbr></nobr>/usr/local/lib, etc? Wouldn't it be annoying to have to remove those?

#

Source Installer

Posted by: Anonymous Coward on October 10, 2005 08:36 PM
For those packages that use the<nobr> <wbr></nobr>.configure && make && make install routine there is a package called Source Installer <a href="http://www.gnu.org/software/sourceinstall/sourceinstall.html" title="gnu.org">http://www.gnu.org/software/sourceinstall/sourcei<nobr>n<wbr></nobr> stall.html</a gnu.org> . It has worked great if all you want to do is install a package from source and be able to track the package files on the system. Where checkinstall has an edge is that it will create the package and then install, allowing you to distribute the package you created.

#

klik

Posted by: Anonymous Coward on October 10, 2005 09:36 PM
<a href="http://klik.atekon.de/" title="atekon.de">http://klik.atekon.de/</a atekon.de> for those who prefer GUIs and don't like to compile. Lets you run apps by just a click, and lets you erase them by simply deleting one file.

#

wtf

Posted by: Anonymous Coward on October 11, 2005 02:05 AM
I thought the checkinstall website was here:

<a href="http://checkinstall.izto.org/" title="izto.org">http://checkinstall.izto.org/</a izto.org>

Now according to this article it's here?:

<a href="http://asic-linux.com.mx/~izto/checkinstall/" title="asic-linux.com.mx">http://asic-linux.com.mx/~izto/checkinstall/</a asic-linux.com.mx>

Which one is the real one, both? I don't want trojaned downloads.

#

Re:wtf

Posted by: Anonymous Coward on October 11, 2005 11:10 AM
Both URL's point to the same place in my server. You can use either one<nobr> <wbr></nobr>;-)

-- Izto

#

Re:wtf

Posted by: Joe Barr on October 11, 2005 03:11 AM

The old one is no longer there, use the one from the article.

#

RE:checkinstall

Posted by: Anonymous Coward on October 11, 2005 11:49 PM
I like to do this if testing a piece of software<nobr> <wbr></nobr>./configure --prefix=/home/user/test
then if I donlt like the software then just delete the<nobr> <wbr></nobr>/home/user/test folder that simple.
and no need to be root to install or remove it<nobr> <wbr></nobr>:-)

#

whoohoo!

Posted by: Anonymous Coward on February 12, 2007 12:51 PM
awesome! it saved me a lot of time. thanks<nobr> <wbr></nobr>:D

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya