• Re: Dependency for pre-configure script

    From Jonas Smedegaard@21:1/5 to All on Sat Mar 18 09:00:01 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Antonio Russo@21:1/5 to All on Sat Mar 18 08:20:01 2023
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Russ Allbery@21:1/5 to Antonio Russo on Sat Mar 18 16:30:01 2023
    Antonio Russo <aerusso@aerusso.net> writes:

    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.

    See section 8 of the debconf specification:

    The config-file contains a new element, which I call the
    configmodule. This is a program that will determine the configuration
    before the package is unpacked. This means it is usually run before
    the preinst, and before the package is unpacked!

    This could definitely be clearer (and easier to find), but yes, this is expected behavior.

    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?

    The tripwire package prompts in preinst, so that worked at some point, but
    it's for an old upgrade so I don't know if it's still working. I think
    it's more common to prompt in postinst during configure. I know of
    several packages that do that, although it's not considered ideal if you
    can avoid it.

    --
    Russ Allbery (rra@debian.org) <https://www.eyrie.org/~eagle/>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Antonio Russo@21:1/5 to Russ Allbery on Sat Mar 18 17:00:01 2023
    On 3/18/23 09:19, Russ Allbery wrote:
    Antonio Russo <aerusso@aerusso.net> writes:

    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.

    See section 8 of the debconf specification:

    The config-file contains a new element, which I call the
    configmodule. This is a program that will determine the configuration
    before the package is unpacked. This means it is usually run before
    the preinst, and before the package is unpacked!

    This could definitely be clearer (and easier to find), but yes, this is expected behavior.

    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?

    The tripwire package prompts in preinst, so that worked at some point, but it's for an old upgrade so I don't know if it's still working. I think
    it's more common to prompt in postinst during configure. I know of
    several packages that do that, although it's not considered ideal if you
    can avoid it.


    I was using db_get instead of db_input in the preinst script (doh!).

    Everything works fine if you just do the (correct) action in preinst or
    (better still) in postinst. I.e., if you need any dependencies, do not
    try to use them in the preconfigure scripts.

    Thanks,
    Antonio

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)