Changeset 23966

Show
Ignore:
Timestamp:
28.04.2011 21:13:01 (8 years ago)
Author:
ak19
Message:

More changes to do with reset-gsdlhome.

Location:
main/trunk/greenstone2
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/gsicontrol.bat

    r23964 r23966  
    33setlocal 
    44::set testdone=0 
     5set startdir=%CD% 
     6::cd /d "%~dp0" 
     7if "%GSDLHOME%" == "" goto testgsdl 
     8cd "%GSDLHOME%" 
     9 
     10::set _sed="%GSDLHOME%\bin\windows\sed.exe" 
     11:: NOTE: no quotes allowed around the following, since it's used inside  
     12:: a FOR statement executing a command already embedded in quotes 
     13set _sed=bin\windows\sed.exe 
    514 
    615set cgibin=cgi-bin 
     
    1524:: Construct the signal using the unique GS2 installation 
    1625:: directory (after replacing spaces, colons and backslashes) 
    17 if "%GSDLHOME%" == "" goto testgsdl 
    1826set signal=%GSDLHOME: =_% 
    19 for /F "delims=*" %%T in ('"echo %signal%| bin\windows\sed.exe s@[\\:]@_@g"') do set signal=%%T 
     27for /F "delims=*" %%T in ('"echo %signal%| %_sed% s@[\\:]@_@g"') do set signal=%%T 
    2028set GS2_APACHE_HTTPD_SIGNAL=GS2_APACHE_HTTPD_%signal% 
    2129set signal= 
     
    5058echo    configure-cgi 
    5159echo    reset-gsdlhome [config-filename] 
    52 echo        (Save a copy of %cgibin%\gsdlsite.cfg to preserve any customisations) 
    5360echo    set-port 
    5461echo    test-gsdlhome 
     
    169176 
    170177 
    171 :: reset-gsdlhome forces configure-cgi by deleting gsdlsite.cfg 
     178:: reset-gsdlhome forces configure-cgi by renaming any existing gsdlsite.cfg 
    172179:resethome 
    173180echo. 
    174181if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" ( 
    175     echo **** WARNING. Local changes made to %GSDLHOME%\%cgibin%\gsdlsite.cfg will be lost. 
    176     del "%GSDLHOME%\%cgibin%\gsdlsite.cfg" 
    177 ) 
    178  
    179 set _sed="bin\windows\sed.exe" 
    180 for /F "delims=*" %%T in ('"echo %GSDLHOME%| bin\windows\sed.exe s@\\@\/@g"') do set safepath=%%T 
     182    move "%GSDLHOME%\%cgibin%\gsdlsite.cfg" "%GSDLHOME%\%cgibin%\gsdlsite.cfg.bak"   
     183    echo **** Regenerating %GSDLHOME%\%cgibin%\gsdlsite.cfg 
     184    echo **** Previous version of file now %GSDLHOME%\%cgibin%\gsdlsite.cfg.bak 
     185) 
     186 
     187for /F "delims=*" %%T in ('"echo %GSDLHOME%| %_sed% s@\\@\/@g"') do set safepath=%%T 
     188 
     189:: Also re-initialise the log4j.properties and Mac's .app files 
     190 
     191::set log4jprop=%GSDLHOME%\lib\java\log4j.properties 
     192::%_sed% "s^@gsdl2home@^%GSDLHOME%^g" "%log4jprop%.in" > "%log4jprop%"  
     193type "lib\java\log4j.properties.in" | %_sed% "s\@gsdl2home@\%safepath%\g" > "lib\java\log4j.properties"  
    181194 
    182195type "gs2-server.app\Contents\document.wflow.in" | %_sed% "s@\*\*GSDLHOME\*\*@%safepath%@g" > "gs2-server.app\Contents\document.wflow" 
     
    194207if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" goto cgimsg 
    195208echo Configuring %cgibin%\gsdlsite.cfg 
    196 for /F "delims=*" %%T in ('"echo %GSDLHOME%| bin\windows\sed.exe s@\\@\\\\@g"') do set safepath=%%T 
    197 bin\windows\sed.exe "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" %cgibin%\gsdlsite.cfg.in > %cgibin%\gsdlsite.cfg   
     209for /F "delims=*" %%T in ('"echo %GSDLHOME%| %_sed% s@\\@\\\\@g"') do set safepath=%%T 
     210%_sed% "s@\*\*GSDLHOME\*\*@\"%safepath%\"@g" %cgibin%\gsdlsite.cfg.in > %cgibin%\gsdlsite.cfg    
    198211set safepath= 
    199212goto cgifin 
     
    259272   goto exit 
    260273) 
    261 if "%_sed%" == "" set _sed="bin\windows\sed.exe" 
    262 if "%safepath%" == "" for /F "delims=*" %%T in ('"echo %GSDLHOME%| bin\windows\sed.exe s@\\@\/@g"') do set safepath=%%T 
     274if "%safepath%" == "" for /F "delims=*" %%T in ('"echo %GSDLHOME%| %_sed% s@\\@\/@g"') do set safepath=%%T 
    263275 
    264276if exist "%GSDLHOME%\%cgibin%\gsdlsite.cfg" FOR /F "tokens=2" %%G IN ('findstr /R ^collecthome "%GSDLHOME%\%cgibin%\gsdlsite.cfg"') do set COLLECTHOME=%%G 
    265277if "%COLLECTHOME%" == "" set COLLECTHOME=%GSDLHOME%\collect 
    266 for /F "delims=*" %%T in ('"echo %COLLECTHOME%| bin\windows\sed.exe s@\\@\/@g"') do set safecollectpath=%%T 
     278for /F "delims=*" %%T in ('"echo %COLLECTHOME%| %_sed% s@\\@\/@g"') do set safecollectpath=%%T 
    267279 
    268280 
     
    288300 
    289301:exit 
     302cd "%startdir%" 
     303set startdir=  
    290304endlocal 
  • main/trunk/greenstone2/gsicontrol.sh

    r23963 r23966  
    146146 
    147147# forces configure-cgi by deleting gsdlsite.cfg 
    148 function reset-gsdlhome {     
     148function reset-gsdlhome { 
     149    echo "" ; 
    149150    if test -e "$GSDLHOME/$cgibin/gsdlsite.cfg" ; then 
    150     echo "**** WARNING. Local changes made to $GSDLHOME/$cgibin/gsdlsite.cfg will be lost."; 
    151     rm -f "$GSDLHOME/$cgibin/gsdlsite.cfg"; 
    152     fi 
    153  
     151        /bin/mv "$GSDLHOME/$cgibin/gsdlsite.cfg" "$GSDLHOME/$cgibin/gsdlsite.cfg.bak" ; 
     152        echo "**** Regenerating $GSDLHOME/$cgibin/gsdlsite.cfg" ; 
     153        echo "**** Previous version of file now $GSDLHOME/$cgibin/gsdlsite.cfg.bak" ; 
     154    fi 
     155 
     156    log4jprop=$GSDLHOME/lib/java/log4j.properties 
     157    sed "s^@gsdl2home@^$GSDLHOME^g" "$log4jprop.in" > "$log4jprop" 
     158     
    154159    sed "s@\*\*GSDLHOME\*\*@$GSDLHOME@g" "gs2-server.app/Contents/document.wflow.in" > "gs2-server.app/Contents/document.wflow" 
    155160    sed "s@\*\*GSDLHOME\*\*@$GSDLHOME@g" "gli.app/Contents/document.wflow.in" > "gli.app/Contents/document.wflow"