#!/bin/sh
# $poplocal/local/ved_latex/latex.install
#   Aaron Sloman  13 Dec 1997
# Added ved_gv.p 15 Oct 2000

# If this program is run in the directory $poplocal/local/ved_latex
# it will install the programs in $poplocal/local/auto and the help
# file in $poplocal/local/help
# after saving old versions in a subdirectory called "saved"

echo "making backup directory saved"
mkdir saved saved/auto saved/help saved/teach
echo "moving old versions to backup directory"
mv -f $poplocal/local/help/ved_latex saved/help
mv -f $poplocal/local/help/ved_bib saved/help
mv -f $poplocal/local/help/latex saved/help
mv -f $poplocal/local/auto/latex_*.p saved/auto
mv -f $poplocal/local/auto/ved_bib.p saved/auto
mv -f $poplocal/local/auto/ved_dobib.p saved/auto
mv -f $poplocal/local/auto/ved_dvi2tty.p saved/auto
mv -f $poplocal/local/auto/ved_gv.p saved/auto
mv -f $poplocal/local/auto/ved_jlp.p saved/auto
mv -f $poplocal/local/auto/ved_latex.p saved/auto
mv -f $poplocal/local/auto/ved_latex2.p saved/auto
mv -f $poplocal/local/auto/ved_latex2e.p saved/auto
mv -f $poplocal/local/auto/ved_latex209.p saved/auto
mv -f $poplocal/local/auto/ved_xdvi.p saved/auto
mv -f $poplocal/local/teach/latex.tex saved/teach
mv -f $poplocal/local/teach/latex saved/teach

echo "files saved"
ls -l saved/*

echo "making new links"

# New version
# Based on suggestions by Anthony Worrall

local=$poplocal/local

if  [ ! -d $local ]
then mkdir $local
fi

echo $local exists

if [ ! -d $local/auto ]
then mkdir $local/auto
fi

cd $local/auto
ln -s ../ved_latex/auto/* .

if [ ! -d $local/help ]
then mkdir $local/help
fi

cd $local/help
ln -s ../ved_latex/help/* .

if [ ! -d $local/teach ]
then mkdir $local/teach
fi

cd $local/teach
ln -s ../ved_latex/teach/* .

echo "done"
