#!/bin/sh
#
#    Script to load Bulldozer on your unix machine.
#
#    OK, so I should learn perl. 
#

#
# Set these two for your installation.
#

BINDEST=/usr/local/bin
LIBDEST=/usr/local/lib

#
# Set LIBDIR if you want to install the library stuff (docs and app_defaults)
# in a directory named something other than dozer-(version info).
#
LIBDIR=
#

#
#
# You need not do anything further.
#
#

HTX_VERSION=0
HTX_REVISION=7
HTX_UPDATE=2
HTX_VERSION_TYPE=b

version=$HTX_VERSION
if test ! -z "$HTX_REVISION"; then version="$version.$HTX_REVISION"; fi
if test ! -z "$HTX_UPDATE"; then version="$version.$HTX_UPDATE"; fi
if test ! -z "$HTX_VERSION_TYPE"; then version="$version$HTX_VERSION_TYPE"; fi

if test -z "$LIBDIR"; then
    LIBDIR=dozer-$version
fi

cat << EOF
                    Installation for Bulldozer $version

      This installation procedure will install the Bulldozer executable and
the Bulldozer library information. The library information consists of
HTML pages used by the help system along with their associated image icons;
application default files and config file XKeysymDB. 

I will install the executable in $BINDEST
I will install the libraries in $LIBDEST/$LIBDIR

OK (Y/N, N=abort)
EOF
read reply

if test $reply = N || test $reply = n; then
    exit
fi

if test ! -d $LIBDEST/$LIBDIR; then
    mkdir -p $LIBDEST/$LIBDIR
else
    echo "BULLDOZERLIB program information was found in $LIBDEST/$LIBDIR."
    echo "May I delelete the entire contents of that directory (Y/N, Q=quit)"
    read reply
    if test $reply = Y || test $reply = y; then
        rm -r -f $LIBDEST/$LIBDIR/* 
    elif test $reply = Q || test $reply = q; then
        exit 
    fi
fi

if test ! -d $BINDEST; then
    mkdir -p $BINDEST
fi

echo "Installing dozer in $BINDEST..."

cp bin/dozer $BINDEST/dozer
chmod 755 $BINDEST/dozer

echo "Installing documentation in $LIBDEST/$LIBDIR..."
   
cp -r lib/BULLDOZERLIB/* $LIBDEST/$LIBDIR/.
chmod 644 $LIBDEST/$LIBDIR/Docs/*.html
chmod 644 $LIBDEST/$LIBDIR/Docs/Images/*
chmod 644 $LIBDEST/$LIBDIR/Docs/HTML3.0/*.html

echo "Installation complete..." 
echo "Please notify users that they must perform the following to use the software help..."
echo "    setenv BULLDOZERLIB $LIBDEST/$LIBDIR"

