On Tue, Sep 12, 2006 at 05:21:50PM -0700, Steve Langasek wrote:
> On Wed, Sep 13, 2006 at 12:40:33AM +0200, sean finney wrote:
> > also, if you have an answer to the original question it'd be
> > appreciated. i'd really really like to avoid using ucf, since there's
> > something like 40 conffiles shared between the packages. but having
> > asked on #d-d a few times as well as here and not having heard anything,
> > i'm afraid i'm going to have to bite the bullet on this one as frank
> > suggests.
>
> After an upgrade and answering all of the conffile prompts, does
> /var/lib/dpkg/info/nagios-plugins.conffiles still exist and reference these
> files? Depending on what dpkg is really doing here, it may well be possible
> to handle the conffile transfer in maintainer scripts. (And I thought
> dpkg.org once had recipes for exactly this, but unfortunately the site has
> been down for some time now. :/)
It should just be a matter of removing the files from the old package
and letting the new ones take their place (with a backup if there are
any user changes). A little grepping around in /var/lib/dpkg/info
turned up this snippet for removing conffiles.
nagios-plugins.preinst:
rm_conffile() {
CONFFILE="$1"
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
echo "conffile $CONFFILE has been modified by you."
echo "Saving as $CONFFILE.dpkg-bak ..."
mv -f "$CONFFILE" "$CONFFILE.dpkg-bak"
else
# conffile isn't modified and will be restored in nagios-plugins-*
rm -f "$CONFFILE"
fi
fi
}
case "$1" in
install|upgrade)
if dpkg --compare-versions "$2" le "$OLDVERSION"; then
rm_conffile "/etc/file1"
fi
esac
James
--
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@debian.org>
Attachment:
signature.asc
Description: Digital signature