ANSUpgrade.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #!/bin/sh
  2. # Licensed Materials - Property of IBM
  3. # IBM Cognos Products: ans
  4. # (C) Copyright IBM Corp. 2005, 2022
  5. # US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  6. ###################################################################
  7. # Purpose
  8. # Set environment variables needed for Java and run a Java program.
  9. #
  10. # Arguments:
  11. # Parameters to the java command.
  12. #
  13. # Define the CLASSPATH separator character.
  14. # Would you believe that it is semicolon on Windows and colon on other platforms?
  15. sep=":"
  16. # Define exe extention for Windows executables
  17. exeExt=""
  18. # Define the path to the bundled JRE.
  19. ReportNetJRE=""
  20. platform="`uname -s`"
  21. case $platform in
  22. Windows*)
  23. sep=";"
  24. exeExt=".exe"
  25. ReportNetJRE=../ibm-jre/jre
  26. # Replace the back slashes with forward slashes in the first parameter.
  27. # Otherwise the substring operations used to extract the filename (see v5queries variable) do not work properly.
  28. cleanv4path=`tr '\\' '/' << THEPATH
  29. ${1}
  30. THEPATH
  31. `
  32. ;;
  33. esac
  34. # Option to be used with JAVA_CMD when executing programs.
  35. # Can not be part of JAVA_CMD since JAVA_HOME can have spaces
  36. # and JAVA_CMD must be one "word" if it is to be quoted.
  37. #
  38. # Use of the variable must not be in quotes otherwise an empty
  39. # string will be passed to java as a parameter.
  40. #
  41. # Value is either an empty string or "-classic"
  42. JAVA_CLASSIC=""
  43. if [ -z "$JAVA_HOME" ]
  44. then
  45. echo "Setting JAVA_HOME to $ReportNetJRE"
  46. JAVA_HOME="$ReportNetJRE"
  47. else
  48. echo "Using predefined JAVA_HOME $JAVA_HOME"
  49. fi
  50. if [ -z "$JAVA_HOME" ]
  51. then
  52. echo "JAVA_HOME is not defined. Please specify a valid JAVA_HOME environment variable."
  53. exit 44
  54. fi
  55. echo "JAVA_HOME=$JAVA_HOME"
  56. JAVA_CMD="${JAVA_HOME}/bin/java$exeExt"
  57. if [ -f "$JAVA_CMD" ]
  58. then
  59. echo "Using "$JAVA_CMD
  60. else
  61. echo "Cannot find $JAVA_CMD"
  62. exit 55
  63. fi
  64. UPGRADE_LIB_DIR="../webapps/p2pd/WEB-INF/lib"
  65. CLASSPATH="./jdxslt.jar${sep}${JAVA_HOME}/lib/rt.jar${sep}./qfwV4toV5J.jar${sep}./cclcfgapi.jar${sep}./CognosIPF.jar${sep}./cclcoreutil.jar${sep}./log4j-api-2.17.1.jar${sep}./log4j-core-2.17.1.jar${sep}./dom4j-2.1.1.jar${sep}${UPGRADE_LIB_DIR}/CognosCMPlugin.jar${sep}${UPGRADE_LIB_DIR}/CognosCM.jar"
  66. echo "CLASSPATH=${CLASSPATH}"
  67. # The following case statement was copied from crconfig.sh
  68. # It would be better to have a single script that we all use to invoke Java.
  69. # I will propose this to the Java working group.
  70. case $platform in
  71. Linux)
  72. if [ -z "$LD_LIBRARY_PATH" ]
  73. then
  74. LD_LIBRARY_PATH=.
  75. else
  76. LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
  77. fi
  78. export LD_LIBRARY_PATH
  79. ;;
  80. SunOS)
  81. if [ -z "$LD_LIBRARY_PATH" ]
  82. then
  83. LD_LIBRARY_PATH=.
  84. else
  85. LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
  86. fi
  87. export LD_LIBRARY_PATH
  88. ;;
  89. AIX)
  90. if [ -z "$LIBPATH" ]
  91. then
  92. LIBPATH=.
  93. else
  94. LIBPATH=".:$LIBPATH"
  95. fi
  96. export LIBPATH
  97. ;;
  98. HP-UX)
  99. if [ -z "$SHLIB_PATH" ]
  100. then
  101. SHLIB_PATH=.
  102. else
  103. SHLIB_PATH=".:$SHLIB_PATH"
  104. fi
  105. export SHLIB_PATH
  106. if [ "$LC_CTYPE" = "ja_JP.utf8" ]
  107. then
  108. JAVA_CMD="$JAVA_HOME/bin/java"
  109. export JAVA_CMD
  110. JAVA_CLASSIC="-classic"
  111. else if [ "$LANG" = "ja_JP.utf8" ]
  112. then
  113. JAVA_CMD="$JAVA_HOME/bin/java"
  114. export JAVA_CMD
  115. JAVA_CLASSIC="-classic"
  116. fi
  117. fi
  118. ;;
  119. Windows*)
  120. ;;
  121. *)
  122. echo ""
  123. echo "Unexpected platform: $platform"
  124. echo ""
  125. ;;
  126. esac
  127. echo "$JAVA_CMD" ${JAVA_CLASSIC} -cp "$CLASSPATH" com.cognos.cm.plugin.ans.ANSUpgrade $*
  128. "$JAVA_CMD" ${JAVA_CLASSIC} -cp "$CLASSPATH" com.cognos.cm.plugin.ans.ANSUpgrade $*
  129. exit $?