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

Re: Debconf, package.config script and subst+multiselect



On 04/05/15 20:51, Yurkao wrote:
> Dear mentors, 
> As I've understood from debconf(7):
>  - package config script runs twice during the deb installation
> As a result:
>  - package config script must be idempotent and must not/should not ask questions twice.
> 
> As I understand,I should control not asking question twice by checking if return value of db_input equals to 30.

That is the return status you will get from db_input if it is not going
to show that question. If that is returned, the question will not be shown.

"Debconf decides if the question is actually displayed, based on its
priority, and whether the user has seen it before, and which frontend is
being used. If the question will not be displayed,
debconf replies with code 30." (from the debconf-devel manpage)

There are also some more undocumented reasons, e.g. for select
questions, you will get this response if there are < 2 choices.

> If so, what if I should "render" multiselect choices of template with db_subst?

I don't understand what you mean here.

> How do I avoid calling db_subst on second config run ? Should I avoid calling db_subst on second run?

If the question is not shown, calling db_subst should do nothing, and
not be a problem?

> What is the best way to avoid asking questions twice? By checking result of db_input=30 or by calling 'db_fget question seen'?

Debconf will manage this for you, as the seen flag. This will be set to
true when the question is seen, and therefore the question will not be
shown again unless the flag is explicitly set to false (or probably for
other reasons also...).


Reply to: