QSUpgrade.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #!/bin/sh
  2. #
  3. # Licensed Materials - Property of IBM
  4. #
  5. # BI and PM: qs
  6. #
  7. # (C) Copyright IBM Corp. 2001, 2017
  8. #
  9. # US Government Users Restricted Rights - Use, duplication or disclosure
  10. # restricted by GSA ADP Schedule Contract with IBM Corp.
  11. #
  12. # Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  13. # Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  14. ###################################################################
  15. # $Header: $
  16. # $DateTime: $
  17. # $Change: $
  18. # $Author: parentd $
  19. #
  20. # Purpose
  21. # Set environment variables needed for Java and run a Java program.
  22. #
  23. # Arguments:
  24. # Parameters to the java command.
  25. #
  26. ###################################################################
  27. ###################################################################
  28. # Define the CLASSPATH separator character.
  29. # Would you believe that it is semicolon on Windows and colon on other platforms?
  30. sep=":"
  31. # Define exe extention for Windows executables
  32. exeExt=""
  33. # Define the path to the bundled JRE.
  34. ReportNetJRE=""
  35. platform="`uname -s`"
  36. case $platform in
  37. Windows*)
  38. sep=";"
  39. exeExt=".exe"
  40. ReportNetJRE=../bin/jre/1.5.0
  41. # Replace the back slashes with forward slashes in the first parameter.
  42. # Otherwise the substring operations used to extract the filename (see v5queries variable) do not work properly.
  43. cleanv4path=`tr '\\' '/' << THEPATH
  44. ${1}
  45. THEPATH
  46. `
  47. ;;
  48. esac
  49. # Option to be used with JAVA_CMD when executing programs.
  50. # Can not be part of JAVA_CMD since JAVA_HOME can have spaces
  51. # and JAVA_CMD must be one "word" if it is to be quoted.
  52. #
  53. # Use of the variable must not be in quotes otherwise an empty
  54. # string will be passed to java as a parameter.
  55. #
  56. # Value is either an empty string or "-classic"
  57. JAVA_CLASSIC=""
  58. if [ -z "$JAVA_HOME" ]
  59. then
  60. echo "Setting JAVA_HOME to $ReportNetJRE"
  61. JAVA_HOME="$ReportNetJRE"
  62. else
  63. echo "Using predefined JAVA_HOME $JAVA_HOME"
  64. fi
  65. if [ -z "$JAVA_HOME" ]
  66. then
  67. echo "JAVA_HOME is not defined. Please specify a valid JAVA_HOME environment variable."
  68. exit 44
  69. fi
  70. echo "JAVA_HOME=$JAVA_HOME"
  71. JAVA_CMD="${JAVA_HOME}/bin/java$exeExt"
  72. if [ -f "$JAVA_CMD" ]
  73. then
  74. echo "Using "$JAVA_CMD
  75. else
  76. echo "Cannot find $JAVA_CMD"
  77. exit 55
  78. fi
  79. UPGRADE_LIB_DIR="../webapps/p2pd/WEB-INF/lib"
  80. 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"
  81. echo "CLASSPATH=${CLASSPATH}"
  82. # The following case statement was copied from crconfig.sh
  83. # It would be better to have a single script that we all use to invoke Java.
  84. # I will propose this to the Java working group.
  85. case $platform in
  86. Linux)
  87. if [ -z "$LD_LIBRARY_PATH" ]
  88. then
  89. LD_LIBRARY_PATH=.
  90. else
  91. LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
  92. fi
  93. export LD_LIBRARY_PATH
  94. # Determine the Threading Model
  95. # getconf will return either linuxthreads-<version> or NPTL <version> depending on the threading model.
  96. getconf GNU_LIBPTHREAD_VERSION 2>&1 | grep NPTL > /dev/null 2>&1
  97. if [ $? -eq 0 ] ; then
  98. hasNPTL=true
  99. else
  100. hasNPTL=false
  101. fi
  102. if [ ${hasNPTL} = true ] ; then
  103. #
  104. # Linux Distribution supporting NPTL (Native POSIX Threads Library)
  105. # IBM JRE versions 1.4.1 and earlier do not support NPTL; required to use LinuxThreads
  106. # by setting LD_ASSUME_KERNEL=2.4.19
  107. #
  108. IBM_JRE_VERSION=`${JAVA_CMD} -version 2>&1 | sed -n 's/.*\([0-9]\.[0-9]*\.[0-9]*\)[ ]*IBM.*/\1/p'`
  109. useLinuxThreads=false
  110. case ${IBM_JRE_VERSION:=0} in
  111. 1.4.*)
  112. IBM_JRE_REVISION=`echo ${IBM_JRE_VERSION} | sed -n 's/1\.[0-9]*\.\([0-9]*\)/\1/p'`
  113. if [ ${IBM_JRE_REVISION} -lt 2 ] ; then
  114. useLinuxThreads=true
  115. fi
  116. ;;
  117. 1.3.*)
  118. useLinuxThreads=true
  119. ;;
  120. esac
  121. # if [ ${useLinuxThreads} = true ] ; then
  122. # # LD_ASSUME_KERNEL=2.4.19
  123. # #export LD_ASSUME_KERNEL
  124. # fi
  125. fi
  126. ;;
  127. SunOS)
  128. if [ -z "$LD_LIBRARY_PATH" ]
  129. then
  130. LD_LIBRARY_PATH=.
  131. else
  132. LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
  133. fi
  134. export LD_LIBRARY_PATH
  135. ;;
  136. AIX)
  137. if [ -z "$LIBPATH" ]
  138. then
  139. LIBPATH=.
  140. else
  141. LIBPATH=".:$LIBPATH"
  142. fi
  143. export LIBPATH
  144. ;;
  145. HP-UX)
  146. if [ -z "$SHLIB_PATH" ]
  147. then
  148. SHLIB_PATH=.
  149. else
  150. SHLIB_PATH=".:$SHLIB_PATH"
  151. fi
  152. export SHLIB_PATH
  153. if [ "$LC_CTYPE" = "ja_JP.utf8" ]
  154. then
  155. JAVA_CMD="$JAVA_HOME/bin/java"
  156. export JAVA_CMD
  157. JAVA_CLASSIC="-classic"
  158. else if [ "$LANG" = "ja_JP.utf8" ]
  159. then
  160. JAVA_CMD="$JAVA_HOME/bin/java"
  161. export JAVA_CMD
  162. JAVA_CLASSIC="-classic"
  163. fi
  164. fi
  165. ;;
  166. Windows*)
  167. ;;
  168. *)
  169. echo ""
  170. echo "Unexpected platform: $platform"
  171. echo ""
  172. ;;
  173. esac
  174. echo "$JAVA_CMD" ${JAVA_CLASSIC} -cp "$CLASSPATH" com.cognos.cm.plugin.qs.QSUpgradeMiniQuery $*
  175. "$JAVA_CMD" ${JAVA_CLASSIC} -cp "$CLASSPATH" com.cognos.cm.plugin.qs.QSUpgradeMiniQuery $*
  176. exit $?