[Debian-med-packaging] Displaying a message to the user when upgrade can't be fully automated

Andreas Tille andreas at an3as.eu
Thu Apr 25 06:30:13 UTC 2013


Hi,

On Wed, Apr 24, 2013 at 11:15:37PM +0200, Emilien Klein wrote:
> So I set up about using debconf. The tutorial [0] mentions:
> These questions are asked by a separate config script, not by the
> postinst, so the package can be configured before it is installed, or
> reconfigured after it is installed. Do not make your postinst use
> debconf to ask questions.

The idea is somehow like this:

  1. debian/config script is called *before* the real installation
     process starts and drops some variable into the debconf database.
     You can also create a config file for instance:

       /etc/gnuhealth/config   (or whatever)

     and drop some

       DBNAME=<input_name_for_db>

     into this.  ATTENTION: You *never* should drop such variables
     there without checking whether the user has previously decided
     for a different name.  So *first* read the value from the config
     file if it exists and then use this as default in your debconf
     question.  If it is changed by the user you can change the
     config file.  I remember I have seen examples inside the debconf
     package.

  2. The package is installed and in the postinst script you query
     the debconf database for the variable that was previously set
     and act accordingly.
 
> I understand that as *questions* should not be asked from postinst
> (makes sense, ask before installing, maybe the response to the
> question will result in the package not being installed after all),
> but that you could use it to *display* information to the user.
> 
> So that's what I added to the postinst:
> db_reset gnuhealth/manualupgrade
> db_input high gnuhealth/manualupgrade || true
> db_go
> 
> (I reset the seen flag, since this will need to be executed manually
> at each upgrade)
> 
> But Lintian is not happy, namely:
> E: gnuhealth: no-debconf-config
> W: gnuhealth: postinst-uses-db-input

That's perfectly correct:  db_input should never occure in postinst but
rather in config (which you are missing).  In postinst you should rather
use db_get (of the values you have previously set in your config
script).
 
> Questions:
> * Should I not be using debconf to just display this message to the user?

You should rather use debconf *correctly*. ;-)

>   * If not, what should be used that can handle translation to other languages?
>   * If it is OK, can I override those 2 lintian warnings?

No.  Just have a look for instance into the packaging of biomaj that
provides a simple and working example how debconf should be used
properly.
 
Hope this helps - feel free to keep on asking if something remains
unclear 

     Andreas.

-- 
http://fam-tille.de



More information about the Debian-med-packaging mailing list