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