#!/bin/sh
#
# Copyright (c) 2004 by Sun Microsystems, Inc.
# All rights reserved.
#
# Configuration script for the APOC Daemon.
# 
# Please notice, that this script requires a successfully installed 
# APOC Daemon.


################################################################################
# 
# Find Java
#
################################################################################

findJava() {
    JAVA=`which java`
    if [ "$JAVA" = "" ]
    then 
        if [ "$JAVA_HOME" != "" ] && [ -f $JAVA_HOME/bin/java ]
        then
            JAVA=$JAVA_HOME/bin/java
        else
            JAVA=/usr/bin/java
        fi
    fi

    if [ ! -f $JAVA ]
    then
        echo "No suitable Java runtime found. Please set the JAVA_HOME environment variable to point to a Java installation."
        exit 1
    fi
}


################################################################################
# 
# Main
#
################################################################################

findJava
cd /usr/share/lib/apoc
$JAVA -classpath .:/usr/share/lib/apoc/spi.jar ConfigurationWizard $@
