--- xfs.init.old 2003-09-18 19:15:34.000000000 -0400 +++ xfs.init 2003-10-08 23:08:35.000000000 -0400 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # xfs: Starts the X Font Server # @@ -29,28 +29,32 @@ if [ -d "$d" ]; then cd $d # Check if we need to rerun mkfontdir - NEEDED=no + REGEN_FONTS_DIR=no if ! [ -e fonts.dir ]; then - NEEDED=yes - elif [ "$(find . -type f -cnewer fonts.dir 2>/dev/null)" != "" ];then - NEEDED=yes + REGEN_FONTS_DIR=yes + elif [ "$(find . -type f -cnewer fonts.dir -not -name "fonts.cache*" 2>/dev/null)" != "" ];then + REGEN_FONTS_DIR=yes fi - if [ "$NEEDED" = "yes" ]; then + if [ "$REGEN_FONTS_DIR" = "yes" ]; then rm -f fonts.dir &>/dev/null - if ls | grep -i "\.tt[cf]$" &>/dev/null; then - # TrueType fonts found... + if ls | grep -i "\.[ot]t[cf]$" &>/dev/null; then + # TrueType or Opentype fonts found... ttmkfdir -d . -o fonts.scale mkfontdir . &>/dev/null [ -e fonts.dir ] && chmod 644 fonts.scale fonts.dir fi - if [ "$(ls |egrep -iv '\.tt[cf]$|^fonts\.|^encodings\.')" != "" ]; then - # This directory contains fonts that are not TrueType... + if [ "$(ls |grep -iv '\(fonts\.\(scale\|alias\|cache.*\)$\|.+\(\.[ot]t[cf]\|dir\)$\)')" != "" ]; then + # This directory contains fonts that are not TrueType or Opentype... mkfontdir . &>/dev/null [ -e fonts.dir ] && chmod 644 fonts.dir fi fi fi done + # Recreating fonts.dir files above may result in stale fonts.cache-1 + # files since the directory mtimes change, so we run fc-cache to + # update any necessary fonts.cache files. + [ "$REGEN_FONTS_DIR" = "yes" -a -x /usr/bin/fc-cache ] && /usr/bin/fc-cache popd &> /dev/null }