#!/bin/sh

# set by the installation script
bindir=`dirname $0`
case $bindir in
    /*) confddir=`dirname $bindir`;;
    *)  confddir=`(cd $bindir/..; pwd)`;;
esac
libdir=$confddir/lib

confdversion=6.3.0.2


command="$@"

ROOTDIR=${libdir}/confd
BINDIR=${ROOTDIR}/erts/bin
PROGNAME=confd
EMU=confd
export ROOTDIR BINDIR PROGNAME EMU

if [ -f ${BINDIR}/confd ]; then
    smp="-smp disable"
else
    smp="-smp enable"
fi

# async I/O is just unnecessary overhead as long
# as a single Erlang process does all the work
async="+A0 "
confdc_cmd="${BINDIR}/confdexec ${smp} +B ${async} -boot confdc -noinput -confddir ${confddir}"


argc=$#

exec ${confdc_cmd} -s confdc run "$@"
