[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The magic of debconf - can I avoid a second run of config?



Hi Johannes,
I am not a Debian Developer, but I've had a similar experience in creating 
a package for installing various Monte Carlo (particle physics) libraries.  
Basically the installer package downloads and builds said libraries into 
their own .deb packages, and I want to have it ask the user whether to 
re-download and recompile those .deb packages every time the installer 
package is upgraded.

My solution:
The scripts are run at installation or upgrade in this order:
- pre-configure using config script
- re-configure using config script (after all packages have been unpacked)
- run postinst script

So the following works, and it will continue to work even if dpkg is fixed 
to run the config script only once.

1) create an entry in the debian/templates file to hold a local variable:
Template: montecarlo-installer-data/already_configured
Type: boolean
Default: false
Description: (for internal use)

2) in the beginning of debian/config, check if the variable is false; if 
so, then re-ask configuration questions by using
	db_fset <variable> seen false
	db_input <priority> <variable> || true

3) in the end of debian/config, reset the already_configured variable to
true so that the second time the config script is called, it won't ask the
config questions.

4) in the end of debian/postinst, reset the variable to false so that 
future upgrades / re-configurations will re-ask the configuration 
questions.

For more details, you can download the source code of my installer 
package by putting this in your /etc/apt/sources.list:
deb-src http://borex.princeton.edu/~kmccarty/ unstable main
and running "apt-get source montecarlo-installer-data"

Please note that I haven't yet had any DDs either bless or condemn the
installer package, though.

Regards,

-- 
Kevin McCarty                Physics Department
kmccarty@princeton.edu       Princeton University
www.princeton.edu/~kmccarty  Princeton, NJ 08544



Reply to: