add-user.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/bin/sh
  2. # Add User Utility
  3. #
  4. # A simple utility for adding new users to the properties file used
  5. # for domain management authentication out of the box.
  6. #
  7. DIRNAME=`dirname "$0"`
  8. # OS specific support (must be 'true' or 'false').
  9. cygwin=false;
  10. if [ `uname|grep -i CYGWIN` ]; then
  11. cygwin = true;
  12. fi
  13. # For Cygwin, ensure paths are in UNIX format before anything is touched
  14. if $cygwin ; then
  15. [ -n "$JBOSS_HOME" ] &&
  16. JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
  17. [ -n "$JAVA_HOME" ] &&
  18. JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
  19. [ -n "$JAVAC_JAR" ] &&
  20. JAVAC_JAR=`cygpath --unix "$JAVAC_JAR"`
  21. fi
  22. # Setup JBOSS_HOME
  23. RESOLVED_JBOSS_HOME=`cd "$DIRNAME/.."; pwd`
  24. if [ "x$JBOSS_HOME" = "x" ]; then
  25. # get the full path (without any relative bits)
  26. JBOSS_HOME=$RESOLVED_JBOSS_HOME
  27. else
  28. SANITIZED_JBOSS_HOME=`cd "$JBOSS_HOME"; pwd`
  29. if [ "$RESOLVED_JBOSS_HOME" != "$SANITIZED_JBOSS_HOME" ]; then
  30. echo "WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur."
  31. echo ""
  32. fi
  33. fi
  34. export JBOSS_HOME
  35. # Setup the JVM
  36. if [ "x$JAVA" = "x" ]; then
  37. if [ "x$JAVA_HOME" != "x" ]; then
  38. JAVA="$JAVA_HOME/bin/java"
  39. else
  40. JAVA="java"
  41. fi
  42. fi
  43. if [ "x$JBOSS_MODULEPATH" = "x" ]; then
  44. JBOSS_MODULEPATH="$JBOSS_HOME/modules"
  45. fi
  46. # For Cygwin, switch paths to Windows format before running java
  47. if $cygwin; then
  48. JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
  49. JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
  50. JBOSS_CLASSPATH=`cygpath --path --windows "$JBOSS_CLASSPATH"`
  51. JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`
  52. JBOSS_MODULEPATH=`cygpath --path --windows "$JBOSS_MODULEPATH"`
  53. fi
  54. # Sample JPDA settings for remote socket debugging
  55. #JAVA_OPTS="$JAVA_OPTS -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y"
  56. # Uncomment to override standalone and domain user location
  57. #JAVA_OPTS="$JAVA_OPTS -Djboss.server.config.user.dir=../standalone/configuration -Djboss.domain.config.user.dir=../domain/configuration"
  58. eval \"$JAVA\" $JAVA_OPTS \
  59. -jar \"$JBOSS_HOME/jboss-modules.jar\" \
  60. -mp \"${JBOSS_MODULEPATH}\" \
  61. org.jboss.as.domain-add-user \
  62. '"$@"'