#! /bin/sh
# Configuration script for ntb-xdvi (NTeX) V1.0.1
# 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-xdvi

EOF

cat << EOF

You have installed the package ntb-xdvi. The dvi driver xdvi displays
dvi files under X. You can configure the driver with a X app-defaults
file in /usr/lib/texmf/X/XDvi.

EOF
echo -n "Do you want to edit XDvi now (with $editor) [y/n]? "
read ANS
if test "$ANS" = "y" -o "$ANS" = "Y"; then
   cmd="$editor /usr/lib/texmf/X/XDvi"
   echo Running $cmd
   $cmd
fi

cat << EOF

You must crete a symbolic link for the XDvi file to your app-defaults
directory for X11. You can do this now or later with the command

ln -sf /usr/lib/texmf/X/XDvi <app-defaults-dir>/XDvi

If you do this now you need to know the path for your app-defaults
directory, for instance "/usr/openwin/lib/app-defaults" or
"/usr/X11/lib/X11/app-defaults". (Please also type the double quotes!)

EOF
echo -n "Do you want to create the symbolic link now [y/n]? "
read ANS
if test "$ANS" = "y" -o "$ANS" = "Y"; then
   echo -n "Your apps-default directory: "
   read APPDEFAULTS
   if test -d $APPDEFAULTS; then
      rm -f $APPDEFAULTS/XDvi
      ln -s /usr/lib/texmf/X/XDvi $APPDEFAULTS/XDvi
   else
      cat << EOF

I could not find this directory. Please check this and create the
symbolic link later with

ln -sf /usr/lib/texmf/X/XDvi <app-defaults-dir>/XDvi

EOF
      echo -n "Press [enter] to continue. "
      read ANS
   fi
fi
