[24446] | 1 | @echo off
|
---|
| 2 | pushd "%CD%"
|
---|
| 3 | CD /D "%~dp0"
|
---|
[26510] | 4 |
|
---|
[24446] | 5 | set extdesc=the Solr Extension
|
---|
[29749] | 6 | if "%GSDL3SRCHOME%" == "" echo Run the toplevel gs3-setup.bat before calling this script& goto End
|
---|
[24446] | 7 |
|
---|
[29749] | 8 | rem IF USING TOMCAT SERVER FOR SOLR
|
---|
| 9 | :: If using tomcat, read the tomcat host and port from the toplevel GS3 build.properties
|
---|
| 10 | :: http://en.kioskea.net/faq/1757-how-to-read-a-file-line-by-line
|
---|
| 11 | :: The following reads build.properties line by line, tokenizing it around the = sign, then
|
---|
| 12 | :: sets the SOLR_PORT and SOLR_HOST to the values of tomcat.port and tomcat.host properties
|
---|
| 13 |
|
---|
| 14 | set SOLR_PORT=8983
|
---|
| 15 | set SOLR_HOST=localhost
|
---|
[30574] | 16 |
|
---|
| 17 | setlocal enabledelayedexpansion
|
---|
| 18 | set FOUNDPROPS=
|
---|
[29749] | 19 | :: Loosely based on
|
---|
| 20 | :: http://stackoverflow.com/questions/7708681/how-to-read-from-a-properties-file-using-batch-script
|
---|
[30532] | 21 | FOR /F "tokens=1,2 delims==" %%G IN (%GSDL3SRCHOME%\build.properties) DO (
|
---|
[30574] | 22 | if "%%G"=="tomcat.server" set SOLR_HOST=%%H& set FOUNDPROPS=!FOUNDPROPS!found
|
---|
| 23 | if "%%G"=="tomcat.port" set SOLR_PORT=%%H& set FOUNDPROPS=!FOUNDPROPS!found
|
---|
| 24 | :: break out of the loop as soon as both properties are found
|
---|
| 25 | if "!FOUNDPROPS!" == "foundfound" goto foundall
|
---|
[29749] | 26 | )
|
---|
[30574] | 27 | endlocal
|
---|
| 28 |
|
---|
| 29 | :foundall
|
---|
[29749] | 30 | echo Tomcat host: %SOLR_HOST%
|
---|
| 31 | echo Tomcat port: %SOLR_PORT%
|
---|
| 32 |
|
---|
| 33 |
|
---|
| 34 | rem IF USING JETTY SERVER FOR SOLR
|
---|
[24485] | 35 | :: The port Jetty runs on:
|
---|
| 36 | set SOLR_JETTY_PORT=8983
|
---|
| 37 |
|
---|
| 38 | :: The port Jetty listens on for a "stop" command
|
---|
| 39 | set JETTY_STOP_PORT=8079
|
---|
| 40 |
|
---|
[24446] | 41 | if "%OS%" == "Windows_NT" goto WinNT
|
---|
| 42 | if "%OS%" == "" goto Win95
|
---|
| 43 | if "%GSDLLANG%" == "en" echo Setup failed - your PATH has not been set
|
---|
| 44 | if "%GSDLLANG%" == "es" echo No se pudo realizar la configuraci¢n - no se ha establecido la RUTA.
|
---|
| 45 | if "%GSDLLANG%" == "fr" echo Echc de l'installation - votre variable PATH n'a pas t ajuste
|
---|
| 46 | if "%GSDLLANG%" == "ru" echo áâ ®¢ª ¥ 〠« áì - ¥ ¡ë« ãáâ ®¢«¥
|
---|
| 47 | goto End
|
---|
| 48 |
|
---|
| 49 | :WinNT
|
---|
| 50 | set GEXT_SOLR=%CD%
|
---|
| 51 | set PATH=%GEXT_SOLR%\bin\script;%PATH%
|
---|
| 52 | set PATH=%GEXT_SOLR%\lib;%PATH%
|
---|
| 53 | set GS_CP_SET=yes
|
---|
| 54 | goto Success
|
---|
| 55 |
|
---|
| 56 | :Win95
|
---|
| 57 | if "%1" == "SetEnv" goto Win95Env
|
---|
| 58 | REM We'll invoke a second copy of the command processor to make
|
---|
| 59 | REM sure there's enough environment space
|
---|
| 60 | COMMAND /E:2048 /K %0 SetEnv
|
---|
| 61 | goto End
|
---|
| 62 |
|
---|
| 63 | :Win95Env
|
---|
| 64 | set GEXT_SOLR=%CD%
|
---|
| 65 | set PATH="%GEXT_SOLR%\bin\script";"%PATH%"
|
---|
| 66 | set PATH="%GEXT_SOLR%\lib";"%PATH%"
|
---|
| 67 | set GS_CP_SET=yes
|
---|
| 68 | goto Success
|
---|
| 69 |
|
---|
| 70 | :Success
|
---|
| 71 |
|
---|
| 72 | set fulldir=%~dp0
|
---|
| 73 |
|
---|
| 74 | :: strip off everything up to (and including) ext dir
|
---|
| 75 | set extdir=%fulldir:*ext\=%
|
---|
| 76 |
|
---|
| 77 | :: remove trailing slash
|
---|
| 78 | set extdir=%extdir:\=%
|
---|
| 79 |
|
---|
| 80 | setlocal enabledelayedexpansion
|
---|
[24485] | 81 | if "x%GSDL3EXTS%" == "x" (
|
---|
| 82 | set GSDL3EXTS=!extdir!
|
---|
[24446] | 83 | ) else (
|
---|
[24485] | 84 | set GSDL3EXTS=!GSDL3EXTS!:!extdir!
|
---|
[24446] | 85 | )
|
---|
[24485] | 86 | endlocal & set GSDL3EXTS=%GSDL3EXTS%
|
---|
[24446] | 87 |
|
---|
| 88 | echo +Your environment is now setup for %extdesc%
|
---|
| 89 |
|
---|
| 90 | :: Back to delayed expansion to avoid problems with environment
|
---|
| 91 | :: variables with brackets in them, such as "Program Files (x86)"
|
---|
| 92 |
|
---|
[29749] | 93 | ::echo ++Solr/Jetty server will run on port %SOLR_JETTY_PORT% (+ port %JETTY_STOP_PORT% for shutdown command)
|
---|
| 94 | echo ++Solr will run off the tomcat server on port %SOLR_PORT%
|
---|
[24485] | 95 | echo --These port values can be changed by editing:
|
---|
| 96 | echo -- %0
|
---|
[24446] | 97 |
|
---|
[24485] | 98 |
|
---|
| 99 |
|
---|
[24446] | 100 | :End
|
---|
| 101 |
|
---|
| 102 | popd |
---|