summary refs log tree commit diff
path: root/pkgs/tools/text/sgml/opensp/setup-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/text/sgml/opensp/setup-hook.sh')
-rw-r--r--pkgs/tools/text/sgml/opensp/setup-hook.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/tools/text/sgml/opensp/setup-hook.sh b/pkgs/tools/text/sgml/opensp/setup-hook.sh
new file mode 100644
index 000000000000..2c9142da1016
--- /dev/null
+++ b/pkgs/tools/text/sgml/opensp/setup-hook.sh
@@ -0,0 +1,22 @@
+addSGMLCatalogs () {
+      if test -d $1/sgml/dtd; then
+          for i in $(find $1/sgml/dtd -name docbook.cat); do
+              export SGML_CATALOG_FILES="${SGML_CATALOG_FILES:+:}$i"
+          done
+      fi
+}
+
+if test -z "$sgmlHookDone"; then
+    sgmlHookDone=1
+
+    # Set http_proxy and ftp_proxy to a invalid host to prevent
+    # xmllint and xsltproc from trying to download DTDs from the
+    # network even when --nonet is not given.  That would be impure.
+    # (Note that .invalid is a reserved domain guaranteed not to
+    # work.)
+    export http_proxy=http://nodtd.invalid/
+    export ftp_proxy=http://nodtd.invalid/
+
+    export SGML_CATALOG_FILES
+    envHooks=(${envHooks[@]} addSGMLCatalogs)
+fi