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

Re: Metapackage, pre-depends & soft dependency



Le 06/08/2020 à 14:22, Drexl, Johannes a écrit :
> I guess this is quite a frequent question, but googling doesn't really
> answer anything. So apologies beforehand.
> 
> I got a constellation as follows:
> 
> Package A provides a central node with ReST-API
> Packages B-Z need to talk to it, but obviously don't need package A on
> the local machine.
> 
> The installer for package A lets the user choose the port on the
> system, as it's no IANA-registered application, so the port is only
> known after postinst has finished. (there's a couple of other tasks to
> be done before connections can happen, but most can be worked around by
> increasing timeouts on the other packages - ugly but works, alas the
> port is obviously crucial).
> 
> The installers for packages B-Z need that port, and can ask the user,
> but prefer to look if package A is already configured to read out the
> port from the config and avoid asking the user. This alone would call
> for a classic 'Depends:', but since it's entirely possible for A to be
> on another system, it's not an option.
> 
> Until now it's a 'well, let the user install A first, or deal with the
> question'. I'm with you there.
> 
> Now I want to bundle the whole shebang into a metapackage; installing
> all from A-Z. As far as I understood, the installation process will run
> as follows:
> 
> 1. Execute all preinst of packages A-Z and the metapackage in any order
> 2. Unpack all packages in any order
> 3. Run postinst for packages A-Z in any order, since no dependencies
> are declared
> 4. Run postinst for the metapackage (as it depends on A-Z)
> 
> So in the end an unknown number of packages from B-Z will ask for the
> port, as package A is not yet configured, until apt decides it's time
> for A.
> 
> Is there a possibility to tell apt from the metapackage (or preferably
> single package) perspective to execute postinst for A first? Or is this a prime example for declaring A a pre-dependency of the metapackage?
> 
> Thanks for your thoughts and help.

One theoretical solution to the "A could be on another host" part: you
can create a "Aconfig" package that would only ask for the port and make
A-Z pre-depend on Aconfig.


Cheers,

-- 
Stéphane


Reply to: