#! /bin/sh
# Configuration script for ntb-mf (NTeX) V1.0
# Copyright 1994, Frank Langbein
# All rights reserved.
#
# Redistributions of this script must retain the above copyright notice, 
# this condition and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

curr_dir=$(pwd)
editor=vi

cat << EOF

Configuring ntb-mf

You have installed the package ntb-mf. In order to let MetaFont work correctly
you have to set the localfont mode to your printer. It is preconfigured for
CanonCX. This should work for every 300 dpi laser printer. 

If you want to change the localfont mode you have to edit the file
/usr/lib/texmf/mf/base/modes.mf. It's defined at the end of the file

EOF
echo -n "Do you want to edit modes.mf now (with $editor) [y/n]? "
read ANS
if test "$ANS" = "y" -o "$ANS" = "Y"; then
   cmd="$editor /usr/lib/texmf/mf/base/modes.mf"
   echo Running $cmd
   $cmd
   cat << EOF

If have changed the modes.mf file, you have to rebuild the MetaFont bases
mf and cmmf.

EOF
   echo -n "Should I do this now [y/n]? "
   read ANS
   if test "$ANS" = "y" -o "$ANS" = "Y"; then
      echo "Rebuilding mf base."
      cd $curr_dir
      echo "\input modes; \dump" | /usr/bin/inimf plain
      chmod 0644 $curr_dir/plain.base
      chmod 0644 $curr_dir/plain.log
      mv -f $curr_dir/plain.base /usr/lib/texmf/ini/mf.base
      mv -f $curr_dir/plain.log /usr/lib/texmf/ini/mf.log
      cd $curr_dir
      echo "Rebuilding cmmf base."
      echo "\input modes; \dump" | /usr/bin/inimf plain "\input cmbase"
      chmod 0644 $curr_dir/plain.base
      chmod 0644 $curr_dir/plain.log
      mv -f $curr_dir/plain.base /usr/lib/texmf/ini/cmmf.base
      mv -f $curr_dir/plain.log /usr/lib/texmf/ini/cmmf.log
      rm -f /usr/lib/texmf/ini/cmplain.base /usr/lib/texmf/ini/cmplain.log >/dev/null
      ln -s /usr/lib/texmf/ini/cmmf.base /usr/lib/texmf/ini/cmplain.base
      ln -s /usr/lib/texmf/ini/cmmf.log /usr/lib/texmf/ini/cmplain.log
      echo done.
   fi
fi

more << EOF


Note that there are no pk font files included in this distribution. There
are just the font metric files (.tfm files) in the font packages and the
MetaFont sources. If you want you can create a basic setup for the fonts 
with a shell script in the directory /usr/lib/texmf/fonts/create. It is 
called createallfonts. Since this may take quite some time you should run 
this script over night or as background process. To build the pk fonts type

cd /usr/lib/texmf/fonts/create
createallfonts

or if you want to run it as background process type

cd /usr/lib/texmf/fonts/create
createallfonts &>/dev/null &

After you have created the fonts you should call the script 

/usr/lib/texmf/tools/create_ls-R

in order to update the  a ls-R databse for kpathsea.

Before you create the fonts you should change the localfont mode in the
file /usr/lib/texmf/mf/base/modes.mf and recreate the metafont bases. If 
you have installed MetaFont this script already asked you to do this and 
the bases are recreated. The printer configuration in modes.mf has to be
done! However you do not need to create all the pk font files. TeX and the
printer drivers do this automatically with the shell script MakeTeXPK.

If you just want to create just some pk fonts, you can call one of the 
create.sh scripts in the subdirectories of /usr/lib/texmf/fonts.

Press [Enter] to continue
EOF
read X
