Oops... proper schema syntax.
[java-idp.git] / bin / metadatatool
1 #!/bin/sh
2
3 ##We need a JVM
4 if [ ! -n "$JAVA_HOME" ] ; then
5   echo "Error: JAVA_HOME is not defined."
6   exit
7 fi
8
9 if [ ! -n "$JAVACMD" ] ; then
10   JAVACMD=$JAVA_HOME/bin/java
11 fi
12
13 if [ ! -x "$JAVACMD" ] ; then
14   echo "Error: JAVA_HOME is not defined correctly."
15   echo "Cannot execute $JAVACMD"
16   exit
17 fi
18
19
20 ##Find the shibboleth components
21 if [ ! -n "$SHIB_HOME" ] ; then
22   SHIB_HOME=.
23 fi
24 ENDORSED=$SHIB_HOME/endorsed
25
26 if [ ! \( -f "$SHIB_HOME/lib/shib-util.jar" -a -r "$SHIB_HOME/lib/shib-util.jar" \) ] ; then
27   echo "Error: Cannot find the shibboleth jar (shib-util.jar)."
28   echo "       If you downloaded the shibboleth source, you need to run \"ant build-util\""
29   exit
30 fi
31
32 ##Grab all the dependencies
33 if [ -n "$CLASSPATH" ] ; then
34   SHIB_UTIL_CLASSPATH=$CLASSPATH
35 fi
36
37 DIRLIBS=${SHIB_HOME}/lib/*.jar
38 for i in ${DIRLIBS}
39 do
40     # if the directory is empty, then it will return the input string
41     # this is stupid, so case for it
42     if [ "$i" != "${DIRLIBS}" ] ; then
43       if [ -z "$SHIB_UTIL_CLASSPATH" ] ; then
44         SHIB_UTIL_CLASSPATH=$i
45       else
46         SHIB_UTIL_CLASSPATH="$i":$SHIB_UTIL_CLASSPATH
47       fi
48     fi
49 done
50 SHIB_UTIL_CLASSPATH=$SHIB_UTIL_CLASSPATH:"$SHIB_HOME"
51
52 ##Here we go
53 $JAVACMD -Djava.endorsed.dirs="$ENDORSED" -cp $SHIB_UTIL_CLASSPATH  edu.internet2.middleware.shibboleth.utils.MetadataTool "$@"