pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/print/dvipdfmx/files Add a INSTALL/DEINSTALL template ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3e7be1e92139
branches:  trunk
changeset: 503452:3e7be1e92139
user:      minskim <minskim%pkgsrc.org@localhost>
date:      Sun Nov 20 18:46:22 2005 +0000

description:
Add a INSTALL/DEINSTALL template to handle font maps for dvipdfmx.

diffstat:

 print/dvipdfmx/files/map.tmpl |  48 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diffs (52 lines):

diff -r d4be46c86383 -r 3e7be1e92139 print/dvipdfmx/files/map.tmpl
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/print/dvipdfmx/files/map.tmpl     Sun Nov 20 18:46:22 2005 +0000
@@ -0,0 +1,48 @@
+# $NetBSD: map.tmpl,v 1.1 2005/11/20 18:46:22 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@ @DVIPDFMX_CONFIG_DIR@/sample.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



Home | Main Index | Thread Index | Old Index