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

Re: dpkg-reconfigure and postinst

On Wed, Jul 05, 2006 at 02:35:44AM -0500, Gerfried Fuchs wrote:
>  Is my analysis flawed?  Is there a way to differentiate between a
> reconfigure and a reinstall that I didn't see?  Is there a cleaner
> approach to this problem than dynamically generating the postinst?

take a look at $1 as passed to the config script in installs vs
reinstalls.  in installs/reinstalls it will be "configure", and
in reconfigurations, it will be "reconfigure".

of course this isn't completely solving the problem, as you have to
pass this information on to the postinst script.  i've had to do this
before, and solved it by using the above knowledge plus a debconf
"question" specifically purposed for passing the info from config
to postinst.  something like:

= = = =
= = = =
if [ "$1" = "reconfigure" ]; then
	db_set package/reconfiguring true
= = = =
= = = =
	db_get package/reconfiguring && reconfiguring="$RET"
	db_reset package/reconfiguring
= = = =
and the template:
= = = =
Template: package/reconfiguring
Type: boolean
Default: false
= = = =

it's not the *cleanest* solution out there, but it works, and there's
nothing wrong with it from a technical/policy perspective.  the real
solution would be for dpkg to finally get around to implementing
"reconfigure" being passed to postinst (istr docs mentioning that this
would "some day" happen), but this will break many, many things.


Attachment: signature.asc
Description: Digital signature

Reply to: