#!/bin/sh

# mkfontdesc
# 02.01.1995 Roland Meier
# 03.01.1995 modified by Thomas Esser
# 04.07.1995 major changes for teTeX-0.3

test -f /bin/sh5 && test -z "$RUNNING_SH5" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
  && { RUNNING_SH5=true; export RUNNING_SH5; exec /bin/sh5 $0 ${1+"$@"}; }
unset RUNNING_SH5

test -f /bin/bsh && test -z "$RUNNING_BSH" \
  && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
  && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
unset RUNNING_BSH

progname=`basename $0`

TEXMF=`kpsetool -v '$TEXMFMAIN'`
pk=$TEXMF/fonts/pk
FONTDESC=$TEXMF/fonts/fontdesc

if [ ! -d $pk ]; then
	echo "Ooops! font-directory $pk does not exist." >&2
	echo "Need to change value for \$TEXMFMAIN?" >&2
	exit
fi

if [ -f $FONTDESC ]; then
	rm -f $FONTDESC.bak
	mv $FONTDESC $FONTDESC.bak
fi

echo "$progname: generating file $FONTDESC ... " >&2

(
    echo "# automatically generated by mkfontdesc"
    echo "# "
    echo "font	pk	*	3	./%f.%mpk"
    find $pk -type d -print | sed 's@^@font	pk	*	3	@;s@$@/%f.%mpk@'
) >$FONTDESC

echo "Done." >&2
