#!/bin/sh
#
# Do what dh_sphinxdoc should be doing, and shut lintian
# up by replacing sphinx .js files with those in libjs-sphinx.
#
set -e

find "debian/${1}" -name "*.js" |
  while read pkg_js_file
  do
    dpkg --listfiles libjs-sphinxdoc |
      while read sphinx_js
      do
        [ ."${pkg_js_file##*/}" = ."${sphinx_js##*/}" ] || continue
	ln --symbolic --force "${sphinx_js}" "${pkg_js_file}"
      done
  done
