Re: [Guillem Jover] Parsing of dpkg status file considered harmful
Hi,
Frank Küster <frank@debian.org> wrote:
> This affects us...
Yup. I modified dpkg_md5sum() in lmodern.preinst as follows. Since this
function came from the teTeX packages, maybe you'll have to commit a
similar change to TL.
# Retrieve the MD5 sum of a conffile from the dpkg database.
#
# $1 -- package name
# $2 -- full (absolute) path to the conffile; this path will be matched
# against the output of:
#
# dpkg-query -W -f='${Conffiles}' <package>
#
dpkg_md5sum()
{
package="$1"
conffile="$2"
found=0
dpkg-query -W -f='${Conffiles}' "$package" \
| while read file sum; do
if [ "$file" = "$conffile" ]; then
echo "$sum"
found=1
break
fi
done
if [ $found -eq 1 ]; then
res=0
else
echo "Conffile '$conffile' not found in package '$package'" >&2
res=1
fi
return $res
}
This is only partially tested, but I'm confident it works (I tested the
"core" in an interactive shell).
I also committed a trivial change to config_move() because it uses
dpkg_md5sum() and therefore needs a new argument indicating the package
name. Maybe you'll also have to change TL if using config_move() there.
--
Florent
Reply to: