Last change
on this file since 2748 was 2719, checked in by jrm21, 23 years ago |
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.
|
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.3 KB
|
Rev | Line | |
---|
[2719] | 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 |
|
---|
| 6 | if 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
|
---|
[2709] | 13 | fi
|
---|
[2719] | 14 |
|
---|
| 15 | if 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"
|
---|
| 22 | elif test -n "$GSDLHOME" ; then
|
---|
| 23 | echo "Your environment is already set up for Greenstone!"
|
---|
| 24 | elif test ! -f setup.bash ; then
|
---|
| 25 | echo "You must source the script from within the Greenstone home directory"
|
---|
| 26 | else
|
---|
| 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"
|
---|
| 37 | fi
|
---|
| 38 | unset gsdl_not_sourced
|
---|
Note:
See
TracBrowser
for help on using the repository browser.