#!/bin/sh
#
# tetex-bin	rebuild ls-R daily

# Respect the Filesystem Hierarchy Standards, and avoid writing files
# in /usr.  Because Debian has avoided this problem for
# /usr/share/texmf/ by creating a link to /var/lib/texmf/ls-R, we only
# need to worry about writing to /usr/local/{share,lib}/texmf/ls-R.

FHS=1 # Set this variable to zero to allow mktexlsr to regenerate ls-R
      # files in the /usr/local/ hierarchy.

if [ -x "/usr/bin/mktexlsr" ]; then
  if [ $FHS = 1 ]; then
    LSRDBS=`kpsewhich --show-path=ls-R | sed -e 's/:/ /g'`
    for dbfile in ${LSRDBS}; do
      case "$dbfile" in
        /usr/local*) continue ;;
        *) /usr/bin/mktexlsr $dbfile > /dev/null ;;
      esac
    done
  else
    /usr/bin/mktexlsr > /dev/null
  fi
fi 

exit 0


