root/gs3-extensions/solr/trunk/src/gs3-setup.bat @ 29749

Revision 29749, 2.8 KB (checked in by ak19, 5 years ago)

Bringing ext\solr's gs3-setup.bat up to speed with recent changse ing solr's gs3-setup.sh, now that solr's changed to use the GS3 tomcat server instead of solr's included jetty. gs3-setup.bat now reads tomcat.server and tomcat.port from build.properties to set SOLR_HOST and SOLR_PORT

Line 
1@echo off
2pushd "%CD%"
3CD /D "%~dp0"
4
5set extdesc=the Solr Extension
6if "%GSDL3SRCHOME%" == "" echo Run the toplevel gs3-setup.bat before calling this script& goto End
7
8rem 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
14set SOLR_PORT=8983
15set SOLR_HOST=localhost
16:: Loosely based on
17:: http://stackoverflow.com/questions/7708681/how-to-read-from-a-properties-file-using-batch-script
18FOR /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)
22echo Tomcat host: %SOLR_HOST%
23echo Tomcat port: %SOLR_PORT%
24
25
26rem IF USING JETTY SERVER FOR SOLR
27:: The port Jetty runs on:
28set SOLR_JETTY_PORT=8983
29
30:: The port Jetty listens on for a "stop" command
31set JETTY_STOP_PORT=8079
32
33if "%OS%" == "Windows_NT" goto WinNT
34if "%OS%" == "" goto Win95
35if "%GSDLLANG%" == "en" echo Setup failed - your PATH has not been set
36if "%GSDLLANG%" == "es" echo No se pudo realizar la configuraci¢n - no se ha establecido la RUTA.
37if "%GSDLLANG%" == "fr" echo Ech‚c de l'installation - votre variable PATH n'a pas ‚t‚ ajust‚e
38if "%GSDLLANG%" == "ru" echo “áâ ­®¢ª  ­¥ ã€ « áì - “’œ ­¥ ¡ë« ãáâ ­®¢«¥­
39goto End
40
41:WinNT
42set GEXT_SOLR=%CD%
43set PATH=%GEXT_SOLR%\bin\script;%PATH%
44set PATH=%GEXT_SOLR%\lib;%PATH%
45set GS_CP_SET=yes
46goto Success
47
48:Win95
49if "%1" == "SetEnv" goto Win95Env
50REM We'll invoke a second copy of the command processor to make
51REM sure there's enough environment space
52COMMAND /E:2048 /K %0 SetEnv
53goto End
54
55:Win95Env
56set GEXT_SOLR=%CD%
57set PATH="%GEXT_SOLR%\bin\script";"%PATH%"
58set PATH="%GEXT_SOLR%\lib";"%PATH%"
59set GS_CP_SET=yes
60goto Success
61
62:Success
63
64set fulldir=%~dp0
65
66:: strip off everything up to (and including) ext dir
67set extdir=%fulldir:*ext\=%
68
69:: remove trailing slash
70set extdir=%extdir:\=%
71
72setlocal enabledelayedexpansion
73if "x%GSDL3EXTS%" == "x" (
74  set GSDL3EXTS=!extdir!
75) else (
76  set GSDL3EXTS=!GSDL3EXTS!:!extdir!
77)
78endlocal & set GSDL3EXTS=%GSDL3EXTS%
79
80echo +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
85::echo ++Solr/Jetty server will run on port %SOLR_JETTY_PORT% (+ port %JETTY_STOP_PORT% for shutdown command)
86echo ++Solr will run off the tomcat server on port %SOLR_PORT%
87echo --These port values can be changed by editing:
88echo --  %0
89
90
91
92:End
93
94popd
Note: See TracBrowser for help on using the browser.