#!/bin/sh

###################################################
# pull in environment variables common to
# postinstall/postremove/request/and.. scripts
###################################################

ADMINDIR=$TOPDIR/usr/bin/X11/700X/admin
. $ADMINDIR/env.vars
umask 022


#################################################
#
# UPDATE THE FONTS.DIRs
#
#################################################

if [ "$OS" = "sco" ]
then
  exit 0
fi

FONTUTILDIR=${TOPDIR}/usr/bin/X11/700X

MKFONTDIR=$TOPDIR/usr/bin/X11/700X/xtmkfontdir

if [ ! -f $MKFONTDIR ]
then
  if [ ${OPENWINHOME}x != "x" ]
  then
    MKFONTDIR=$OPENWINHOME/bin/mkfontdir
    if [ ! -f $MKFONTDIR ]
    then
      MKFONTDIR=/usr/bin/X11/mkfontdir
    fi
  else
    if [ -f /usr/bin/X11/mkfontdir ]
    then
      MKFONTDIR=/usr/bin/X11/mkfontdir
    else
      MKFONTDIR=/usr/openwin/bin/mkfontdir
    fi
  fi
fi


if [ -f $MKFONTDIR ]
then
  DIRS="hp_japanese/75dpi misc"
  for DIR in $DIRS
  do
    if [ -d $TOPDIR/usr/lib/X11/700X/fonts/$DIR ]
    then
      echo making font directory for $DIR
      $MKFONTDIR $TOPDIR/usr/lib/X11/700X/fonts/$DIR
    fi
  done
else
  echo could not find mkfontdir. Please run mkfontdir manually on directories:
  echo $DIRS in $TOPDIR/usr/lib/X11/700X/fonts
fi


exit 0
