On Fri, Jun 11, 2004 at 07:26:58PM +0200, Andreas Tille wrote: > > The .config script is executed twice during an apt-based package > > installation: once during pre-configure, and once when the postinst > > runs. > > If you write your .config script carefully, you can make it run > > correctly in the absence of the packages you need, but use them if > > they're present. This maximizes the number of people who will be able > > to take advantage of pre-config for your package. > Ahhh, this is a pretty good hint. "Write it right" means: check first > if the tools are present and run the stuff which runs. May be I have > to "touch /var/tmp/pkg.just-configured" to set a marker for the second > call, should I? Usually not; you should still be able to reconfigure the package with dpkg-reconfigure, and the scripts must be idempotent, so as long as you write for this there's rarely any reason to need state files to track whether the config script has done anything before. (And /var/tmp would be the wrong place -- you'd need to store this in /var/lib.) > Any example packages to steal code and make sure I understand right? Well, the libct1 package uses the same kind of check in a preinst, but this is probably a bad example because 1) it's in the preinst rather than the config, and 2) it does need a separate state file to prevent running a certain command twice. ;) -- Steve Langasek postmodern programmer
Attachment:
signature.asc
Description: Digital signature