An attempt at making the ArpUtil shell script more robust.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 6 Nov 2002 22:42:47 +0000 (22:42 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 6 Nov 2002 22:42:47 +0000 (22:42 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@347 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

bin/ArpUtil
conf/log4j.properties [new file with mode: 0755]

index cdbf410..66c9e85 100755 (executable)
@@ -1,20 +1,63 @@
 #!/bin/sh
 
-#The Shibboleth webapp root
-if [ -n SHIB_ROOT ]
-       then
-               SHIB_ROOT=/usr/local/tomcat/webapps/shibboleth
+##We need a JVM
+if [ ! -n "$JAVA_HOME" ] ; then
+  echo "Error: JAVA_HOME is not defined."
+  exit
+fi
+
+if [ ! -n "$JAVACMD" ] ; then
+  JAVACMD=$JAVA_HOME/bin/java
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+  echo "Error: JAVA_HOME is not defined correctly."
+  echo "Cannot execute $JAVACMD"
+  exit
 fi
 
-#Where log4j config file is
-LOG_CONFIG=$SHIB_ROOT/WEB-INF/conf/log4j.properties
 
-#Where ARPs directory is
-ARP_DIR=$SHIB_ROOT/arps
+##Find the shibboleth components
+if [ ! -n "$SHIB_HOME" ] ; then
+  echo "Error: SHIB_HOME is not defined."
+  exit
+fi
+
+if [ ! \( -f "$SHIB_HOME/lib/shib-util.jar" -a -r "$SHIB_HOME/lib/shib-util.jar" \) ] ; then
+  echo "Error: Cannot find shibboleth utility jar."
+  echo "       If you downloaded the shibboleth source, you need to run \"ant build-util\""
+  exit
+fi
 
-if [ -n JAVA_HOME ]
-       then
-               $JAVA_HOME/bin/java -Dlog.config=$LOG_CONFIG -Darp.dir=$ARP_DIR -cp $SHIB_ROOT/WEB-INF/classes:$SHIB_ROOT/WEB-INF/lib/log4j-1.2.5.jar edu.internet2.middleware.shibboleth.aa.arpUtil.ArpUtil "$@"
-       else
-               echo "JAVA_HOME not set."
+if [ ! -n "$ARP_DIR" ] ; then
+  echo "Warning: Using working directory for ARP storage.  Define ARP_DIR to use another directory."
+  ARP_DIR=.
 fi
+
+if [ ! -n "$LOG_CONFIG" ] ; then
+  LOG_CONFIG=$SHIB_HOME/conf/log4j.properties
+fi
+
+
+##Grab all the dependencies
+if [ -n "$CLASSPATH" ] ; then
+  SHIB_UTIL_CLASSPATH=$CLASSPATH
+fi
+
+DIRLIBS=${SHIB_HOME}/lib/*.jar
+for i in ${DIRLIBS}
+do
+    # if the directory is empty, then it will return the input string
+    # this is stupid, so case for it
+    if [ "$i" != "${DIRLIBS}" ] ; then
+      if [ -z "$SHIB_UTIL_CLASSPATH" ] ; then
+        SHIB_UTIL_CLASSPATH=$i
+      else
+        SHIB_UTIL_CLASSPATH="$i":$SHIB_UTIL_CLASSPATH
+      fi
+    fi
+done
+
+
+##Here we go
+$JAVACMD -Dlog.config=$LOG_CONFIG -Darp.dir=$ARP_DIR -classpath $SHIB_UTIL_CLASSPATH edu.internet2.middleware.shibboleth.utils.ArpUtil "$@"
diff --git a/conf/log4j.properties b/conf/log4j.properties
new file mode 100755 (executable)
index 0000000..4d39e82
--- /dev/null
@@ -0,0 +1,22 @@
+# Default Log4J configuration.  Sends logging output to STDOUT.
+
+log4j.rootCategory=WARN, stdout
+log4j.logger.org.apache.xml.security=OFF
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%-5p %-36X{serviceId} %d{ISO8601} (%c:%L) - %m%n
+
+
+# Uncomment the following line to enable verbose debugging output concerning log4j initialization.
+#log4j.debug=TRUE
+
+
+# The following block represents an example of how to direct logging output to a file.
+#log4j.rootCategory=DEBUG, file
+#log4j.logger.org.apache.xml.security=OFF
+#log4j.appender.file=org.apache.log4j.RollingFileAppender
+#log4j.appender.file.File=/var/log/shib.log
+#log4j.appender.file.MaxFileSize=100KB
+#log4j.appender.file.MaxBackupIndex=1
+#log4j.appender.file.layout=org.apache.log4j.PatternLayout
+#log4j.appender.file.layout.ConversionPattern=%5p [%t] (%c:%L) - %m%n
\ No newline at end of file