Re: transitioning config files between two packages
Hi Steve,
maybe you've missed that question to you in a conversation we had on
-devel. Can you please have a look?
Regards, Fr'Fullquote follows'ank
Frank Küster <frank@debian.org> wrote:
> Frank Küster <frank@debian.org> wrote:
>
>> Steve Langasek <vorlon@debian.org> wrote:
>>
>>> Yes, you're right that this code unconditionally uses the user's version of
>>> the conffile when moving it, instead of allowing the conffile question to
>>> happen.
>>>
>>> The way to get the conffile prompt for a user-modified file is
>
> Hm, I've tried to write that up in the Wiki, but I found that I don't
> completely understand what you wanted. You wrote:
>
> ,----
> | The way to get the conffile prompt for a user-modified file is to move the
> | old version of the conffile to the new location in the preinst if the old
> | conffile md5sum doesn't match the current conffile md5sum for the package.
> | Since the earlier preinst code has already removed any old versions of the
> | file that are known to be unmodified, this won't give any undesirable
> | conffile prompts.
> `----
>
> Thus far, it seems clear to me. We just need to change the preinst code
> from the Wiki:
>
> prep_mv_conffile() {
> CONFFILE="$1"
> + NEWCONFFILE="$2"
>
> if [ -e "$CONFFILE" ]; then
> md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
> old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
> if [ "$md5sum" = "$old_md5sum" ]; then
> rm -f "$CONFFILE"
> + else
> + mv "$CONFFILE" "$NEWCONFFILE"
> fi
> fi
> }
>
> Now I thought that is all that needs to be done: Simply ship the
> conffile, and now dpkg will
>
> - simply install it if prep_mv_conffile has found the old one unchanged
> and removed it
>
> - ask the desired conffile prompt if prep_mv_conffile has found it
> changed and already moved to the new place.
>
> Now all that's missing is that dpkg probably still things that the old
> package is in state "rc", with the conffile at the old place
> registered. But that's nothing a maintainer script can solve[1].
>
> However, you (Steve) continued:
>
> ,----
> | Then, if dpkg's stored md5sum for the old conffile *does*
> | match that of the current shipped conffile (which you'll know because you
> | still have the conffile present in the old location in the postinst), you
> | would go ahead with this same code in the postinst to move it into place
> | silently.
> `----
>
> As explained above, I don't understand why any more code is needed at
> all. Second, all this has been done in preinst already: compare md5sums
> (although not with the current shipped one), move into place.
>
> What am I missing?
>
> Regards, Frank
>
>
> [1] manually calling "aptitude purge" or "dpkg --purge" on packages in
> rc is something that helps here. But this possibility means that it is
> in fact desirable to rename conffiles when they are taken over by other
> packages. Otherwise you can't write "Transitional package. This can
> savely be removed...", since people will probably understand that as "or
> purged".
--
Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)
Reply to: