#!/bin/sh
# $FreeBSD: ports/print/teTeX-base/files/updmap.wrapper.in,v 1.1 2006/06/29 18:46:38 hrs Exp $
EXECBASE=${0##*/}
EXECPREFIX=/usr/local/share/texmf/updmap/updmap
EXECSUFFIX=dist
OPTS=""

case ${EXECBASE} in
*-sys)	v=`/usr/local/bin/kpsewhich -var-value TEXMFSYSVAR`
	c=`/usr/local/bin/kpsewhich -var-value TEXMFSYSCONFIG`
	TEXMFVAR="$v"; export TEXMFVAR
	TEXMFCONFIG="$c"; export TEXMFCONFIG
	;;
esac

for F in "$@"; do
	case $F in
	--help)		exec ${EXECPREFIX}.${EXECSUFFIX} --help ;;
	--progname=*)	EXECSUFFIX=${F#--progname=} ;;
	--*)		OPTS="${OPTS} ${F}" ;;
	*)		OPTS="${OPTS} \"${F}\"" ;;
	esac
done

WEB2C='$TEXMF/web2c'; export WEB2C
UPDMAP_DIST=${EXECPREFIX}.dist; export UPDMAP_DIST

case ${EXECSUFFIX} in
all)
	for E in ${EXECPREFIX}.*
	do
		if [ -f "${E}" ]; then eval "${E} ${OPTS}"; fi
	done
	;;
*)
	E=${EXECPREFIX}.${EXECSUFFIX}
	if [ -f "${E}" ]; then eval "exec ${E} ${OPTS}"; fi
	;;
esac
