You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fop.sh 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #! /bin/sh
  2. #
  3. # Shell script to run FOP, adapted from the Jakarta-Ant project.
  4. if [ -f $HOME/.foprc ] ; then
  5. . $HOME/.foprc
  6. fi
  7. # OS specific support. $var _must_ be set to either true or false.
  8. cygwin=false;
  9. darwin=false;
  10. case "`uname`" in
  11. CYGWIN*) cygwin=true ;;
  12. Darwin*) darwin=true ;;
  13. esac
  14. if [ -z "$FOP_HOME" ] ; then
  15. # try to find FOP
  16. if [ -d /opt/fop ] ; then
  17. FOP_HOME=/opt/fop
  18. fi
  19. if [ -d ${HOME}/opt/fop ] ; then
  20. FOP_HOME=${HOME}/opt/fop
  21. fi
  22. ## resolve links - $0 may be a link to fop's home
  23. PRG=$0
  24. progname=`basename $0`
  25. while [ -h "$PRG" ] ; do
  26. ls=`ls -ld "$PRG"`
  27. link=`expr "$ls" : '.*-> \(.*\)$'`
  28. if expr "$link" : '.*/.*' > /dev/null; then
  29. PRG="$link"
  30. else
  31. PRG="`dirname $PRG`/$link"
  32. fi
  33. done
  34. FOP_HOME=`dirname "$PRG"`
  35. fi
  36. # For Cygwin, ensure paths are in UNIX format before anything is touched
  37. if $cygwin ; then
  38. [ -n "$FOP_HOME" ] &&
  39. FOP_HOME=`cygpath --unix "$FOP_HOME"`
  40. [ -n "$JAVA_HOME" ] &&
  41. JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  42. [ -n "$CLASSPATH" ] &&
  43. CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
  44. fi
  45. if [ -z "$JAVACMD" ] ; then
  46. if [ -n "$JAVA_HOME" ] ; then
  47. if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
  48. # IBM's JDK on AIX uses strange locations for the executables
  49. JAVACMD=$JAVA_HOME/jre/sh/java
  50. else
  51. JAVACMD=$JAVA_HOME/bin/java
  52. fi
  53. else
  54. JAVACMD=java
  55. fi
  56. fi
  57. if [ ! -x "$JAVACMD" ] ; then
  58. echo "Error: JAVA_HOME is not defined correctly."
  59. echo " We cannot execute $JAVACMD"
  60. exit
  61. fi
  62. if [ -n "$CLASSPATH" ] ; then
  63. LOCALCLASSPATH=$CLASSPATH
  64. fi
  65. # add fop.jar, which resides in $FOP_HOME/build
  66. LOCALCLASSPATH=${FOP_HOME}/build/fop.jar:$LOCALCLASSPATH
  67. # add in the dependency .jar files, which reside in $FOP_HOME/lib
  68. DIRLIBS=${FOP_HOME}/lib/*.jar
  69. for i in ${DIRLIBS}
  70. do
  71. # if the directory is empty, then it will return the input string
  72. # this is stupid, so case for it
  73. if [ "$i" != "${DIRLIBS}" ] ; then
  74. if [ -z "$LOCALCLASSPATH" ] ; then
  75. LOCALCLASSPATH=$i
  76. else
  77. LOCALCLASSPATH="$i":$LOCALCLASSPATH
  78. fi
  79. fi
  80. done
  81. # For Cygwin, switch paths to Windows format before running java
  82. if $cygwin; then
  83. FOP_HOME=`cygpath --path --windows "$FOP_HOME"`
  84. JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  85. LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
  86. fi
  87. $JAVACMD -classpath "$LOCALCLASSPATH" $FOP_OPTS org.apache.fop.apps.Fop "$@"