Changeset 15608

Show
Ignore:
Timestamp:
21.05.2008 12:05:37 (11 years ago)
Author:
ak19
Message:

Rewrote gli.bat to now work with both Greenstone 2 and Greenstone 3 (replaces gli4gs3.bat)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gli/trunk/gli.bat

    r15354 r15608  
    1515 
    1616:start 
    17 if "%OS%" == "Windows_NT" goto findGSDL 
     17if "%OS%" == "Windows_NT" goto progName 
    1818    :: Invoke a new command processor to ensure there's enough environment space 
    19     if "%1" == "Second" goto findGSDL 
     19    if "%1" == "Second" goto progName 
    2020        command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9 
    2121        goto done 
    2222 
     23 
     24:progName 
     25if not "%PROGNAME%" == "" goto findGSDL 
     26    :: otherwise PROGNAME was not set, so default to the Greenstone Librarian Interface (GLI) program 
     27    if "%GLILANG%" == "es" set PROGNAME=Biblioteca Digital Greenstone 
     28    if "%GLILANG%" == "fr" set PROGNAME=Bibliothécaire Greenstone 
     29    if "%GLILANG%" == "ru" set PROGNAME=ÉÎÔÅÒÆÅÊÓ Greenstone 
     30    :: if the PROGNAME is still not set, then set the language to English 
     31    if "%PROGNAME%" == "" set PROGNAME=Greenstone Librarian Interface 
     32 
     33 
     34if "%PROGABBR%" == "" set PROGABBR=GLI 
     35if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Librarian Interface 
     36 
    2337:findGSDL 
    2438echo. 
    25 if "%GLILANG%" == "en" echo Greenstone Librarian Interface (GLI) 
     39if "%GLILANG%" == "en" echo %PROGNAME% (%PROGABBR%) 
    2640if "%GLILANG%" == "en" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato 
    27 if "%GLILANG%" == "en" echo GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt 
     41if "%GLILANG%" == "en" echo %PROGABBR% comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt 
    2842if "%GLILANG%" == "en" echo This is free software, and you are welcome to redistribute it 
    2943 
    30 if "%GLILANG%" == "es" echo Interfaz de la Biblioteca Digital Greenstone (Greenstone Librarian Interface - GLI) 
     44if "%GLILANG%" == "es" echo Interfaz de la %PROGNAME% (%PROGNAME_EN% - %PROGABBR%) 
    3145if "%GLILANG%" == "es" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato 
    32 if "%GLILANG%" == "es" echo La Interfaz de la Biblioteca Digital Greenstone NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÖA. 
     46if "%GLILANG%" == "es" echo La Interfaz de la %PROGNAME% NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÖA. 
    3347if "%GLILANG%" == "es" echo Para mayor informaci¢n vea los t‚rminos de la licencia en LICENSE.txt 
    3448if "%GLILANG%" == "es" echo Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita 
    3549 
    36 if "%GLILANG%" == "fr" echo Interface du Biblioth‚caire Greenstone (Greenstone Librarian Interface - GLI) 
     50if "%GLILANG%" == "fr" echo Interface du %PROGNAME% (%PROGNAME_EN% - %PROGABBR%) 
    3751if "%GLILANG%" == "fr" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato 
    38 if "%GLILANG%" == "fr" echo GLI est fourni sans AUCUNE GARANTIE; pour des d‚tails, voir LICENSE.txt 
     52if "%GLILANG%" == "fr" echo %PROGABBR% est fourni sans AUCUNE GARANTIE; pour des d‚tails, voir LICENSE.txt 
    3953if "%GLILANG%" == "fr" echo Ceci est un logiciel libre, et vous ˆtes invit‚  
    4054 le redistribuer 
    4155 
    42 if "%GLILANG%" == "ru" echo š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (Greenstone Librarian Interface - GLI) 
     56if "%GLILANG%" == "ru" echo š¡«š®â¥ç­ë© š­â¥à䥩á %PROGNAME% (%PROGNAME_EN% - %PROGABBR%) 
    4357if "%GLILANG%" == "ru" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato 
    4458if "%GLILANG%" == "ru" echo ˆƒ ­¥ € ¥â €‘Ž‹ž’Ž ˆŠ€Šˆ• ƒ€€’ˆ‰; €¥â «š á¬. ¢ ⥪á⥠LICENSE.TXT 
     
    4660 
    4761echo. 
    48 ::  ---- Determine GSDLHOME ---- 
     62::  ---- Determine path to Greenstone home for GS2 and GS3 ---- 
    4963set GSDLPATH= 
    50  
    51 :: Some users may set the above line manually 
    52 if not "%GSDLPATH%" == "" goto testGSDL 
    53  
    54     :: The default location for the GLI is a subdirectory of Greenstone 
    55     set GSDLPATH=.. 
    56  
    57     :: If it is set, use the GSDLHOME environment variable  
    58     if "%GSDLHOME%" == "" goto testGSDL 
    59     set GSDLPATH=%GSDLHOME% 
     64:: Some users may set the above line manually, or it may be set as an argument 
     65 
     66set _VERSION= 
     67if not "%GSDLPATH%" == "" goto getVer 
     68    :: Otherwise gsdlpath is not yet set 
     69    :: Check the env vars first  
     70    if not "%GSDL3SRCHOME%" == "" goto ver3 
     71        if not "%GSDLHOME%" == "" goto ver2 
     72            :: If not set, the default location for the GLI is a subdirectory of Greenstone 
     73            set GSDLPATH=.. 
     74            goto getVer 
     75 
     76:getVer 
     77call gsdlver.bat %GSDLPATH% %_VERSION% SetEnv > nul 
     78if "%_VERSION%" == "1" goto exit 
     79goto testGSDL 
     80 
     81 
     82:ver3 
     83set _VERSION=3 
     84set GSDLPATH=%GSDL3SRCHOME% 
     85:: if GS2 is now also set, then both GS3 and GS2 are set:  
     86:: warn the user that we have defaulted to GS3 
     87if not "%GSDLHOME%" == "" echo Both Greenstone 2 and Greenstone 3 environments are set. 
     88if not "%GSDLHOME%" == "" echo It is assumed you want to run Greenstone 3. 
     89if not "%GSDLHOME%" == "" echo If you want to run Greenstone 2, please unset the 
     90if not "%GSDLHOME%" == "" echo environment variable GSDL3SRCHOME before running GLI. 
     91if not "%GSDLHOME%" == "" echo. 
     92goto testGSDL 
     93 
     94 
     95:ver2 
     96set _VERSION=2 
     97set GSDLPATH=%GSDLHOME% 
     98goto testGSDL 
     99 
    60100 
    61101:testGSDL 
    62 :: Check that the Greenstone installation looks OK 
    63 if "%GLILANG%" == "en" echo Checking GSDL: %GSDLPATH% 
    64 if "%GLILANG%" == "es" echo Revisando GSDL: %GSDLPATH% 
    65 if "%GLILANG%" == "fr" echo V‚rification de GSDL: %GSDLPATH% 
    66 if "%GLILANG%" == "ru" echo à®¢¥àª  GSDL: %GSDLPATH% 
    67 if exist "%GSDLPATH%\setup.bat" goto prepGSDL 
    68     echo. 
    69     if "%GLILANG%" == "en" echo The Greenstone installation could not be found, or is incomplete. 
    70     if "%GLILANG%" == "en" echo Try reinstalling Greenstone then running this script again. 
    71  
    72     if "%GLILANG%" == "es" echo No se pudo encontrar la instalaci¢n de Greenstone o est  incompleta. 
    73     if "%GLILANG%" == "es" echo Trate de reinstalar Greenstone y a continuaci¢n ejecute nuevamente este gui¢n. 
    74  
    75     if "%GLILANG%" == "fr" echo L'installation de Greenstone est introuvable ou incomplŠte. Essayez 
    76     if "%GLILANG%" == "fr" echo de r‚installer Greenstone et ex‚cutez ce script  
    77  nouveau. 
    78  
    79     if "%GLILANG%" == "ru" echo ˆ­áâ ««ïæšï Greenstone ­¥ ¡ë«  ­ ©€¥­  š«š ®­  ­¥¯®«­ . ®¯à®¡ã©â¥ ¯®¢â®à­® 
    80     if "%GLILANG%" == "ru" echo ãáâ ­®¢šâì Greenstone,   § â¥¬ ¢¢¥áâš íâ®â áªàš¯â á­®¢ . 
    81     goto exit 
     102set CHECK=1 
     103call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% SetEnv > nul 
     104if "%CHECK%" == "1" goto exit 
     105    :: otherwise installation worked well 
     106    goto prepGSDL 
     107 
    82108 
    83109:prepGSDL 
    84 :: Setup Greenstone, unless it has already been done 
     110:: Greenstone 3 case 
     111if "%_VERSION%" == "3" goto prepGS3 
     112 
     113if not "%_VERSION%" == "2" echo "Greenstone version unknown" 
     114if not "%_VERSION%" == "2" goto :exit 
     115 
     116:: Otherwise, we are dealing with Greenstone 2 
     117:: Setup Greenstone 2, unless it has already been done 
    85118if not "%GSDLHOME%" == "" goto doneGSDL 
    86119    call "%GSDLPATH%\setup.bat" SetEnv > nul 
     120    goto doneGSDL 
     121 
     122 
     123:prepGS3 
     124set GSDL2PATH= 
     125: Some users may set the above line manually 
     126 
     127if "%GSDL3SRCHOME%" == "" goto setup3 
     128    if "%GSDL3HOME%" == "" goto setup3 
     129        ::otherwise 
     130        goto gs2build 
     131 
     132 
     133:setup3 
     134:: Setup Greenstone 3, unless it has already been done 
     135    cd | winutil\setvar.exe GLIDIR > %TMP%\setgli.bat 
     136    call %TMP%\setgli.bat 
     137    del %TMP%\setgli.bat 
     138    cd "%GSDLPATH%" 
     139    call gs3-setup.bat SetEnv > nul 
     140    cd %GLIDIR% 
     141    goto gs2build 
     142 
     143 
     144:gs2build 
     145    :: If Greenstone version 3 is running, we want to set gsdl2path 
     146    :: Determine GSDLHOME for GS3  
     147    if not "%GSDL2PATH%" == "" goto setupGS2 
     148        :: GSDL2PATH is not yet set.  
     149        :: And if GSDLHOME is not set either, then assume  
     150        :: that the gs2build subdir of GS3 exists 
     151        if "%GSDLHOME%" == "" set GSDL2PATH=%GSDL3SRCHOME%\gs2build 
     152        if "%GSDLHOME%" == "" goto setupGS2  
     153            :: Otherwise GSDLHOME is set, so set GSDL2PATH to GSDLHOME 
     154            echo GSDLHOME environment variable is set to %GSDLHOME%.     
     155            echo Will use this to find build scripts. 
     156            set GSDL2PATH=%GSDLHOME% 
     157 
     158:setupGS2 
     159set CHECK=1 
     160call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% SetEnv > nul 
     161if "%CHECK%" == "1" goto exit 
     162    :: otherwise installation worked well 
     163    :: Setup Greenstone, unless it has already been done 
     164    if "%GSDLHOME%" == "" call "%GSDL2PATH%\setup.bat" SetEnv > nul 
     165    :: Either way, we can now dispose of GSDL2PATH 
     166    set GSDL2PATH=   
     167    goto doneGSDL 
     168 
    87169 
    88170:doneGSDL 
     
    133215         
    134216:testPerl 
     217echo. 
    135218:: Check that a Perl executable has been found 
    136219if "%GLILANG%" == "en" echo Checking Perl: %PERLPATH% 
     
    210293if "%GLILANG%" == "fr" echo V‚rification de Java: %JAVAPATH% 
    211294if "%GLILANG%" == "ru" echo à®¢¥àª  Java: %JAVAPATH% 
    212 if exist "%JAVAPATH%\java.exe" goto checkGLI 
     295if exist "%JAVAPATH%\java.exe" goto checkJV 
    213296 
    214297:noJava 
     
    230313    if "%GLILANG%" == "ru" echo ¡š¡«š®â¥ç­®£® š­â¥àä¥©á  Greenstone. 
    231314    goto exit 
     315 
     316 
     317:: Check the version of Java is new enough (1.4.0 or higher) to run the GLI 
     318:checkJV 
     319"%JAVAPATH%\java" -classpath . CheckJavaVersion 
     320     if ERRORLEVEL 2 goto checkGLI 
     321    :: Otherwise, errorlevel was an error value 
     322       if "%GLILANG%" == "es" La versión del Ambiente de Ejecución Java (JRE por sus siglas en  
     323       if "%GLILANG%" == "es" inglés) que usted tiene instalada es demasiado vieja para ejecutar  
     324       if "%GLILANG%" == "es" la Interfaz de la %PROGNAME%. Por favor instale  
     325       if "%GLILANG%" == "es" una nueva versión del Ambiente de Ejecución Java (versión 1.4 o  
     326       if "%GLILANG%" == "es" posterior) y ejecute nuevamente este guión. 
     327 
     328           if "%GLILANG%" == "fr" La version de Java Runtime Environment que vous avez installée est 
     329           if "%GLILANG%" == "fr" trop vielle pour faire fonctionner %PROGNAME%. 
     330           if "%GLILANG%" == "fr" Veuillez installer une nouvelle version du JRE (version 1.4 ou plus 
     331           if "%GLILANG%" == "fr" récente) et redémarrez le script. 
     332 
     333           if "%GLILANG%" == "ru" ÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ, 
     334           if "%GLILANG%" == "ru" ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ %PROGNAME%. ðÏÖÁÌÕÊÓÔÁ,  
     335           if "%GLILANG%" == "ru" ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É 
     336           if "%GLILANG%" == "ru" ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ 
     337 
     338           if "%GLILANG%" == "en" The version of the Java Runtime Environment you have installed is too 
     339           if "%GLILANG%" == "en" old to run the %PROGNAME%. Please install a new 
     340           if "%GLILANG%" == "en" version of the JRE (version 1.4 or newer) and rerun this script. 
     341           goto exit 
    232342 
    233343 
     
    254364:: ---- Finally, run the GLI ---- 
    255365echo. 
     366echo ****gsdlhome is %GSDLHOME% 
     367echo ****gsdl3home is %GSDL3HOME% 
     368echo ****gsdl3srchome is %GSDL3SRCHOME% 
    256369 
    257370if "%GLILANG%" == "en" echo Running the Greenstone Librarian Interface... 
     
    267380:: -Xloggc:<file>   Write garbage collection log 
    268381 
    269 if exist "%GSDLHOME%\server.exe" goto localLib  
     382 
     383:: Run GS3 if version = 3 
     384if "%_VERSION%" == "3" "%JAVAPATH%\java" -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 
     385if "%_VERSION%" == "3" goto finRun 
     386 
     387:: Run GS2 since version is 2: 
     388:: if FLI is running, we don't want the local Greenstone library server running 
     389if "%PROGABBR%" == "FLI" goto webLib 
     390    :: Else we're running GLI, so we want the local Greenstone library server (if server.exe exists, otherwise it will be webLib) 
     391    if exist "%GSDLHOME%\server.exe" goto localLib  
    270392 
    271393:webLib 
    272394    "%JAVAPATH%\java" -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 
    273  
    274395    if ERRORLEVEL 2 goto webLib 
    275  
     396    goto finRun  
     397 
     398:localLib 
     399    "%JAVAPATH%\java" -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 
     400    if ERRORLEVEL 2 goto localLib 
     401    goto finRun 
     402 
     403 
     404:finRun 
    276405    if "%GLILANG%" == "en" echo Done! 
    277406    if "%GLILANG%" == "es" echo ­Hecho! 
     
    280409    goto done 
    281410 
    282 :localLib 
    283     "%JAVAPATH%\java" -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 
    284  
    285     if ERRORLEVEL 2 goto localLib 
    286  
    287     if "%GLILANG%" == "en" echo Done! 
    288     if "%GLILANG%" == "es" echo ­Hecho! 
    289     if "%GLILANG%" == "fr" echo Termin‚! 
    290     if "%GLILANG%" == "ru" echo ‚믮«­¥­®! 
    291     goto done 
    292411 
    293412:exit