Changeset 2719 for trunk/gsdl


Ignore:
Timestamp:
2001-08-29T15:17:30+12:00 (23 years ago)
Author:
jrm21
Message:

added some tests to make sure we are sourced, not run. Also check if
we have already been sourced, and added a check for bash on cygwin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/setup.bash

    r2709 r2719  
    1 export GSDLHOME=`pwd`
    2 export GSDLOS=`uname -s | tr A-Z a-z`
    3 if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
    4 then
    5 # they are different => we are running bash under cygwin
    6 GSDLOS=windows
     1# if this file is executed, /bin/sh is used, as we don't start with #!
     2# this should work under ash, bash, zsh, ksh, sh style shells.
     3
     4# make sure we are sourced, and not run
     5
     6if test "$0" != "`echo $0 | sed s/setup\.bash//`" ; then
     7# if $0 contains "setup.bash" we've been run... $0 is shellname if sourced.
     8# One exception is zsh has an option to set it temporarily to the script name
     9  if test -z "$ZSH_NAME" ; then
     10  # we aren't using zsh
     11  gsdl_not_sourced=true
     12  fi
    713fi
    8 export PATH=$PATH:$GSDLHOME/bin/script:$GSDLHOME/bin/$GSDLOS
    9 export MANPATH=$MANPATH:$GSDLHOME/packages/mg/man
    10 echo "Your environment has successfully been set up to run Greenstone"
     14
     15if test -n "$gsdl_not_sourced" ; then
     16  echo "    Error: Make sure you source this script, not execute it. Eg:"
     17  echo "        $ source setup.bash"
     18  echo "    or"
     19  echo "        $ . ./setup.bash"
     20  echo "    not"
     21  echo "        $ ./setup.bash"
     22elif test -n "$GSDLHOME" ; then
     23  echo "Your environment is already set up for Greenstone!"
     24elif test ! -f setup.bash ; then
     25  echo "You must source the script from within the Greenstone home directory"
     26else
     27  export GSDLHOME=`pwd`
     28  export GSDLOS=`uname -s | tr A-Z a-z`
     29  # they for running bash under cygwin
     30  if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
     31  then
     32    GSDLOS=windows
     33  fi
     34  export PATH=$PATH:$GSDLHOME/bin/script:$GSDLHOME/bin/$GSDLOS
     35  export MANPATH=$MANPATH:$GSDLHOME/packages/mg/man
     36  echo "Your environment has successfully been set up to run Greenstone"
     37fi
     38unset gsdl_not_sourced
Note: See TracChangeset for help on using the changeset viewer.