#include variables
#!/bin/bash -e
# 
# setup-conflinks, internal packaging script for tetex-base and -extra.
# $Id: setup-conflinks.in 939 2006-02-24 17:31:49Z frank $
<:=@COPYRIGHT:>//

###################################
#        Variables
###################################

# tetex-extra
#EXTD=$extra_prefix/usr/share/texmf/dvips
#EXETC=$extra_prefix${DVIPS}
basedir=debian/tetex-base
pkgdir=$basedir/usr/share/tetex-base
ldatdir=$basedir/usr/share/texmf-tetex/tex/generic/config
LANGUAGE_DIR="$basedir/<:=$LANGUAGE_DIR:>"
LANGUAGE_MEMORY_DIR=<:=$LANGUAGE_MEMORY_DIR:>



###################################
# Here starts the main program
###################################

if [ x"$1" = "x-base" ] ; then
  package=tetex-base
  texmfdir=debian/$package/usr/share/texmf-tetex

# add the magic header to the language config file
  printf "%% 10tetex.cnf
%%
%% You really can change stuff in this file, but it is NOT RECOMMENDED
%% to play around with this file if you do not know what you are doing!
%% Please leave this comment!
%% -_- DebPkgProvidedMaps -_-
%%
" >> $LANGUAGE_DIR/10tetex.cnf

# install latex's language dat in language.d
  sed -n -e '0,\@^% The hyphenation pattern files are in the dir@ d; 0,/^$/ d; p' \
    $ldatdir/language.dat >> $LANGUAGE_DIR/10tetex.cnf
  rm $ldatdir/language.dat
  cp debian/tetex-base.language.list debian/$package/$LANGUAGE_MEMORY_DIR/tetex-base.list

# remove upstream's updmap.cfg
  rm $texmfdir/web2c/updmap.cfg

   rm -f $texmfdir/ls-R
# create our ls-R symlink
  ln -s /var/lib/texmf/ls-R-TEXMFDIST-TETEX $texmfdir/ls-R

  # texdoctk stuff
  mv $texmfdir/texdoctk debian/$package/etc
  ln -s /etc/texdoctk $texmfdir
  # texdocrc is handled by ucf
  mv debian/$package/etc/texdoctk/texdocrc.defaults $pkgdir/texdocrc
  cp debian/md5sums/texdocrc.md5sum $pkgdir/

elif [ x"$1" = "x-extra" ] ; then
  package=tetex-extra
  texmfdir=debian/$package/usr/share/texmf-tetex

  :
else
  echo "Bad usage!"
  exit 1
fi

# Local Variables:
# mode: shell-script
# skeleton-pair: t
# End:
