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

Re: Debconf problem



Joey Hess <joeyh@debian.org> wrote:

> dpkg-reconfigure runs the config script exactly once, so the config file
> is read once, its values are used for defaults to the questions to allow
> reconfiguration, and are saved to the config file by the postinst.

Yes, I was wrong about this - it's only run twice upon apt-get install
and friends.

> In more complex cases, such as adding a debconf question based on a
> config file line that already exists in a previous version of the
> package, you have to add additional code.

Mine is probably a "more complex case", but it may be not so uncommon.
I only talked about config files because I didn't understand the details
even of the simple case, but that is clear now.

In the real case, the item that is configured are the permissions of
generated files (i.e. files not included in the deb, so
dpkg-statoverride cannot be used), the ls-R files of teTeX/tex-common.
There existed some debconf questions about this, but the approach we
took in sarge was flawed, and therefore we decided to not take over any
"seen" flags.

What we try to do is determine which of three ls-R files should be
group-writable.  Upon a fresh install, they don't exist when config is
run, but upon upgrade or dpkg-reconfigure they do exist.  Is there any
package that does a thing like that?  

I found no way to cleanly solve the problem of 

- writing the current state into the debconf database, so that
  noninteractive installs don't change anything

- actually reflect changed answers in the system.

The only idea I came up with is to tell the script whether the question
has been *just* seen (e.g. with a db_fset mypackage/question justseen
after db_go in config, and resetting this flag in the postinst script).
But this seems to be an ugly hack.  The current code, stripped down to
one file, is

    if [ -r $lsr ] ; then
	if ls -l $lsr | grep -q ^.....w ; then
	    gwrite="true"
	else
	    gwrite="false"
	fi
        db_set tex-common/managedlsr $gwrite || true
    fi
    db_input low tex-common/managedlsr || true
    db_go

And the postinst does

    db_get tex-common/managedlsr || true
    if [ "$RET" = "true" ]; then
      test -e $lsr || echo "$ls_R_magic" > $lsr 
      chmod g+w $lsr
    fi

TIA, Frank

-- 
Frank Küster
Inst. f. Biochemie der Univ. Zürich
Debian Developer



Reply to: