#!/bin/sh

#--> required preparations:
#--> tar xzvf PhoneBook.tgz
#--> ln -sf <location of wshh> wshh

# the link to "wshh" has to exist already
if ! test -L wshh ; then
 echo You have to set a link named \"wshh\" to the location of the
 echo file \"wshh\" in the database directory of the phonebook CD !
 exit
fi


make
retval=`echo "$?"`
if test ! "$retval" = "0"; then
 echo Error making the executable files, install-script aborted.
 exit
fi

make clean
retval=`echo "$?"`
if test ! "$retval" = "0"; then
 echo Error cleaning off the object files.
 echo Please remove the .o files by hand, later.
fi

mkdir del

mv PhoneBook-10.* del
mv *.cpp *.h makefile del
retval=`echo "$?"`
if test ! "$retval" = "0"; then
 echo Error moving the no longer needed source files into a separate directory.
 echo Please move them into \"del\", later, or remove the altogether.
fi


CreateIndices wshh
retval=`echo "$?"`
if test ! "$retval" = "0"; then
 echo Error creating phone number index file, install script aborted.
 exit
fi

rm -f CreateIndices


echo
echo Installation + configuration successfully completed.
echo
echo You may start the program now by typing
echo "                     Phone2Address <Enter>"
echo

mv Install del
