June 2, 2004
This article was contributed by Joe Klemmer
Most Linux distributions today use some form of package
management to deal with dependencies and to make upgrades and
installation of software easier for the ever-overworked
systems administrators. The most popular formats for packages are Red Hat
based RPM files, Debian DEB files, Slackware TGZ files and the
build-from-source Ports-like method of distributions such as
Gentoo, Lunar Linux, et. al. However, there exist many apps and
tools which are only released as source tarballs using the
ubiquitous "configure; make; make install" or binary only
tarballs.
If you want to use these tarballs but also manage them
in the same way you do the rest of your OS you had to deal with
jumping through the hoops required of the package management
systems used by your distribution. That is until now, thanks to a
wonderful little utility called CheckInstall.
Developed and maintained by Felipe Eduardo Sánchez
Díaz Durán, CheckInstall consists of a collection of shell
scripts and a library. With it, you can build an .rpm or .deb or
.tgz package that will install using the associated packaging
tools.
The easiest way to use CheckInstall is in place of the "make
install" portion of a typical build process. Executing
CheckInstall will run "make install" using the installwatch
script.
This script keeps track of the "make install", then
feeds the results info to CheckInstall in order for it to build the
package. These tools allow for the ability to build and manage
any self-made packages as easily as any binary package you might
download from the net. They give you great flexibility in how
you build the package, and even how dependencies are managed.
Let's see what a typical run of CheckInstall might look like:
Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]? R
This package will be built according to these values:
1 - Summary: [ libcgi 1.0 ]
2 - Name: [ libcgi ]
3 - Version: [ 1.0 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ libcgi-1.0 ]
9 - Alternate source location: [ ]
10 - Provides: [ ]
11 - Requires: [ ]
Enter a number to change any of them or press ENTER to continue:
As you can see, CheckIinstall allows you to edit all of the
basic fields that describe a package, in this case an RPM package.
The fields are pre-filled
with reasonable data, however you can change any of the fields
to new values. It's likely that you'll want to change #6 and possibly
#5, #7 and #11. You also have the ability to run pre and post
install scripts as well as pre and post removal scripts.
There are
a few things you need to do to get setup for building a package with
CheckInstall. First, you'll need a file named "description-pak"
which should contain the program name and version, followed by a
description. You should also create a subdirectory named
"doc-pak" in which you can put the text files like README,
ChangeLog and the like.
One very nice thing you can do with CheckInstall is tell it to
run a specific program or script for the software installation.
For example, you might find a very good program that is only released
in binary format with a script called
"setup" that's used to install it. You can build a package for it
by telling CheckInstall to use the "setup" script for the install
portion.
An example command might look like this:
$ checkinstall -R --install=yes ./setup
This command line will build and install an RPM but using the
setup script to do the actual installing. By default CheckInstall
builds the package but doesn't install it. The "--install=yes"
option causes CheckInstall to perform the package installation.
You can also use the switch "--rpmu" to do an upgrade of a package
that is already installed.
Once a package is made using
CheckInstall it is virtually impossible to tell it apart from a
package built with a hand-generated spec file. There's even a
nice feature for saving the spec file that checkinstall makes in
order to build the packages. This generated spec file is normally
deleted after the package has been built but if you pass the
switch "--delspec=no", it will leave the spec file behind. With
this as a starting point, you can easily ramp up your skill at
hand building spec files.
Lastly, whenever you install a package with CheckInstall, it
will automatically make a backup tarball of the currently
installed package, if one exists. You'll find a file named:
"backup-<datetime>-pre-<packagename>-<version>.tgz"
in the directory from which you built the package. Should
anything go wrong with the newly created package, you can roll
back to the previous version using a command like: "tar xzvf
backup-<datetime>-pre-<packagename>-<version>.tgz
-C /".
As for the future direction of CheckInstall development, Felipe said this:
One interesting feature planned for the
not-so-distant future is the evolution of CheckInstall into a
tool that will do the whole software install for you: download
the source, configure, compile, install and package it. All in
one step.
If he is able to get this functionality into CheckInstall,
it will become an even more required tool for systems
administrators, along with yum and apt.
Bottom line: CheckInstall is a fantastic tool that should be
on every administrators and developers need-to-have list.
(
Log in to post comments)