#!/bin/sh
# Copyright (C) 2000-2001 Open Source Telecom Corporation.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
#
# a wrapper for starting of a bayonne server based on seeking the config
# directory.

driver="$BAYONNE_DRIVER"

if test -f /etc/sysconfig/bayonne ; then
	. /etc/sysconfig/bayonne
fi

if test ! -z "$driver" ; then
	export BAYONNE_DRIVER=$driver
fi

if test -f /etc/bayonne.conf ; then
	CONFIG_KEYDATA=/etc/
elif test -d /etc/bayonne ; then
	CONFIG_KEYDATA=/etc/bayonne/
elif test -d /usr/etc/bayonne ; then
	CONFIG_KEYDATA=/usr/etc/bayonne/
elif test -d /usr/local/etc/bayonne ; then
	CONFIG_KEYDATA=/usr/local/etc/bayonne/
fi

if test ! -z "$BAYONNE_CONFIG" ; then
	CONFIG_KEYDATA=$BAYONNE_CONFIG
fi

if test ! -z "$CONFIG_KEYDATA" ; then
	export CONFIG_KEYDATA
fi

if test -f /usr/lib/libLiS.so ; then
	export LD_PRELOAD=/usr/lib/libLiS.so
fi

path=`dirname $0`
exec $path/bayonne --start $$ $*


