source: gs3-extensions/solr/trunk/src/gs3-setup.bat@ 31755

Last change on this file since 31755 was 31755, checked in by ak19, 3 years ago

Adding a useful link

File size: 3.4 KB
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
17setlocal enabledelayedexpansion
18set FOUNDPROPS=
19:: Loosely based on
20:: http://stackoverflow.com/questions/7708681/how-to-read-from-a-properties-file-using-batch-script
21:: for with usebackq option allows spaces in filepath to be protected with double quotes
22:: (backquotes will be used for executing the commands)
23:: See also https://stackoverflow.com/questions/5553040/batch-file-for-loop-with-spaces-in-dir-name
24:: for alternative suggestions useful in other instances
25FOR /F "usebackq tokens=1,2 delims==" %%G IN ("%GSDL3SRCHOME%\build.properties") DO (
26 if "%%G"=="tomcat.server" set SOLR_HOST=%%H& set FOUNDPROPS=!FOUNDPROPS!found
27 if "%%G"=="tomcat.port" set SOLR_PORT=%%H& set FOUNDPROPS=!FOUNDPROPS!found
28 :: break out of the loop as soon as both properties are found
29 if "!FOUNDPROPS!" == "foundfound" goto foundall
30)
31
32:foundall
33endlocal& set SOLR_HOST=%SOLR_HOST%& set SOLR_PORT=%SOLR_PORT%
34echo Tomcat host: %SOLR_HOST%
35echo Tomcat port: %SOLR_PORT%
36
37
38rem IF USING JETTY SERVER FOR SOLR
39:: The port Jetty runs on:
40set SOLR_JETTY_PORT=8983
41
42:: The port Jetty listens on for a "stop" command
43set JETTY_STOP_PORT=8079
44
45if "%OS%" == "Windows_NT" goto WinNT
46if "%OS%" == "" goto Win95
47if "%GSDLLANG%" == "en" echo Setup failed - your PATH has not been set
48if "%GSDLLANG%" == "es" echo No se pudo realizar la configuraci¢n - no se ha establecido la RUTA.
49if "%GSDLLANG%" == "fr" echo Ech‚c de l'installation - votre variable PATH n'a pas ‚t‚ ajust‚e
50if "%GSDLLANG%" == "ru" echo “áâ ­®¢ª  ­¥ ã€ « áì - “’œ ­¥ ¡ë« ãáâ ­®¢«¥­
51goto End
52
53:WinNT
54set GEXT_SOLR=%CD%
55set PATH=%GEXT_SOLR%\bin\script;%PATH%
56set PATH=%GEXT_SOLR%\lib;%PATH%
57set GS_CP_SET=yes
58goto Success
59
60:Win95
61if "%1" == "SetEnv" goto Win95Env
62REM We'll invoke a second copy of the command processor to make
63REM sure there's enough environment space
64COMMAND /E:2048 /K %0 SetEnv
65goto End
66
67:Win95Env
68set GEXT_SOLR=%CD%
69set PATH="%GEXT_SOLR%\bin\script";"%PATH%"
70set PATH="%GEXT_SOLR%\lib";"%PATH%"
71set GS_CP_SET=yes
72goto Success
73
74:Success
75
76set fulldir=%~dp0
77
78:: strip off everything up to (and including) ext dir
79set extdir=%fulldir:*ext\=%
80
81:: remove trailing slash
82set extdir=%extdir:\=%
83
84setlocal enabledelayedexpansion
85if "x%GSDL3EXTS%" == "x" (
86 set GSDL3EXTS=!extdir!
87) else (
88 set GSDL3EXTS=!GSDL3EXTS!:!extdir!
89)
90endlocal & set GSDL3EXTS=%GSDL3EXTS%
91
92echo +Your environment is now setup for %extdesc%
93
94:: Back to delayed expansion to avoid problems with environment
95:: variables with brackets in them, such as "Program Files (x86)"
96
97::echo ++Solr/Jetty server will run on port %SOLR_JETTY_PORT% (+ port %JETTY_STOP_PORT% for shutdown command)
98echo ++Solr will run off the tomcat server on port %SOLR_PORT%
99echo --This port value can be changed by editing tomcat.port in build.properties
100::echo -- %0
101
102
103
104:End
105
106popd
Note: See TracBrowser for help on using the repository browser.