chiark / gitweb /
fix up some lintian things
[xfonts-traditional] / debian / xfonts-traditional.prerm
index 5cb9a991199e0151ab052fda5818a9e87ed99e91..35f8edadcb22d4731f3bfee54e65dab0401322e0 100755 (executable)
@@ -3,42 +3,53 @@ set -e
 
 . /usr/share/debconf/confmodule
 
+#DEBHELPER#
+
+aliasfile=/etc/X11/fonts/misc/xfonts-base.alias
+
 case "$1" in
 
 remove)
 
-       echo 'Checking that "fixed" is not from xfonts-traditional..."
+       echo 'Checking that "fixed" is not from xfonts-traditional...'
+
+       if grep '^fixed[         ][      ]*-trad-' $aliasfile \
+           /usr/share/fonts/X11/misc/fonts.alias; then
+               cat >&2 <<'END'
 
-       if grep '^fixed[         ][      ]*-trad-'; then
-               cat >&2 <<END
 Removing xfonts-traditional would break your X server by removing "fixed".
 
 You should not remove xfonts-traditional while "fixed" refers to one
 of its fonts.  You probably want to check the differences between
 /etc/X11/fonts/misc/xfonts-base.alias and xfonts-base.alias.not-trad,
-and probably replace the former with the latter, and retry the removal.
+reconcile any changes, and then run "update-fonts-alias misc".
+After that you can retry the removal.
 
 END
                printf 'Continue anyway ? [n/y] '
-               read x
+               read x </dev/tty
                case "$x" in
                y*|Y*)  ;;
                *)      exit 1 ;;
                esac
        fi
 
-       find /usr/share/fonts/X11 /usr/local/share/fonts/X11 \
-                  -type f \
-               \( -name xfonts-traditional.log -o \
-                  -name xfonts-traditional.done -o 
-                  -name xfonts-traditional.done.new -o 
-                  -name trad--\*.pcf.gz.new \) \
-               -print0 | xargs -0r rm
-
-       find /usr/share/fonts/X11 /usr/local/share/fonts/X11 \
-                  -type f \
-                  -name trad--\*.pcf.gz \
-               -print0 | xargs -0r rm
+       for d in /usr/share/fonts/X11 /usr/local/share/fonts/X11; do
+               if ! test -e "$d"; then continue; fi
+
+               find "$d" \
+                          -type f \
+                       \( -name xfonts-traditional.log -o \
+                          -name xfonts-traditional.done -o \
+                          -name xfonts-traditional.done.new -o  \
+                          -name trad--\*.pcf.gz.new \) \
+                       -print0 | xargs -0r rm --
+
+               find "$d" \
+                          -type f \
+                          -name trad--\*.pcf.gz \
+                       -print0 | xargs -0r rm --
+       done
 
        ;;