tags 543512 + patch
thanks
On Thu, Aug 27, 2009 at 05:13:52PM +0700, Theppitak Karoonboonyanan wrote:
> On Wed, Aug 26, 2009 at 12:55:04PM -0400, Joey Hess wrote:
> > Alternatively, have it take a list of the font files that are
> > going to be removed, and update the file to remove them; then it could
> > take effect when run at postrm remove time, when dependencies are still
> > satisfied.
>
> This should work. By maintaining an exclude list on font packages removals,
> update-fonts-{dir,alias} can skip the removed fonts and can remove the
> generated fonts.{dir,alias} as soon as the font dirs are empty.
>
> In that case, this bug can be reassigned to xfonts-utils, then.
I've got a patch for update-fonts-alias following this scheme.
No exclude list. Just filter the file list by consulting dpkg-query.
I've tested it by emulating piuparts sequence in a chroot, and it works.
Regards,
--
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/
--- update-fonts-alias.orig 2009-08-27 22:15:55.000000000 +0700
+++ update-fonts-alias 2009-08-27 22:19:02.000000000 +0700
@@ -129,30 +129,35 @@
continue
fi
- # Are there any files to process?
- if [ "$(echo "$ETCDIR"/*.alias "$ETC7DIR"/*.alias)" != "$ETCDIR/*.alias $ETC7DIR/*.alias" ]
- then
- if [ -n "$X11R7DIR" ] && [ -d "$X11R7DIR" ]; then
- # Write the new alias file in a temporary location in case we are
- # interrupted.
- cat >"$X11R7DIR/fonts.alias.update-new" <<EOF
+ if [ -n "$X11R7DIR" ] && [ -d "$X11R7DIR" ]; then
+ # Write the new alias file in a temporary location in case we are
+ # interrupted.
+ cat >"$X11R7DIR/fonts.alias.update-new" <<EOF
!! fonts.alias -- automatically generated file. DO NOT EDIT.
!! To modify, see update-fonts-alias(8).
EOF
- for FILE in "$ETCDIR"/*.alias "$ETC7DIR"/*.alias; do
- [ -e "$FILE" ] || continue
- echo "!! $FILE" >>"$X11R7DIR/fonts.alias.update-new"
- cat "$FILE" >>"$X11R7DIR/fonts.alias.update-new"
- done
- mv "$X11R7DIR/fonts.alias.update-new" "$X11R7DIR/fonts.alias"
- fi
- else
- if [ -n "$X11R7DIR" ] && [ -d "$X11R7DIR" ]; then
- # There are no files to process; remove any alias file already in
- # the font directory.
- rm -f "$X11R7DIR/fonts.alias"
- # Remove the font directory if it is empty.
- rmdir "$X11R7DIR" >/dev/null 2>&1 || true
+ has_data=0
+ for FILE in "$ETCDIR"/*.alias "$ETC7DIR"/*.alias; do
+ [ -e "$FILE" ] || continue
+
+ # Skip conffiles left over by removed packages
+ pkg=`basename $FILE | sed 's/.alias$//'`
+ inst_status=`dpkg-query -W -f='${Status}' $pkg | cut -d' ' -f1`
+ [ $inst_status == "deinstall" ] && continue
+
+ echo "!! $FILE" >>"$X11R7DIR/fonts.alias.update-new"
+ cat "$FILE" >>"$X11R7DIR/fonts.alias.update-new"
+ has_data=1
+ done
+ if [ $has_data -eq 1 ]; then
+ mv "$X11R7DIR/fonts.alias.update-new" "$X11R7DIR/fonts.alias"
+ else
+ rm -f "$X11R7DIR/fonts.alias.update-new"
+ # There are no files to process; remove any alias file already in
+ # the font directory.
+ rm -f "$X11R7DIR/fonts.alias"
+ # Remove the font directory if it is empty.
+ rmdir "$X11R7DIR" >/dev/null 2>&1 || true
fi
fi
done
Attachment:
signature.asc
Description: Digital signature