123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- #!/bin/sh
- #
- # Licensed Materials - Property of IBM
- #
- # BI and PM: qs
- #
- # (C) Copyright IBM Corp. 2001, 2017
- #
- # US Government Users Restricted Rights - Use, duplication or disclosure
- # restricted by GSA ADP Schedule Contract with IBM Corp.
- #
- # Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- # Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- ###################################################################
- # $Header: $
- # $DateTime: $
- # $Change: $
- # $Author: parentd $
- #
- # Purpose
- # Set environment variables needed for Java and run a Java program.
- #
- # Arguments:
- # Parameters to the java command.
- #
- ###################################################################
- ###################################################################
- # Define the CLASSPATH separator character.
- # Would you believe that it is semicolon on Windows and colon on other platforms?
- sep=":"
- # Define exe extention for Windows executables
- exeExt=""
- # Define the path to the bundled JRE.
- ReportNetJRE=""
- platform="`uname -s`"
- case $platform in
- Windows*)
- sep=";"
- exeExt=".exe"
- ReportNetJRE=../bin/jre/1.5.0
- # Replace the back slashes with forward slashes in the first parameter.
- # Otherwise the substring operations used to extract the filename (see v5queries variable) do not work properly.
- cleanv4path=`tr '\\' '/' << THEPATH
- ${1}
- THEPATH
- `
- ;;
- esac
- # Option to be used with JAVA_CMD when executing programs.
- # Can not be part of JAVA_CMD since JAVA_HOME can have spaces
- # and JAVA_CMD must be one "word" if it is to be quoted.
- #
- # Use of the variable must not be in quotes otherwise an empty
- # string will be passed to java as a parameter.
- #
- # Value is either an empty string or "-classic"
- JAVA_CLASSIC=""
- if [ -z "$JAVA_HOME" ]
- then
- echo "Setting JAVA_HOME to $ReportNetJRE"
- JAVA_HOME="$ReportNetJRE"
- else
- echo "Using predefined JAVA_HOME $JAVA_HOME"
- fi
- if [ -z "$JAVA_HOME" ]
- then
- echo "JAVA_HOME is not defined. Please specify a valid JAVA_HOME environment variable."
- exit 44
- fi
- echo "JAVA_HOME=$JAVA_HOME"
- JAVA_CMD="${JAVA_HOME}/bin/java$exeExt"
- if [ -f "$JAVA_CMD" ]
- then
- echo "Using "$JAVA_CMD
- else
- echo "Cannot find $JAVA_CMD"
- exit 55
- fi
- UPGRADE_LIB_DIR="../webapps/p2pd/WEB-INF/lib"
- CLASSPATH="./jdxslt.jar${sep}./xalan.jar${sep}./xml-apis.jar${sep}./xercesImpl.jar${sep}${JAVA_HOME}/lib/rt.jar${sep}./qfwV4toV5J.jar${sep}./cclcfgapi.jar${sep}./CognosIPF.jar${sep}./cclcoreutil.jar$(sep)log4j-1.2.8.jar${sep}${UPGRADE_LIB_DIR}/CognosCMPlugin.jar${sep}${UPGRADE_LIB_DIR}/CognosCM.jar"
- echo "CLASSPATH=${CLASSPATH}"
- # The following case statement was copied from crconfig.sh
- # It would be better to have a single script that we all use to invoke Java.
- # I will propose this to the Java working group.
- case $platform in
- Linux)
- if [ -z "$LD_LIBRARY_PATH" ]
- then
- LD_LIBRARY_PATH=.
- else
- LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
- fi
- export LD_LIBRARY_PATH
- # Determine the Threading Model
- # getconf will return either linuxthreads-<version> or NPTL <version> depending on the threading model.
- getconf GNU_LIBPTHREAD_VERSION 2>&1 | grep NPTL > /dev/null 2>&1
- if [ $? -eq 0 ] ; then
- hasNPTL=true
- else
- hasNPTL=false
- fi
- if [ ${hasNPTL} = true ] ; then
- #
- # Linux Distribution supporting NPTL (Native POSIX Threads Library)
- # IBM JRE versions 1.4.1 and earlier do not support NPTL; required to use LinuxThreads
- # by setting LD_ASSUME_KERNEL=2.4.19
- #
- IBM_JRE_VERSION=`${JAVA_CMD} -version 2>&1 | sed -n 's/.*\([0-9]\.[0-9]*\.[0-9]*\)[ ]*IBM.*/\1/p'`
- useLinuxThreads=false
- case ${IBM_JRE_VERSION:=0} in
- 1.4.*)
- IBM_JRE_REVISION=`echo ${IBM_JRE_VERSION} | sed -n 's/1\.[0-9]*\.\([0-9]*\)/\1/p'`
- if [ ${IBM_JRE_REVISION} -lt 2 ] ; then
- useLinuxThreads=true
- fi
- ;;
- 1.3.*)
- useLinuxThreads=true
- ;;
- esac
- # if [ ${useLinuxThreads} = true ] ; then
- # # LD_ASSUME_KERNEL=2.4.19
- # #export LD_ASSUME_KERNEL
- # fi
- fi
- ;;
- SunOS)
- if [ -z "$LD_LIBRARY_PATH" ]
- then
- LD_LIBRARY_PATH=.
- else
- LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
- fi
- export LD_LIBRARY_PATH
- ;;
- AIX)
- if [ -z "$LIBPATH" ]
- then
- LIBPATH=.
- else
- LIBPATH=".:$LIBPATH"
- fi
- export LIBPATH
- ;;
- HP-UX)
- if [ -z "$SHLIB_PATH" ]
- then
- SHLIB_PATH=.
- else
- SHLIB_PATH=".:$SHLIB_PATH"
- fi
- export SHLIB_PATH
- if [ "$LC_CTYPE" = "ja_JP.utf8" ]
- then
- JAVA_CMD="$JAVA_HOME/bin/java"
- export JAVA_CMD
- JAVA_CLASSIC="-classic"
- else if [ "$LANG" = "ja_JP.utf8" ]
- then
- JAVA_CMD="$JAVA_HOME/bin/java"
- export JAVA_CMD
- JAVA_CLASSIC="-classic"
- fi
- fi
- ;;
- Windows*)
- ;;
- *)
- echo ""
- echo "Unexpected platform: $platform"
- echo ""
- ;;
- esac
- echo "$JAVA_CMD" ${JAVA_CLASSIC} -cp "$CLASSPATH" com.cognos.cm.plugin.qs.QSUpgradeMiniQuery $*
- "$JAVA_CMD" ${JAVA_CLASSIC} -cp "$CLASSPATH" com.cognos.cm.plugin.qs.QSUpgradeMiniQuery $*
- exit $?
|