6.1.1. Helper scripts
The rationale for using helper scripts in debian/rules
is that they let maintainers use and share common logic among many packages. Take for instance the question of installing menu entries: you need to put the file into /usr/share/menu
(or /usr/lib/menu
for executable binary menufiles, if this is needed), and add commands to the maintainer scripts to register and unregister the menu entries. Since this is a very common thing for packages to do, why should each maintainer rewrite all this on their own, sometimes with bugs? Also, supposing the menu directory changed, every package would have to be changed.
Helper scripts take care of these issues. Assuming you comply with the conventions expected by the helper script, the helper takes care of all the details. Changes in policy can be made in the helper script; then packages just need to be rebuilt with the new version of the helper and no other changes.
Overview of Debian Maintainer Tools contains a couple of different helpers. The most common and best (in our opinion) helper system is debhelper
. Previous helper systems, such as debmake
, were monolithic: you couldn’t pick and choose which part of the helper you found useful, but had to use the helper to do everything. debhelper
, however, is a number of separate little dh_*
programs. For instance, dh_installman
installs and compresses man pages, dh_installmenu
installs menu files, and so on. Thus, it offers enough flexibility to be able to use the little helper scripts, where useful, in conjunction with hand-crafted commands in debian/rules
.
You can get started with debhelper
by reading debhelper 1, and looking at the examples that come with the package. dh_make
, from the dh-make
package (see dh-make), can be used to convert a vanilla source package to a debhelper
ized package. This shortcut, though, should not convince you that you do not need to bother understanding the individual dh_*
helpers. If you are going to use a helper, you do need to take the time to learn to use that helper, to learn its expectations and behavior.