#!/bin/sh # $Id: perfexplorer_configure.skel,v 1.24 2010/06/08 21:51:57 wspear Exp $ # $Name: $ rm -f .last_config echo $* > .last_config echo $* >> .all_configs # Record all the arguments arguments=$* # Default compilers and options tauroot=/mnt/netapp/home1/amorris/public_html/regression/testtau/tau2 architecture=sunx86_64 taushell=sh targetdir=/mnt/netapp/home1/amorris/public_html/regression/testtau/tau2 serverhostname=localhost objectport=9999 registryport=1099 #configfile=$HOME/.ParaProf/perfdmf.cfg configdir=$HOME/.ParaProf tmpdir=/tmp LIBDIR=${tauroot}/${architecture}/lib PERFEXPLORER_JAR=${LIBDIR}/perfexplorer.jar redirectfile=weka-redirect-3-6-1.html redirect=http://www.cs.uoregon.edu/research/paracomp/tau/${redirectfile} # check for right java version test=`java -cp $LIBDIR/tau-common.jar edu.uoregon.tau.common.VersionTester 1.5` if [ $test = "failed" ] ; then echo "" echo "Java 1.5 or newer is required to run PerfExplorer." echo "Please update your Java SDK to a newer version to use PerfExplorer." echo "You will still be able to use PerfExplorer 1.0, from the TAU v2.17 release." # HIBERNATE_JARS= JBOSS_RULES_JARS= PERFEXPLORER_JAR=${LIBDIR}/perfexplorer-1.4.jar echo "" fi # PARSE COMMAND LINE SWITCHES ############################################################### for arg in "$@"; do case $arg in -objectport=*) myarg=`echo $arg | sed 's/-objectport=//'` objectport=$myarg shift ;; -registryport=*) myarg=`echo $arg | sed 's/-registryport=//'` registryport=$myarg shift ;; -server=*) myarg=`echo $arg | sed 's/-server=//'` serverhostname=$myarg shift ;; -configfile=*) myarg=`echo $arg | sed 's/-configfile=//'` configfile=$myarg shift ;; -tmpdir=*) myarg=`echo $arg | sed 's/-tmpdir=//'` tmpdir=$myarg shift ;; -help) echo "PerfExplorer Configuration Utility " echo "***********************************************************************" echo "Usage: configure [OPTIONS]" echo " where [OPTIONS] are:" #echo "-server= ...... specify hostname for the perfexplorer server." #echo "-registryport= ............. specify port for the rmi registry." #echo "-objectport= ................ specify port for the rmi objects." echo "-configfile= ............... specify PerfDMF config file." echo "-tmpdir= ....................... specify temporary file directory." exit ;; '') #echo "NULL switch!" # Required for HP/Compaq Tru64 machines. ;; *) echo "ERROR: Command line switch \`$arg' not recognized" 1>&2 exit 1 ;; esac done # -- set up portable echo command case "`echo 'x\c'`" in 'x\c') echo="echo -n" nnl= ;; #BSD x) echo="echo" nnl="\c";; #SysV *) echo 'Cannot setup echo. What weird machine do you have?' 1>2& exit 1;; esac # check to see if PerfDMF has been executed $echo "What is the name of your PerfDMF Configuration: ${nnl}" read RESPONSE if [ ! "$RESPONSE" ]; then configfile=${configdir}/perfdmf.cfg else configfile=${configdir}/perfdmf.cfg."${RESPONSE}" fi if [ ! -r ${configfile} ]; then echo "" echo "PerfDMF Configfile named ${RESPONSE} not found." echo "Please run perfdmf_configure, if you haven't already done so." echo "" exit fi RESPONSE= JDBC_JAR=`grep jdbc_db_jarfile ${configfile} | sed s/jdbc_db_jarfile://` JDBC_TYPE=`grep jdbc_db_type ${configfile} | sed s/jdbc_db_type://` if [ ! "${JDBC_TYPE}" = "db2" ]; then if [ ! -r ${JDBC_JAR} ] then echo "" echo "$JDBC_JAR not found." echo "Please run perfdmf_configure, if you haven't already done so." echo "" exit fi fi echo echo "Configuring scripts to use the following values:" echo "------------------------------------------------" echo "tauroot = $tauroot" echo "architecture = $architecture" echo "taushell = $taushell" echo "targetdir = $targetdir" echo "server = $serverhostname" echo "configfile = $configfile" echo "tmpdir = $tmpdir" echo echo "TAU: installing tools in $targetdir" # cat ${targetdir}/etc/perfexplorer.skel | # sed -e 's,@TAUROOT@,'$targetdir',' \ # -e 's,@TAUSHELL@,'$taushell',' \ # -e 's,@TAUARCH@,'$architecture',' \ # -e 's,@SERVER_HOSTNAME@,'$serverhostname',' \ # -e 's,@SERVER_OBJECT_PORT@,'$objectport',' \ # -e 's,@SERVER_RMIREGISTRY_PORT@,'$registryport',' \ # -e 's,@CONFIGFILE@,'$configfile',' \ # > ${targetdir}/${architecture}/bin/perfexplorer # chmod a+rx ${targetdir}/${architecture}/bin/perfexplorer # cat ${targetdir}/etc/java.policy | # sed -e 's,@TMPDIR@,'$tmpdir',' \ # -e 's,@CONFIGDIR@,'$configdir',' \ # -e 's,@CONFIGDIR2@,'$configdir',' \ # -e 's,@TAULIBDIR@,'$LIBDIR',' \ # -e 's,@TAULIBDIR2@,'$LIBDIR',' \ # > ${targetdir}/${architecture}/lib/java.policy JAR_HOME=$HOME/.ParaProf WEKA_JAR=$JAR_HOME/weka-3-6-1.jar WEKA_ZIP_DIR=$JAR_HOME if [ ! -r ${WEKA_JAR} ]; then echo "" echo "$WEKA_JAR not found." echo "" while [ "x$RESPONSE" = "x" ]; do $echo "Would you like to attempt to automatically download the Weka jar file? (y/n) ${nnl}" read RESPONSE case $RESPONSE in [yY]|[Yy][Ee][Ss]) RESPONSE=y ;; [nN]|[Nn][Oo]) RESPONSE=n ;; esac done if [ "${RESPONSE}" = "y" ]; then #WGET=`which wget 2>/dev/null` #if [ ! -r "$WGET" ]; then #echo "" #echo "Couldn't find wget, you'll have to manually download the Weka jar file." #echo "Please go here: " #exit 1 #fi /bin/rm -f ${redirectfile} #wget http://www.cs.uoregon.edu/research/paracomp/tau/${redirectfile} java -cp ${LIBDIR}/tau-common.jar edu.uoregon.tau.common.Wget $redirect ${redirectfile} false URL=`grep URL ${redirectfile} | sed s/URL=//` FILE=`grep FILE ${redirectfile} | sed s/FILE=//` DIR=`grep DIR ${redirectfile} | sed s/DIR=//` /bin/rm -f ${redirectfile} echo "Getting $FILE... please be patient..." #wget "$URL" java -cp ${LIBDIR}/tau-common.jar edu.uoregon.tau.common.Wget "$URL" "$FILE" true mv "$FILE" ${WEKA_ZIP_DIR}/. cd ${WEKA_ZIP_DIR}/. java -cp ${LIBDIR}/tau-common.jar edu.uoregon.tau.common.Zip ${FILE} /bin/rm -f ${redirectfile} /bin/rm -f $FILE cp $DIR/weka.jar ./weka-3-6-1.jar /bin/rm -rf $DIR if [ ! -r ${WEKA_JAR} ]; then echo "" echo "Still couldn't find $WEKA_JAR, please acquire your Weka jar file manually" echo "" exit fi else echo "" echo "Please acquire your Weka jar file manually from:" echo " http://www.cs.waikato.ac.nz/ml/weka/" echo "or use the following redirection link (recommended):" echo "---> $redirect" echo "Download and unzip the specified URL in the redirect file, and place the weka.jar file in $configdir" echo "and rename it to weka-3-6-1.jar" echo "" fi fi RESPONSE= JBOSS_JAR=$JAR_HOME/drools-core-3.0.6.jar JBOSS_TAR_DIR=$JAR_HOME if [ ! -r ${JBOSS_JAR} ]; then echo "" echo "$JBOSS_JAR not found." echo "" while [ "x$RESPONSE" = "x" ]; do $echo "Would you like to attempt to automatically download the required jar files? (y/n) ${nnl}" read RESPONSE case $RESPONSE in [yY]|[Yy][Ee][Ss]) RESPONSE=y ;; [nN]|[Nn][Oo]) RESPONSE=n ;; esac done FILE=PE2_jars.tgz URL=http://www.cs.uoregon.edu/research/paracomp/tau/$FILE if [ "${RESPONSE}" = "y" ]; then /bin/rm -f $FILE echo "Getting $FILE... please be patient..." #wget "$URL" java -cp ${LIBDIR}/tau-common.jar edu.uoregon.tau.common.Wget "$URL" "$FILE" true mv "$FILE" ${JBOSS_TAR_DIR}/. cd ${JBOSS_TAR_DIR}/. java -cp ${LIBDIR}/tau-common.jar edu.uoregon.tau.common.tar.Tar -xvzf ${FILE} /bin/rm -f $FILE mv jbossrules/*.jar . mv jbossrules/lib/*.jar . rm -rf jbossrules if [ ! -r ${JBOSS_JAR} ]; then echo "" echo "Still couldn't find $JBOSS_JAR, please acquire JBoss Rules manually." echo "" exit fi else echo "" echo "Please manually download the required jar files using the following link:" echo "---> $URL" echo "and expand the compressed tar file in $configdir" echo "" echo "Please re-run perfexplorer_configure when these files have been installed." echo "" exit fi fi # now to test the DB and upload schema (if necessary) java -Dderby.system.home=${configdir} -cp ${PERFEXPLORER_JAR}:${LIBDIR}/perfdmf.jar:${LIBDIR}/jargs.jar:${JDBC_JAR}:${LIBDIR}/tau-common.jar edu.uoregon.tau.perfexplorer.common.Configure -t ${tauroot}/etc -a ${architecture} -g ${configfile} # bye bye echo echo "Configuration complete!" echo " If you haven't already done so, " echo " Please add " $tauroot/$architecture/bin " to your path" exit 0