Changeset 30574
- Timestamp:
- 2016-06-16T19:20:23+12:00 (7 years ago)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/solr/trunk/src/gs3-setup.bat
r30532 r30574 14 14 set SOLR_PORT=8983 15 15 set SOLR_HOST=localhost 16 17 setlocal enabledelayedexpansion 18 set FOUNDPROPS= 16 19 :: Loosely based on 17 20 :: http://stackoverflow.com/questions/7708681/how-to-read-from-a-properties-file-using-batch-script 18 21 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 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 21 26 ) 27 endlocal 28 29 :foundall 22 30 echo Tomcat host: %SOLR_HOST% 23 31 echo Tomcat port: %SOLR_PORT% -
main/trunk/gli/gli.bat
r30573 r30574 167 167 168 168 rem In a web-dispersed GS3 set up like in the labs, gsdl3home.isreadonly would be true and 169 rem we need to run the web server in read-only mode. This section of code borrowed from gs3-server.bat. 170 set USE_TMPDIR_FOR_TOMCAT= 169 rem we need to run the web server in read-only mode. This section of code borrowed from gs3-server.bat. 171 170 for /F "tokens=1,2 delims==" %%G in (%GSDL3SRCHOME%\build.properties) do ( 172 if "%%G"=="gsdl3home.isreadonly" set USE_TMPDIR_FOR_TOMCAT=%%H 173 ) 174 if "%USE_TMPDIR_FOR_TOMCAT%" == "true" ( 175 set gsdl3_writablehome=%TMP%\greenstone\web 176 set opt_properties="-Dgsdl3home.isreadonly=true" -Dgsdl3.writablehome="%gsdl3_writablehome%" 177 echo Setting Greenstone3 web home writable area to be: %gsdl3_writablehome% 178 pushd %GSDL3SRCHOME% 179 cmd /c ant.bat %opt_properties% configure-web 180 popd 171 if "%%G"=="gsdl3home.isreadonly" if "%%H" == "true" ( 172 set gsdl3_writablehome=%TMP%\greenstone\web 173 :: not used 174 set opt_properties="-Dgsdl3home.isreadonly=true" -Dgsdl3.writablehome="%gsdl3_writablehome%" 175 echo Setting Greenstone3 web home writable area to be: %gsdl3_writablehome% 176 pushd %GSDL3SRCHOME% 177 :: passing opt_properties is no longer necessary because ant.bat is unmodified (doesn't make use of it) 178 :: and because build.xml already contains the properties with the correct values 179 cmd /c ant.bat %opt_properties% configure-web 180 popd 181 ) 181 182 ) 182 183 -
main/trunk/greenstone2/perllib/util.pm
r30561 r30574 234 234 235 235 236 # works out the temporary directory, including in the case where Greenstone is not writable 237 # In that case, gs3-setup.bat would already have set the GS_TMP_OUTPUT_DIR temp variable 238 sub determine_tmp_dir 239 { 240 my $try_collect_dir = shift(@_) || 0; 241 242 my $tmp_dirname; 243 if(defined $ENV{'GS_TMP_OUTPUT_DIR'}) { 244 $tmp_dirname = $ENV{'GS_TMP_OUTPUT_DIR'}; 245 } elsif($try_collect_dir && defined $ENV{'GSDLCOLLECTDIR'}) { 246 $tmp_dirname = $ENV{'GSDLCOLLECTDIR'}; 247 } elsif(defined $ENV{'GSDLHOME'}) { 248 $tmp_dirname = $ENV{'GSDLHOME'}; 249 } else { 250 return undef; 251 } 252 253 if(!defined $ENV{'GS_TMP_OUTPUT_DIR'}) { 254 # test the tmp_dirname folder is writable, by trying to write out a file 255 # Unfortunately, cound not get if(-w $dirname) to work on directories on Windows 256 ## http://alvinalexander.com/blog/post/perl/perl-file-test-operators-reference-cheat-sheet (test file/dir writable) 257 ## http://www.makelinux.net/alp/083 (real and effective user IDs) 258 259 my $tmp_test_file = &FileUtils::filenameConcatenate($tmp_dirname, "writability_test.tmp"); 260 if (open (FOUT, $tmp_test_file)) { 261 close(FOUT); 262 &FileUtils::removeFiles($tmp_test_file); 263 } else { # location not writable, use TMP location 264 $tmp_dirname = &FileUtils::filenameConcatenate($ENV{'TMP'}, "greenstone"); 265 $ENV{'GS_TMP_OUTPUT_DIR'} = $tmp_dirname; # store for next time 266 } 267 } 268 269 $tmp_dirname = &FileUtils::filenameConcatenate($tmp_dirname, "tmp"); 270 &FileUtils::makeAllDirectories ($tmp_dirname) unless -e $tmp_dirname; 271 272 return $tmp_dirname; 273 } 274 236 275 sub get_tmp_filename 237 276 { … … 251 290 } 252 291 253 my $tmpdir = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "tmp"); 254 &FileUtils::makeAllDirectories ($tmpdir) unless -e $tmpdir; 292 my $tmpdir = &util::determine_tmp_dir(0); 255 293 256 294 my $count = 1000; … … 274 312 sub get_timestamped_tmp_folder 275 313 { 276 277 my $tmp_dirname; 278 if(defined $ENV{'GSDLCOLLECTDIR'}) { 279 $tmp_dirname = $ENV{'GSDLCOLLECTDIR'}; 280 } elsif(defined $ENV{'GSDLHOME'}) { 281 $tmp_dirname = $ENV{'GSDLHOME'}; 282 } else { 283 return undef; 284 } 285 286 $tmp_dirname = &FileUtils::filenameConcatenate($tmp_dirname, "tmp"); 287 &FileUtils::makeDirectory($tmp_dirname) if (!-e $tmp_dirname); 288 314 my $tmp_dirname = &util::determine_tmp_dir(1); 315 289 316 # add the timestamp into the path otherwise we can run into problems 290 317 # if documents have the same name -
main/trunk/greenstone3/gs3-server.bat
r30568 r30574 53 53 54 54 set GSDL3PATH= 55 set USE_TMPDIR_FOR_TOMCAT= 55 56 56 57 "%RUNJAVA%" -cp "%CLASSPATH%" %opt_properties% org.greenstone.server.Server3 "%GSDL3SRCHOME%" -
main/trunk/greenstone3/gs3-setup.bat
r30568 r30574 36 36 :: set GSDL3HOME to the 'web' subdirectory 37 37 set GSDL3HOME=!GSDL3SRCHOME!\web 38 set TOMCATWEB=!GSDL3SRCHOME!\web38 set WEB_CONTAINING_CLASSES=!GSDL3SRCHOME!\web 39 39 :: set GSDL3HOME to any web.home property provided, and create that folder if it doesn't exist 40 40 :: Replace forward slashes in web.home with back slashes … … 44 44 set GSDL3HOME=%%H 45 45 set GSDL3HOME=!GSDL3HOME:/=\! 46 set TOMCATWEB=!GSDL3HOME!46 set WEB_CONTAINING_CLASSES=!GSDL3HOME! 47 47 if not exist "!GSDL3HOME!" cmd /c "!GSDL3SRCHOME!\userweb.cmd" 48 ) 49 ) 50 48 goto foundwebhome 49 ) 50 ) 51 52 :foundwebhome 51 53 :: Whatever the web directory is, it should contain the WEB-INF\classes folder, else go back to using default for this 52 54 :: The WEB-INF\classes folder will be absent in a userweb folder, but will be present if GSDL3HOME=GSDL3SRCHOME\web 53 55 :: or if web.home points to GS3 as a webapp inside tomcat 54 if not exist "!GSDL3HOME!\WEB-INF\classes" set TOMCATWEB=!GSDL3SRCHOME!\web56 if not exist "!GSDL3HOME!\WEB-INF\classes" set WEB_CONTAINING_CLASSES=!GSDL3SRCHOME!\web 55 57 56 58 :: change if using external tomcat or ant … … 63 65 :: ---- Set the CLASSPATH and PATH environment variables ---- 64 66 if "!GS_CP_SET!" == "yes" goto skipSetCp 65 set CLASSPATH=! TOMCATWEB!\WEB-INF\classes;!GSDL3SRCHOME!\resources\java;!GSDL3SRCHOME!\cp.jar;!CLASSPATH!;67 set CLASSPATH=!WEB_CONTAINING_CLASSES!\WEB-INF\classes;!GSDL3SRCHOME!\resources\java;!GSDL3SRCHOME!\cp.jar;!CLASSPATH!; 66 68 set PATH=!GSDL3SRCHOME!\bin;!GSDL3SRCHOME!\bin\script;!GSDL3SRCHOME!\lib\jni;!ANT_HOME!\bin;!PATH! 67 69 -
main/trunk/greenstone3/userweb.cmd
r30568 r30574 14 14 set INSTALLDIR=!GSDL3SRCHOME! 15 15 set USERWEB= 16 set IS_TMP_TOMCAT=17 16 18 17 :: Loosely based on http://stackoverflow.com/questions/7708681/how-to-read-from-a-properties-file-using-batch-script … … 20 19 :: http://scripts.dragon-it.co.uk/scripts.nsf/docs/batch-search-replace-substitute!OpenDocument&ExpandSection=3&BaseTarget=East&AutoFramed 21 20 for /F "tokens=1,2 delims==" %%G in (!GSDL3SRCHOME!\build.properties) do ( 22 if "%%G"=="web.home" set USERWEB=%%H& set USERWEB=!USERWEB:/=\! 23 if "%%G"=="gsdl3home.isreadonly" set IS_TMP_TOMCAT=%%H 21 if "%%G"=="web.home" set USERWEB=%%H& set USERWEB=!USERWEB:/=\!& goto found 24 22 ) 23 24 :found 25 25 echo USERWEB: !USERWEB! 26 echo IS_TMP_TOMCAT: !IS_TMP_TOMCAT!27 26 28 27 if "!USERWEB!" == "" echo No userweb directory provided & echo. & goto done
Note:
See TracChangeset
for help on using the changeset viewer.