@echo off color 0A pushd "%CD%" CD /D "%~dp0" set GLILANG=en :: -------- Run the Greenstone Librarian Interface -------- :: This script must be run from within the directory in which it lives if exist gli.bat goto start if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides. if "%GLILANG%" == "es" echo Este guiвn deberа ejecutarse desde el directorio en el que reside. if "%GLILANG%" == "fr" echo Ce script doit Иtre exВcutВ Е partir du rВpertoire dans lequel il se trouve. if "%GLILANG%" == "ru" echo Этот скрипт должен быть взят из директории, в которой он расположен goto exit :start if "%OS%" == "Windows_NT" goto progName :: Invoke a new command processor to ensure there's enough environment space if "%1" == "Second" goto progName command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9 goto done :progName if not "%PROGNAME%" == "" goto findGSDL :: otherwise PROGNAME was not set, so default to the Greenstone Librarian Interface (GLI) program if "%GLILANG%" == "es" set PROGNAME=Biblioteca Digital Greenstone if "%GLILANG%" == "fr" set PROGNAME=Bibliothщcaire Greenstone if "%GLILANG%" == "ru" set PROGNAME=╔╬╘┼╥╞┼╩╙ Greenstone :: if the PROGNAME is still not set, then set the language to English if "%PROGNAME%" == "" set PROGNAME=Greenstone Librarian Interface if "%PROGABBR%" == "" set PROGABBR=GLI if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Librarian Interface :findGSDL echo. if "%GLILANG%" == "en" ( echo %PROGNAME% ^(%PROGABBR%^) echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato echo %PROGABBR% comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt echo This is free software, and you are welcome to redistribute it ) if "%GLILANG%" == "es" ( echo Interfaz de la %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^) echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato echo La Interfaz de la %PROGNAME% NO INCLUYE ABSOLUTAMENTE NINGUNA GARANT╓A. echo Para mayor informaciвn vea los tВrminos de la licencia en LICENSE.txt echo Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita ) if "%GLILANG%" == "fr" ( echo Interface du %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^) echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato echo %PROGABBR% est fourni sans AUCUNE GARANTIE; pour des dВtails, voir LICENSE.txt echo Ceci est un logiciel libre, et vous Иtes invitВ Е le redistribuer ) if "%GLILANG%" == "ru" ( echo Библиотечный интерфейс %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^) echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato echo БИГ не дает АБСОЛЮТНО НИКАКИХ ГАРАНТИЙ; детали см. в тексте LICENSE.TXT echo Это - свободно распространяемое программное обеспечение и Вы можете распространять его ) echo. :: ---- Determine path to Greenstone home for GS2 and GS3 ---- set GSDLPATH= :: Some users may set the above line manually, or it may be set as an argument set _VERSION= if not "%GSDLPATH%" == "" goto getVer :: Otherwise gsdlpath is not yet set :: Check the env vars first if not "%GSDL3SRCHOME%" == "" goto ver3 if not "%GSDLHOME%" == "" goto ver2 :: If not set, the default location for the GLI is a subdirectory of Greenstone set GSDLPATH=.. goto getVer :getVer call gsdlver.bat %GSDLPATH% %_VERSION% > nul if "%_VERSION%" == "1" goto exit ::if we are running GS2, free up any pre-set GS3 environment variables since we won't need them if "%_VERSION%" == "2" set GSDL3SRCHOME= if "%_VERSION%" == "2" set GSDL3HOME= goto testGSDL :ver3 set _VERSION=3 set GSDLPATH=%GSDL3SRCHOME% :: if GS2 is now also set, then both GS3 and GS2 are set: :: warn the user that we have defaulted to GS3 if not "%GSDLHOME%" == "" echo Both Greenstone 2 and Greenstone 3 environments are set. if not "%GSDLHOME%" == "" echo It is assumed you want to run Greenstone 3. if not "%GSDLHOME%" == "" echo If you want to run Greenstone 2, please unset the if not "%GSDLHOME%" == "" echo environment variable GSDL3SRCHOME before running GLI. if not "%GSDLHOME%" == "" echo. goto testGSDL :ver2 set _VERSION=2 set GSDLPATH=%GSDLHOME% ::free up the GS3 environment variables since we are running GS2 and don't need them set GSDL3SRCHOME= set GSDL3HOME= goto testGSDL :testGSDL set CHECK=1 call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% > nul if "%CHECK%" == "1" goto exit :: otherwise installation worked well goto prepGSDL :prepGSDL :: Greenstone 3 case if "%_VERSION%" == "3" goto prepGS3 if not "%_VERSION%" == "2" echo "Greenstone version unknown" if not "%_VERSION%" == "2" goto exit :: Otherwise, we are dealing with Greenstone 2 :: Setup Greenstone 2, unless it has already been done if not "%GSDLHOME%" == "" goto doneGSDL call "%GSDLPATH%\setup.bat" SetEnv goto doneGSDL :prepGS3 set GSDL2PATH= :: Some users may set the above line manually if "%GSDL3SRCHOME%" == "" goto setup3 if "%GSDL3HOME%" == "" goto setup3 ::otherwise goto gs2build :setup3 :: Setup Greenstone 3, unless it has already been done cd | winutil\setvar.exe GLIDIR > %TMP%\setgli.bat call %TMP%\setgli.bat del %TMP%\setgli.bat cd "%GSDLPATH%" call gs3-setup.bat SetEnv cd %GLIDIR% goto gs2build :gs2build :: If Greenstone version 3 is running, we want to set gsdl2path :: Determine GSDLHOME for GS3 if not "%GSDL2PATH%" == "" goto setupGS2 :: GSDL2PATH is not yet set. :: And if GSDLHOME is not set either, then assume :: that the gs2build subdir of GS3 exists if "%GSDLHOME%" == "" set GSDL2PATH=%GSDL3SRCHOME%\gs2build if "%GSDLHOME%" == "" goto setupGS2 :: Otherwise GSDLHOME is set, so set GSDL2PATH to GSDLHOME echo GSDLHOME environment variable is set to %GSDLHOME%. echo Will use this to find build scripts. set GSDL2PATH=%GSDLHOME% :setupGS2 set CHECK=1 call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% > nul if "%CHECK%" == "1" goto exit :: otherwise installation worked well :: Setup Greenstone, unless it has already been done if "%GSDLHOME%" == "" call "%GSDL2PATH%\setup.bat" SetEnv :: Either way, we can now dispose of GSDL2PATH set GSDL2PATH= goto doneGSDL :doneGSDL :: GSDLPATH is no longer needed, since GSDLHOME should now be set set GSDLPATH= :: Now need to find Perl. If found, PERLPATH will be set call findperl.bat if "%PERLPATH%" == "" goto exit :: Need to find Java. If found, JAVA_EXECUTABLE will be set call findjava.bat if "%JAVA_EXECUTABLE%" == "" goto exit :checkGLI :: ---- Check that the GLI has been compiled ---- if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI if exist "GLI.jar" goto runGLI echo. if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat) if "%GLILANG%" == "en" echo before running this script. if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este guiвn. if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat) if "%GLILANG%" == "fr" echo avant d'exВcuter ce script. if "%GLILANG%" == "ru" echo Вы должны компилировать библиотечный интерфейс Greenstone (используя makegli.bat) if "%GLILANG%" == "ru" echo перед вводом этого скрипта goto exit :runGLI if not "%_VERSION%" == "" ( echo Greenstone Major Version: echo %_VERSION% echo. ) if not "%GSDL3SRCHOME%" == "" ( echo GSDL3SRCHOME: echo %GSDL3SRCHOME% echo. ) if not "%GSDL3HOME%" == "" ( echo GSDL3HOME: echo %GSDL3HOME% echo. ) if not "%GSDLHOME%" == "" ( echo GSDLHOME: echo %GSDLHOME% echo. ) :: ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ---- echo. if exist "%GSDLHOME%\bin\windows\ghostscript\bin\*.*" echo GhostScript bundled with Greenstone will be used, if you wish to use the version installed on your system (if any) please go to %GSDLHOME%\bin\windows and rename the folder called ghostscript to something else. echo. echo. if exist "%GSDLHOME%\bin\windows\imagemagick\*.*" echo ImageMagick bundled with Greenstone will be used, if you wish to use the version installed on your system (if any) please go to %GSDLHOME%\bin\windows and rename the folder called imagemagick to something else. echo. echo. :: ---- Finally, run the GLI ---- if "%GLILANG%" == "en" echo Running the %PROGNAME%... if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%... if "%GLILANG%" == "fr" echo ExВcution de %PROGNAME% if "%GLILANG%" == "ru" echo Текущий библи %PROGNAME%... :: -Xms32M To set minimum memory :: -Xmx32M To set maximum memory :: -verbose:gc To set garbage collection messages :: -Xincgc For incremental garbage collection :: -Xprof Function call profiling :: -Xloggc: Write garbage collection log :: Run GS3 if version = 3 if "%_VERSION%" == "3" "%JAVA_EXECUTABLE%" -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl %GSDLHOME% -gsdlos %GSDLOS% -gsdl3 %GSDL3HOME% -gsdl3src %GSDL3SRCHOME% -perl %PERLPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9 if "%_VERSION%" == "3" goto finRun :: Run GS2 since version is 2: :: if FLI is running, we don't want the local Greenstone library server running if "%PROGABBR%" == "FLI" goto webLib :: Else we're running GLI, so we want the local Greenstone library server (if server.exe exists, otherwise it will be webLib) if exist "%GSDLHOME%\server.exe" goto localLib :webLib "%JAVA_EXECUTABLE%" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl %GSDLHOME% -gsdlos %GSDLOS% -perl %PERLPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9 if ERRORLEVEL 2 ( goto webLib ) goto finRun :localLib "%JAVA_EXECUTABLE%" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl %GSDLHOME% -gsdlos %GSDLOS% -perl %PERLPATH% -local_library %GSDLHOME%\server.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 if ERRORLEVEL 2 ( goto localLib ) goto finRun :finRun if "%GLILANG%" == "en" echo Done! if "%GLILANG%" == "es" echo нHecho! if "%GLILANG%" == "fr" echo TerminВ! if "%GLILANG%" == "ru" echo Выполнено! goto done :exit echo. pause color 07 popd :done :: ---- Clean up ---- set PERLPATH= set JAVA_EXECUTABLE= color 07 popd