[Debian-tex-commits] SVN lmodern commit + diffs: r2918 - lmodern/trunk/debian
Florent Rougon
frn at alioth.debian.org
Wed May 30 16:22:21 UTC 2007
Author: frn
Date: 2007-05-30 16:22:21 +0000 (Wed, 30 May 2007)
New Revision: 2918
Modified:
lmodern/trunk/debian/changelog
lmodern/trunk/debian/lmodern.preinst
Log:
Use dpkg-query in lmodern.preinst (inside dpkg_md5sum()) instead of parsing
/var/lib/dpkg/status ourselves.
Modified: lmodern/trunk/debian/changelog
===================================================================
--- lmodern/trunk/debian/changelog 2007-05-30 15:57:22 UTC (rev 2917)
+++ lmodern/trunk/debian/changelog 2007-05-30 16:22:21 UTC (rev 2918)
@@ -1,7 +1,10 @@
lmodern (1.010x-4~1) unstable; urgency=low
- * update the location of the original download in the copyright file
- (Closes: #421998)
+ * Update the location of the original download in the copyright file
+ (Closes: #421998). [preining]
+
+ * Use dpkg-query in lmodern.preinst instead of parsing
+ /var/lib/dpkg/status ourselves. [frn]
-- Norbert Preining <preining at debian.org> Thu, 03 May 2007 09:20:35 +0200
Modified: lmodern/trunk/debian/lmodern.preinst
===================================================================
--- lmodern/trunk/debian/lmodern.preinst 2007-05-30 15:57:22 UTC (rev 2917)
+++ lmodern/trunk/debian/lmodern.preinst 2007-05-30 16:22:21 UTC (rev 2918)
@@ -83,15 +83,42 @@
fi
fi
fi
+
return 0
}
+# Retrieve the MD5 sum of a conffile from the dpkg database.
#
-# We have to move the map and dvips config file into /usr/share/texmf
-# but want to preserve changes done by the user!
+# $1 -- package name
+# $2 -- full (absolute) path to the conffile; this path will be matched
+# against the output of:
#
-dpkg_md5sum(){
- grep "$1[[:space:]]" /var/lib/dpkg/status | cut -f 3 -d ' '
+# 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 ];
+ res=0
+ else
+ echo "Conffile '$conffile' not found in package '$package'" >&2
+ res=1
+ fi
+
+ return $res
}
move_very_old_map_file_away ()
@@ -100,7 +127,7 @@
if ! [ -r $oldfile ] ; then
return 0
fi
- originalmd5sum=$(dpkg_md5sum "$oldfile")
+ originalmd5sum=$(dpkg_md5sum lmodern "$oldfile")
installedmd5sum=$(md5sum "$oldfile" | cut -d ' ' -f 1)
if [ "$originalmd5sum" = "$installedmd5sum" ] ; then
echo "Removing obsolete, unchanged conffile $oldfile"
@@ -116,17 +143,20 @@
please make a copy of /usr/share/texmf/fonts/map/dvips/lm/lm.map
and put it into /etc/texmf/fonts/map/dvips/lm/lm.map." >&2
fi
+
+ return 0
}
config_move ()
{
mode="$1"
- oldfile="$2"
- newloc="$3"
+ package="$2"
+ oldfile="$3"
+ newloc="$4"
- originalmd5sum=$(dpkg_md5sum "$oldfile")
+ originalmd5sum=$(dpkg_md5sum "$package" "$oldfile")
- if ! [ -r $oldfile ] ; then
+ if ! [ -e "$oldfile" ] ; then
return 0
fi
oldloc=$(dirname "$oldfile")
@@ -160,6 +190,8 @@
exit 1
;;
esac
+
+ return 0
}
@@ -185,7 +217,7 @@
# lm.map is still in /etc/texmf/map/dvips/lm/.
if dpkg --compare-versions "$2" gt 0.92-7 \
&& dpkg --compare-versions "$2" lt 0.99.3-1; then
- config_move remove_dir /etc/texmf/map/dvips/lm/lm.map \
+ config_move remove_dir lmodern /etc/texmf/map/dvips/lm/lm.map \
/etc/texmf/fonts/map/dvips/lm
fi
@@ -200,8 +232,8 @@
# /etc/X11/fonts/X11R7/Type1/lmodern.scale back to /etc/X11/fonts/Type1 if
# upgrading from 0.99.3-3.
if [ "$2" = 0.99.3-3 ]; then
- config_move keep_dir /etc/X11/fonts/X11R7/Type1/lmodern.scale \
- /etc/X11/fonts/Type1
+ config_move keep_dir lmodern \
+ /etc/X11/fonts/X11R7/Type1/lmodern.scale /etc/X11/fonts/Type1
fi
fi
More information about the Debian-tex-commits
mailing list