add-user.bat 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. @echo off
  2. rem -------------------------------------------------------------------------
  3. rem Add User script for Windows
  4. rem -------------------------------------------------------------------------
  5. rem
  6. rem A simple utility for adding new users to the properties file used
  7. rem for domain management authentication out of the box.
  8. rem $Id$
  9. @if not "%ECHO%" == "" echo %ECHO%
  10. @if "%OS%" == "Windows_NT" setlocal
  11. if "%OS%" == "Windows_NT" (
  12. set "DIRNAME=%~dp0%"
  13. ) else (
  14. set DIRNAME=.\
  15. )
  16. pushd %DIRNAME%..
  17. set "RESOLVED_JBOSS_HOME=%CD%"
  18. popd
  19. if "x%JBOSS_HOME%" == "x" (
  20. set "JBOSS_HOME=%RESOLVED_JBOSS_HOME%"
  21. )
  22. pushd "%JBOSS_HOME%"
  23. set "SANITIZED_JBOSS_HOME=%CD%"
  24. popd
  25. if "%RESOLVED_JBOSS_HOME%" NEQ "%SANITIZED_JBOSS_HOME%" (
  26. echo WARNING JBOSS_HOME may be pointing to a different installation - unpredictable results may occur.
  27. )
  28. set DIRNAME=
  29. if "%OS%" == "Windows_NT" (
  30. set "PROGNAME=%~nx0%"
  31. ) else (
  32. set "PROGNAME=jdr.bat"
  33. )
  34. rem Setup JBoss specific properties
  35. if "x%JAVA_HOME%" == "x" (
  36. set JAVA=java
  37. echo JAVA_HOME is not set. Unexpected results may occur.
  38. echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
  39. ) else (
  40. set "JAVA=%JAVA_HOME%\bin\java"
  41. )
  42. rem Find jboss-modules.jar, or we can't continue
  43. if exist "%JBOSS_HOME%\jboss-modules.jar" (
  44. set "RUNJAR=%JBOSS_HOME%\jboss-modules.jar"
  45. ) else (
  46. echo Could not locate "%JBOSS_HOME%\jboss-modules.jar".
  47. echo Please check that you are in the bin directory when running this script.
  48. goto END
  49. )
  50. rem Setup JBoss specific properties
  51. rem Setup the java endorsed dirs
  52. set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed
  53. rem Set default module root paths
  54. if "x%JBOSS_MODULEPATH%" == "x" (
  55. set "JBOSS_MODULEPATH=%JBOSS_HOME%\modules"
  56. )
  57. rem Uncomment to override standalone and domain user location
  58. rem set "JAVA_OPTS=%JAVA_OPTS% -Djboss.server.config.user.dir=..\standalone\configuration -Djboss.domain.config.user.dir=..\domain\configuration"
  59. "%JAVA%" %JAVA_OPTS% ^
  60. -jar "%JBOSS_HOME%\jboss-modules.jar" ^
  61. -mp "%JBOSS_MODULEPATH%" ^
  62. org.jboss.as.domain-add-user ^
  63. %*
  64. :END
  65. if "x%NOPAUSE%" == "x" pause