pkgsrc/print/dvipdfmx/files/map.tmpl
minskim d4ec572c69 - Install a sample config file into share/examples, rather than into
the texmf tree.
- Correct paths to this package.

No PKGREVISION bump since this package didn't build due to the wrong
path to map.mk.
2005-11-20 19:14:50 +00:00

48 lines
1.1 KiB
Cheetah

# $NetBSD: map.tmpl,v 1.3 2005/11/20 19:14:50 minskim Exp $
#
# Update dvipdfmx.cfg.
#
###############################################################################
# replace_line(file, pattern, line)
# The first line in file that matches pattern gets replaced by line.
# line will be added at the end of the file if pattern does not match.
###############################################################################
replace_line()
{
file=$1; pat=$2; line=$3
if grep "$pat" "$file" >/dev/null; then
ed "$file" >/dev/null 2>&1 <<-eof
/$pat/
c
$line
.
w
q
eof
else
echo "$line" >> "$file"
fi
}
case ${STAGE} in
POST-INSTALL)
if ${TEST} ! -f @DVIPDFMX_CONFIG_DIR@/dvipdfmx.cfg; then
@CP@ @LOCALBASE@/share/examples/dvipdfmx/dvipdfmx.cfg \
@DVIPDFMX_CONFIG_DIR@/dvipdfmx.cfg
fi
for map in @DVIPDFMX_FONTMAPS@; do
replace_line "@DVIPDFMX_CONFIG_DIR@/dvipdfmx.cfg" \
"^%![ ]*$map" "f $map"
done
;;
DEINSTALL)
for map in @DVIPDFMX_FONTMAPS@; do
replace_line "@DVIPDFMX_CONFIG_DIR@/dvipdfmx.cfg" \
"^f[ ]*$map" "%! f $map"
done
;;
*)
;;
esac