[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#197153: update-fonts-* should skip packages that are removed but not purged



Package: xutils
Severity: normal

When a font package is removed but not purged its configuration files
stay in /etc/X11/fonts and cause false fonts.alias and fonts.scale
items.  A patches for update-fonts-scale and update-fonts-alias are
attached.

Anton Zinoviev


--- update-fonts-scale.old	2003-06-08 15:29:51.000000000 +0300
+++ update-fonts-scale.new	2003-06-08 16:18:23.000000000 +0300
@@ -52,12 +52,19 @@
     fi
   done
   if [ -n "$VALID" ]; then
+    > $XDIR/fonts.scale.update-tmp
     # are there any files to process?
     if [ "$(echo $ETCDIR/*.scale)" != "$ETCDIR/*.scale" ]; then
       for file in $ETCDIR/*.scale; do
-        # omit count at top of file
-        tail +2 $file >> $XDIR/fonts.scale.update-tmp
+        package=`basename $file .scale`
+        if [ -e /usr/share/doc/$package ]; then
+          # omit count at top of file
+          tail +2 $file >> $XDIR/fonts.scale.update-tmp
+        fi
       done
+    fi
+    # Was there a processed file?
+    if [ -s $XDIR/fonts.scale.update-tmp ]; then
       # write new scale file in case we are interrupted
       # write new count to top of file
       # cat and pipe to wc so wc doesn't spew the filename
@@ -66,7 +73,8 @@
       mv $XDIR/fonts.scale.update-new $XDIR/fonts.scale
       rm $XDIR/fonts.scale.update-tmp
     else
-      # no files to process, remove the one in the font dir
+      # no files processed
+      rm -f $XDIR/fonts.scale.update-tmp
       rm -f $XDIR/fonts.scale
       # remove the font dir if it is empty
       rmdir $XDIR > /dev/null 2>&1 || true
--- update-fonts-alias.old	2003-06-08 15:30:12.000000000 +0300
+++ update-fonts-alias.new	2003-06-08 16:18:07.000000000 +0300
@@ -52,20 +52,30 @@
     fi
   done
   if [ -n "$VALID" ]; then
+    > $XDIR/fonts.alias.update-tmp 
     # are there any files to process?
     if [ "$(echo $ETCDIR/*.alias)" != "$ETCDIR/*.alias" ]; then
+      for file in $ETCDIR/*.alias; do
+        package=`basename $file .alias`
+        if [ -e /usr/share/doc/$package ]; then
+          echo "!! $file" >> $XDIR/fonts.alias.update-tmp
+          cat $file >> $XDIR/fonts.alias.update-tmp
+        fi
+      done
+    fi
+    # Was there a processed file?
+    if [ -s $XDIR/fonts.alias.update-tmp ]; then
       # write new alias file in case we are interrupted
       cat > $XDIR/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; do
-        echo "!! $file" >> $XDIR/fonts.alias.update-new
-        cat $file >> $XDIR/fonts.alias.update-new
-      done
+      cat $XDIR/fonts.alias.update-tmp >> $XDIR/fonts.alias.update-new
       mv $XDIR/fonts.alias.update-new $XDIR/fonts.alias
+      rm $XDIR/fonts.alias.update-tmp
     else
-      # no files to process, remove the one in the font dir
+      # no files processed
+      rm -f $XDIR/fonts.alias.update-tmp
       rm -f $XDIR/fonts.alias
       # remove the font dir if it is empty
       rmdir $XDIR > /dev/null 2>&1 || true

Reply to: