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

Re: Dependency for pre-configure script



Quoting Antonio Russo (2023-03-18 07:49:00)
> Hello,
> 
> I'm trying to perform a task during debian/package.config which
> requires another package to be installed.  I initially thought
> pre-depends would be strong enough, because [1] describes it by:
> 
>     This field is like Depends, except that it also forces dpkg to
>     complete installation of the packages named **before even starting
>     the installation of the package which declares the pre-dependency,**
>     as follows:
> 
> (my emphasis).  However, reading the next paragraphs does not appear to
> indicate any requirements are attempted to be satisfied before debconf/
> pre-configure questions are asked (only preinst, unpack, and configure
> are explicitly mentioned).
> 
> Indeed, trying to install a package with a pre-depends on certbot that
> has a debconf debian/config file does not have certbot installed by
> the time the debconf script starts.  This is on testing.
> 
> My question: is there a way to ensure a package is installed *before*
> getting debconf input from the user?  Alternatively, is there a way to
> run debconf questions during a preinst script?  Just doing
> 
>   db_get package/template
>   db_go
> 
> doesn't seem to work (it does nothing?). Am I doing something wrong? Is
> there a preferred way to do this?
> 
> Best,
> Antonio
> 
> [1] https://www.debian.org/doc/debian-policy/ch-relationships.html

What confuses here is not package installation order, but that debconf
is a cache of answers to questions, and that cache may be (and is, for
normal uses of debconf together with apt) filled ahead of time.

Because debconf is a cache of answers to questions, insisting that
questions should be answered *without* caching is against the core
design of the tool, and you then better not use that tool.  Beware
though, that there is a very good reason for the caching design: It was
invented to allow asking all install questions once, not force the user
to sit next to their computer for the whole duration of a system
installation to wait for each question that might pop up and pause the
install process until answered.  Therefore, since debconf got invented,
it has been added to Debian Policy that you should not ask questions
that cannot be cached (i.e. you really shouldn't bypass debconf).


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/
 * Sponsorship: https://ko-fi.com/drjones

 [x] quote me freely  [ ] ask before reusing  [ ] keep private


Reply to: