[Devel] Automatic configuration for debian packages

Dan Pascu dan at ag-projects.com
Thu Feb 2 17:27:57 CET 2006


I have just committed support for automatically configuring openser when 
installing from a debian package, by use of debconf.

When the openser debian package is installed, it will ask a number of 
questions from you, memorizing your answer for later use. Then these 
answers will be used to build a defaults file in /etc/default/openser.
This file is then used by /etc/init.d/openser to set various options for 
openser.

This approach makes it very easy to change common startup settings for 
openser without the need to edit /etc/init.d/openser for this.

The startup options that can currently be configured are:

1. The amount of shared memory that openser will use.
2. If openser is to be automatically started on boot or not. This is 
   useful in 2 scenarios:
   a. If you are just testing stuff and don't want it to start 
      automatically, but prefer to start it by hand
   b. if you run a high availability cluster system, where applications
      are started under the control of software like 'heartbeat' which 
      decides which of the cluster nodes is the active one and should
      have the applications running.
3. If openser is to dump core files on crashes

Except these options that can be configured using debconf, there are 2 
other settings that are present in /etc/default/openser which can only be 
edited manually: the USER and GROUP to run openser as.

Settings can be changed at any time by running

dpkg-reconfigure openser

or by manually editing /etc/default/openser

If you manually edit this file, the changes will be preserved next time 
dpkg-reconfigure is run, so the defaults file can be manually edited 
safely without fearing you will loose the changes.
However, the only need to manually edit the defaults file is if you plan 
to use a different user/group, because all the other settings can be 
changed easier with dpkg-reconfigure.

If you manually edit the file, you should also take care of restarting 
openser as needed. 
However if you use dpkg-reconfigure, openser is automatically stopped, 
reconfigured and restarted as needed, according to the user specified 
settings (dpkg-reconfigure knows if the server is to be started or not 
after it's reconfigured based on what options you have chosen: start on 
boot, ...).

-- 
Dan



More information about the Devel mailing list