[Debconf-devel] debconf vs. invoke-rc.d start

Colin Watson cjwatson at debian.org
Thu Jul 24 14:15:54 UTC 2014


On Thu, Jul 24, 2014 at 04:02:00PM +0200, Thorsten Glaser wrote:
> I need to run debconf *after* calling invoke-rc.d {stop,start} in
> a postrm script. This is tricky.
> 
> Reason: #755908
> 
> So, my postrm basically must do these steps in order:
> 
> • disable the apache config
> • if apache is running,
>   ‣ stop apache
>   ‣ then start apache again¹
> ⇒ ²
> • purge the database
> • purge dbconfig-common’s debconf variables
> • purge the other config files/dirs and state dirs etc.
> 
> ① This really cannot be “reload”. I must make sure that all
>   httpd children die, so they cannot keep holding a DB connection.
> 
> To add insult to injury, I need this for squeeze and up.
> Plan is to upgrade the system from squeeze to something
> newer, but for that, I need to migrate the software from
> SQLite2 first, and I’m doing this while packaging it as
> proper Debian source package at the same time, thanks to
> the benefit that dbconfig-common is.
> 
> I cannot just source the debconf stuff at ② above, because
> the script is re-executed then…

Why can't you source the confmodule at the very top as usual, and use it
later?

If there's some reason why that's impossible, then you can export a
sentinel environment variable before sourcing the confmodule, or
otherwise make sure that everything that runs before that point is
idempotent.  This is normally bad design though, and worth going to some
effort to avoid.

-- 
Colin Watson                                       [cjwatson at debian.org]



More information about the Debconf-devel mailing list