Initial configuration and installation through d-i
some packages require initial configuration of an external service.
The most common case is the creation of a dedicated database (relational
or LDAP). This is usually done in the postinst.
When the database is hosted on the same server, it means that the database
server needs to be running and functional. But that's not the case if you
install the packages directly within debian-installer (the /target chroot
is temporarily configured in a way that no services are started by
invoke-rc.d, and that's a sane thing to do IMO).
This is a pain for CDD that want to auto-install some of those packages.
How should we handle this problem?
For the the specific case that affected me, I resolved the problem
by creating a simple mechanism to handle initial configuration of such
packages: the initial configuration is moved to a dedicated script that
can be called in 3 ways. The first way is with a "possible" parameter,
the script needs to verify of the pre-requesite are satisfied (is the DB
server up and usable?). The second way is with a "needed" parameter, the
script checks if the initial configuration is needed or if it was already
done by some other ways. And the third way is with a "configure" parameter
and here the real job is done.
The postinst runs "configure" only if "possible" and "needed" are true.
If "possible" is false, then it registers the script for later execution
(by creating a symlink to itself in some predetermined directory).
A new init script has been added so that at the end of the boot sequence,
when all services have been started, another try is made for all the
registered scripts. On success, the symlink is removed, otherwise it's
kept for as long as the configuration doesn't succeed. This means that
initial configuration (usually) happens at the end of the first reboot.
What would be the proper place for such a "deferred configuration"
service? Does it require a dedicated package or would it fit in some
existing one? The principle is generic enough to be applied to other
cases than database creation but as it's the most important use,
maybe dbconfig-common would be a good choice?
Le best-seller français mis à jour pour Debian Etch :