#!/bin/sh
#
## link--to-freeWAIS
##
## gopher will be compiled with WAIS support if the following
## links exist:
##    bin -> ../freeWAIS-0.3/bin
##    ir -> ../freeWAIS-0.3/ir
##    ui -> ../freeWAIS-0.3/ui
##
## this script tests if all three of the freeWAIS source
## directories exist.  If so, the links are created.
## Otherwise, no links are created.
##
## This program is called from the debian.rules makefile.
#
## written by Ted Hajek <tedhajek@boombox.micro.umn.edu>
## as part of the Debian GNU/Linux source distribution.

##
## some important variables
GOPHER_SOURCE_DIR="/usr/local/src/gopher2_1_1"
WAIS_SOURCE_DIR="../freeWAIS-0.3"

# make sure we're in the right place
cd $GOPHER_SOURCE_DIR

## remove existing links
if [ -L bin ] ; then
  rm -f bin
fi

if [ -L ir ] ; then
  rm -f ir
fi

if [ -L ui ] ; then
  rm -f ui
fi

## if the freeWAIS source directories exist, symbolically
## link them into the current directory.
if [ -d "$WAIS_SOURCE_DIR/bin" -a \
     -d "$WAIS_SOURCE_DIR/ir"  -a \
     -d "$WAIS_SOURCE_DIR/ui" ] ; then
  ln -s "$WAIS_SOURCE_DIR/bin" .
  ln -s "$WAIS_SOURCE_DIR/ir" .
  ln -s "$WAIS_SOURCE_DIR/ui" .
fi

exit 0
