Ignore:
Timestamp:
2011-07-20T18:52:50+12:00 (13 years ago)
Author:
ak19
Message:

Improvement to code committed previously: Fixed a bug introduced with the reset-gsdlhome target where any non-standard collecthome value written into the gsdlsite.cfg was lost on startup, since reset-gsdlhome always regenerated gsdlsite.cfg from the template file. Now, the relocation code of the reset-gsdlhome target doesn't get exected every time, only when the gsdlhome property in gsdlsite.cfg is different from GSDLHOME var (which points to the current greenstone installation directory.)

File:
1 edited

Legend:

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

    r24295 r24297  
    4141    echo "" >> "$cgibin/gsdlsite.cfg" ;
    4242    sed "s@\*\*GSDLHOME\*\*@$GSDLHOME@g" "$cgibin/gsdlsite.cfg.in" >> "$cgibin/gsdlsite.cfg" ;
    43 # preserve the user-assigned collecthome property, if any
    44     if test -e "$GSDLHOME/$cgibin/gsdlsite.cfg.bak" ; then
    45         collecthome=`egrep "^collecthome" "$cgibin/gsdlsite.cfg.bak" | awk '{print $2}'` ;
    46         if test -n $collecthome ; then
    47         echo "collecthome $collecthome" >> "$cgibin/gsdlsite.cfg" ;
    48         echo "" >> "$cgibin/gsdlsite.cfg" ;
    49         fi
    50     fi
    5143    else
    5244    echo "WARNING: Nothing done for make configure-cgi." ;
     
    175167}
    176168
    177 # forces configure-cgi by deleting gsdlsite.cfg
     169# Forces configure-cgi by renaming gsdlsite.cfg
     170# but only if we actually *need* to relocate gsdlhome.
     171# We relocate at all times, except when there is a gsdlsite.cfg file with its
     172# gsdlhome property the same as the current (greenstone installation) directory
    178173function reset-gsdlhome {
    179174    echo "" ;
     175    relocate=yes ;
    180176    if test -e "$GSDLHOME/$cgibin/gsdlsite.cfg" ; then
    181     /bin/mv "$GSDLHOME/$cgibin/gsdlsite.cfg" "$GSDLHOME/$cgibin/gsdlsite.cfg.bak" ;
    182     echo "**** Regenerating $GSDLHOME/$cgibin/gsdlsite.cfg" ;
    183     echo "**** Previous version of file now $GSDLHOME/$cgibin/gsdlsite.cfg.bak" ;
    184     fi
    185 
    186     apache_home_os="$GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH"
    187 
    188     if test ! -e "$apache_home_os/bin/apachectl.in" ; then
    189     make apache-for-dist
    190     fi
     177    stored_gsdlhome=`egrep "^gsdlhome" "$cgibin/gsdlsite.cfg" | awk '{print $2}'` ;
     178    if [ "x$stored_gsdlhome" != "x$GSDLHOME" ]; then
     179        /bin/mv "$GSDLHOME/$cgibin/gsdlsite.cfg" "$GSDLHOME/$cgibin/gsdlsite.cfg.bak" ;
     180        echo "**** Regenerating $GSDLHOME/$cgibin/gsdlsite.cfg" ;
     181        echo "**** Previous version of file now $GSDLHOME/$cgibin/gsdlsite.cfg.bak" ;
     182    else
     183        relocate=
     184    fi
     185    fi 
    191186   
    192     replace_list="conf/extra/httpd-dav.conf \
     187    if [ "x$relocate" = "xyes" ]; then
     188    apache_home_os="$GSDLHOME/apache-httpd/$GSDLOS$GSDLARCH"
     189   
     190    if test ! -e "$apache_home_os/bin/apachectl.in" ; then
     191        make apache-for-dist
     192    fi
     193   
     194    replace_list="conf/extra/httpd-dav.conf \
    193195            conf/extra/httpd-manual.conf \
    194196            conf/extra/httpd-autoindex.conf \
     
    218220            include/ap_config_layout.h"
    219221
    220     for one_file in apachectl envvars envvars-std ; do
    221     /bin/cp "$apache_home_os/bin/$one_file.in" "$apache_home_os/bin/$one_file"
    222     done
    223    
    224     for one_file in $replace_list ; do
    225     /bin/cp "$apache_home_os/$one_file.in" "$apache_home_os/$one_file"
    226     done
    227    
    228     /bin/cp "$apache_home_os/bin/apr-1-config.in" "$apache_home_os/bin/apr-1-config"
    229    
    230     /bin/cp "$apache_home_os/bin/apu-1-config.in" "$apache_home_os/bin/apu-1-config"
    231    
    232     /bin/cp "$apache_home_os/build/config_vars.mk.in" "$apache_home_os/build/config_vars.mk"
    233 
     222    for one_file in apachectl envvars envvars-std ; do
     223        /bin/cp "$apache_home_os/bin/$one_file.in" "$apache_home_os/bin/$one_file"
     224    done
     225   
     226    for one_file in $replace_list ; do
     227        /bin/cp "$apache_home_os/$one_file.in" "$apache_home_os/$one_file"
     228    done
     229   
     230    /bin/cp "$apache_home_os/bin/apr-1-config.in" "$apache_home_os/bin/apr-1-config"
     231   
     232    /bin/cp "$apache_home_os/bin/apu-1-config.in" "$apache_home_os/bin/apu-1-config"
     233   
     234    /bin/cp "$apache_home_os/build/config_vars.mk.in" "$apache_home_os/build/config_vars.mk"
     235   
    234236# replace template files with active versions. The following will generate a httpd.conf
    235237# file with placeholder strings, all of which we'll replace shortly hereafter.
    236     bash "$apache_home_os/install-bindist.sh" "$apache_home_os"
    237    
    238     log4jprop=$GSDLHOME/lib/java/log4j.properties
    239     sed "s^@gsdl2home@^$GSDLHOME^g" "$log4jprop.in" > "$log4jprop"
    240 
    241     for one_file in gs2-server.app gli.app client-gli.app gems.app ; do
    242     if test -e "$one_file/Contents/document.wflow" ; then
    243         rm -f "$one_file/Contents/document.wflow"
    244     fi
    245     done
    246 
    247     configure-web $1
     238    bash "$apache_home_os/install-bindist.sh" "$apache_home_os"
     239   
     240    log4jprop=$GSDLHOME/lib/java/log4j.properties
     241    sed "s^@gsdl2home@^$GSDLHOME^g" "$log4jprop.in" > "$log4jprop"
     242   
     243    for one_file in gs2-server.app gli.app client-gli.app gems.app ; do
     244        if test -e "$one_file/Contents/document.wflow" ; then
     245        rm -f "$one_file/Contents/document.wflow"
     246        fi
     247    done
     248   
     249    configure-web $1
     250    fi
    248251}
    249252
Note: See TracChangeset for help on using the changeset viewer.