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

Re: Review request: debconf templates for mrtg



Eriberto Mota <eriberto@debian.org> writes:

> Hi Justin,
>
> On Wed, 16 Aug 2023 07:43:46 +0100
> Justin B Rye <justin.byam.rye@gmail.com> wrote:
>
>> Eriberto wrote:
>> > Due #1041332, I needed to change a template. Could you check it
>> > for
>> > me? I will write it below.
>> > 
>> > Template: mrtg/move_config_file
>> > Type: note
>> > _Description: /etc/mrtg.cfg should be moved to /etc/mrtg/mrtg.cfg
>> > Older versions of MRTG on Debian had the configuration file
>> > /etc/mrtg.cfg.
>> > This file should now be located in the directory /etc/mrtg/. The
>> > Debian
>> > Policy doesn't allow the installation system to change the place
>> > of the
>> > configuration files already present in the system (see Policy
>> > 10.7.3).
>> > Please, consider to make the needed adjustments in your system
>> > manually.
>> 
>> 10.7.3 doesn't say you can't *move* a conffile; it says you can't
>> blindly overwrite it, discarding user changes.  If mrtg moved its
>> existing configuration file to /etc/mrtg/mrtg.cfg like it says it's
>> going to, that would be okay; the problem is that dpkg makes that
>> tricky to implement.  See Policy 5.3, and dpkg-maintscript-helper(1)
>> on the "dpkg-maintscript-helper mv_conffile" function:
>
>
> You are right. Thanks for this approach.
>> 
>> # If a conffile is moved from one location to another, you need to
>> # make sure you move across any changes the user has made. This may
>> # seem a simple change to the preinst script at first, however that
>> # will result in the user being prompted by dpkg to approve the
>> # conffile edits even though they are not responsible of them.
>> 
>> (I think dh_installdeb can automate putting dpkg-maintscript-helper
>> snippets into maintscripts, but I'm not sure how that works.)
>
>
> You are right again. However, this is a big effort for a minimum of
> machines (or none for now) in this situation. I decided just to show
> a message for the users.
>

I susoect that dpkg-maintainer-helper be much less effort for you and
better for users.

all you need to do is write a debian/mrtg.maintscript file with

mv_conffile /etc/mrtg.conf /etc/mrtg/mrtg.conf version~ mrtg

where version is the version being uploaded.  debhelper/dpkg will then
ensure the file moves in a way that preserves user modifications without
annoying people who never edited anything.

I think you will find this much easier than trying to write a debconf
note in good enough english that any users can then action (not tp
mention having it translated).


Reply to: