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

Re: [david@eelf.ddts.net: Re: why do we care about configuration files?]



On Fri Apr 18, 05:28pm -0400, Colin Walters wrote:
> > 1) Package has a configuration file which can (optionally) be
> > managed
> >    debconf/postinst
>
> This is already the way things are now; a package doesn't have to do
> anything special to create configuration files in its postinst.

Yeah, I was just setting out the scenario.

> > 2) Package's .config asks, *once* (respecting debconf "seen" flag), the
> >    following question:
>
> Uggg.  We should be extremely hesitant about changing
> /etc/conffiles/{managed,unmanaged,default} in maintainer scripts.  I
> mean they exist solely *because* of the problems of changing
> configuration files in maintainer scripts :)

I think this is the *perfect* place for maintainer scripts. We can make
the format extraordinarily simple, such that anybody who is capable of
writing a maintainer script can take 60 seconds to parse it and write it
out. It could be as simple as:

if [[ "$always_yes" = "true" ]]; then
    grep -v '^/etc/foo/bar$' /etc/conffiles/managed > "$tempfile" && cp "$tempfile" /etc/conffiles/managed
    if ! grep '^/etc/foo/bar$' /etc/conffiles/unmanaged; then
        echo /etc/foo/bar >> /etc/conffiles/unmanaged
    fi
fi

I may have the meanings of unmanaged and managed backwards :)

The root of this problem isn't that maintainers are changing config
files in postinst scripts; the root is that those scripts aren't smart
enough to parse those config files and preserve user changes.

> I don't think we should use Debconf to prompt on each package
> installation like this.  Your proposal would make the "medium" debconf
> priority far more painful than it is even now.  Just think about how
> many prompts you'd have to go through on an initial installation.  It
> would be at least a hundred.

I dunno. I agree that it's unpleasant, but at least it'd only have to be
done once. (And that's a common strength in Debian; you usually only
need to do things once, as unpleasant as it might be. I think the
tradeoff has worked really well thus far.)

If /etc/conffiles/* *only* lists files that could possible be managed by
postinsts, then I could live with the question never being asked,
instead being maintained manually through editing /etc/conffiles.

> Basically, it seems to me that in your use case, the user could just:
> echo managed > /etc/conffiles/default 

Yeah, I'm starting to think this.

> And then explicitly list those files they want to keep unmanaged in
> /etc/conffiles/unmanaged.
>
> Now, it would be nice if at the end of a package installation run, dpkg
> said something like:
>
> The following new configuration files have been installed:
> Managed:
>   /etc/foo/foo.conf
>   /etc/blah.config
> Unmanaged;
>   /etc/whee/moo.conf
>
> That way if you see something you want to maintain yourself, you drop it
> into /etc/conffiles/unmaanaged.

Aaah. That's good, I like that.

But I dunno, the scenario I brought up would still remain. Even if a
file is in /etc/conffiles/managed, the user still needs to be asked if
it's okay to overwrite it, unless they tell the system otherwise.

How will we let them tell it otherwise? 

I'm thinking in the "may I upgrade your configuration file?" question,
have the options I mentioned before ("no", "yes", "always-no").

With "no" and "yes" being one-time-only things, "always-no" removing the
line from /etc/conffiles/managed and adding it to
/etc/conffiles/unmanaged.

How's that sound? It's unobtrusive, only adding a third option. We
ensure that /etc/conffiles/* is *extroardinarily* easy to deal with (we
can have a tool to do this for us, akin to
update-rc.d/update-inetd/etc), they'll only get changed when the user
tells us to change them, they're perfectly capable of changing it
themselves manually, and we end up with no more questions than we have
now.

Attachment: pgpmQZtD8Z0mx.pgp
Description: PGP signature


Reply to: