vault.sh 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/sh
  2. DIRNAME=`dirname "$0"`
  3. PROGNAME=`basename "$0"`
  4. GREP="grep"
  5. # Use the maximum available, or set MAX_FD != -1 to use that
  6. MAX_FD="maximum"
  7. #
  8. # Helper to complain.
  9. #
  10. warn() {
  11. echo "${PROGNAME}: $*"
  12. }
  13. #
  14. # Helper to puke.
  15. #
  16. die() {
  17. warn $*
  18. exit 1
  19. }
  20. # OS specific support (must be 'true' or 'false').
  21. cygwin=false;
  22. darwin=false;
  23. linux=false;
  24. case "`uname`" in
  25. CYGWIN*)
  26. cygwin=true
  27. ;;
  28. Darwin*)
  29. darwin=true
  30. ;;
  31. Linux)
  32. linux=true
  33. ;;
  34. esac
  35. # For Cygwin, ensure paths are in UNIX format before anything is touched
  36. if $cygwin ; then
  37. [ -n "$JBOSS_HOME" ] &&
  38. JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
  39. [ -n "$JAVA_HOME" ] &&
  40. JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  41. [ -n "$JAVAC_JAR" ] &&
  42. JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
  43. fi
  44. # Setup JBOSS_HOME
  45. # Setup JBOSS_HOME
  46. RESOLVED_JBOSS_HOME=`cd "$DIRNAME/.."; pwd`
  47. if [ "x$JBOSS_HOME" = "x" ]; then
  48. # get the full path (without any relative bits)
  49. JBOSS_HOME=$RESOLVED_JBOSS_HOME
  50. else
  51. SANITIZED_JBOSS_HOME=`cd "$JBOSS_HOME/.."; pwd`
  52. if [ "$RESOLVED_JBOSS" != "$SANITIZED_JBOSS_HOME" ]; then
  53. echo "WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur."
  54. echo ""
  55. fi
  56. fi
  57. export JBOSS_HOME
  58. # Setup the JVM
  59. if [ "x$JAVA" = "x" ]; then
  60. if [ "x$JAVA_HOME" != "x" ]; then
  61. JAVA="$JAVA_HOME/bin/java"
  62. else
  63. JAVA="java"
  64. fi
  65. fi
  66. if [ "x$JBOSS_MODULEPATH" = "x" ]; then
  67. JBOSS_MODULEPATH="$JBOSS_HOME/modules"
  68. fi
  69. ###
  70. # Setup the JBoss Vault Tool classpath
  71. ###
  72. # For Cygwin, switch paths to Windows format before running java
  73. if $cygwin; then
  74. JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
  75. JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  76. JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`
  77. JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`
  78. JBOSS_MODULEPATH=`cygpath --path --windows "$JBOSS_MODULEPATH"`
  79. fi
  80. # Display our environment
  81. echo "========================================================================="
  82. echo ""
  83. echo " JBoss Vault"
  84. echo ""
  85. echo " JBOSS_HOME: $JBOSS_HOME"
  86. echo ""
  87. echo " JAVA: $JAVA"
  88. echo ""
  89. echo "========================================================================="
  90. echo ""
  91. eval \"$JAVA\" $JAVA_OPTS \
  92. -jar \"$JBOSS_HOME/jboss-modules.jar\" \
  93. -mp \"${JBOSS_MODULEPATH}\" \
  94. org.jboss.as.vault-tool \
  95. '"$@"'