source: gsdl/trunk/setup.bash@ 18488

Last change on this file since 18488 was 18488, checked in by davidb, 15 years ago

Looks for apache-httpd directory (top level) and updates environment variables according to put it in path

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
RevLine 
[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.
[6774]3gsdllang=""
[6892]4# encoding inputs and outputs
5gsdltoenc=""
6gsdlfromenc=""
[2719]7
[6774]8# see if the shell has any language environment variables set
9# see locale(7) manpage for this ordering.
10if test ! -z "$LC_ALL" ; then
[6892]11 gsdllang="$LC_ALL"
[6774]12elif test ! -z "$LANG"; then
[6892]13 gsdllang="$LANG"
[6774]14fi
15
[6892]16
[6774]17# note... all our output strings have the charset hard-coded, but
18# people may be using a different encoding in their terminal. LANG
[6892]19# strings look like "en_NZ.UTF-8".
[6774]20
[6892]21# Determine the requested output encoding
22case $gsdllang in
23 *.*)
24 gsdltoenc=`echo $gsdllang | sed 's/.*\.//'`
25 ;;
26esac
27
[6774]28# Our french and spanish strings are currently in iso-8859-1 encoding.
29case $gsdllang in
30 fr*|FR*)
31 gsdllang=fr
[6892]32 gsdlfromenc="iso-8859-1"
[6774]33 ;;
34 es*|ES*)
35 gsdllang=es
[6892]36 gsdlfromenc="iso-8859-1"
[6774]37 ;;
38 ru*|RU*)
39 gsdllang=ru
[6892]40 gsdlfromenc="koi8r"
[6774]41 ;;
42 *) # default
43 gsdllang=en
[6892]44 gsdlfromenc="iso-8859-1"
[6774]45 ;;
46esac
47
[6892]48# "iconv" is the program for converting text between encodings.
49gsdliconv=`which iconv 2>/dev/null`
[8734]50if test $? -ne 0 || test ! -x "$gsdliconv" || test -z "$gsdlfromenc" || test -z "$gsdltoenc"; then
[6892]51# we can't convert encodings from some reason
52 gsdliconv="cat"
53else
54# add the encodings
55 gsdliconv="$gsdliconv -f $gsdlfromenc -t $gsdltoenc"
56fi
57
[2719]58# make sure we are sourced, and not run
59
60if test "$0" != "`echo $0 | sed s/setup\.bash//`" ; then
61# if $0 contains "setup.bash" we've been run... $0 is shellname if sourced.
62# One exception is zsh has an option to set it temporarily to the script name
63 if test -z "$ZSH_NAME" ; then
64 # we aren't using zsh
65 gsdl_not_sourced=true
66 fi
[2709]67fi
[2719]68
69if test -n "$gsdl_not_sourced" ; then
[6774]70 case "$gsdllang" in
71 "es")
[6892]72eval $gsdliconv <<EOF
73 Error: Asegúrese de compilar este guión, no de ejecutarlo. P. ej.:
74 $ source setup.bash
75 o
76 $ . ./setup.bash
77 no
78 $ ./setup.bash
79EOF
[6774]80 ;;
81 "fr")
[6892]82eval $gsdliconv <<EOF
[7029]83 Erreur: Assurez-vous de "sourcer" le script, plutôt que de l'exécuter. Ex:
84 $ source setup.bash
85 ou
86 $ . ./setup.bash
87 pas
88 $ ./setup.bash
[6892]89EOF
[6774]90 ;;
91 "ru")
[6892]92eval $gsdliconv <<EOF
93 ïÛÉÂËÁ: õÄÏÓÔÏ×ÅÒØÔÅÓØ × ÉÓÔÏÞÎÉËÅ ÜÔÏÇÏ ÓËÒÉÐÔÁ. îÅ ÉÓÐÏÌÎÑÊÔÅ ÅÇÏ.
94 îÁÐÒÉÍÅÒ:
95 $ source setup.bash
96 ÉÌÉ
97 $ . ./setup.bash
98 ÎÅÔ
99 $ ./setup.bash
100EOF
[6774]101 ;;
102 *)
[6892]103eval $gsdliconv <<EOF
104 Error: Make sure you source this script, not execute it. Eg:
105 $ source setup.bash
106 or
107 $ . ./setup.bash
108 not
109 $ ./setup.bash
110EOF
[6774]111 ;;
112 esac
[2719]113elif test -n "$GSDLHOME" ; then
[6774]114 case "$gsdllang" in
115 "es")
[6892]116 echo '¡Su ambiente ya está listo para Greenstone!' | eval $gsdliconv
[6774]117 ;;
118 "fr")
[6892]119 echo 'Votre environnement est déjà préparé pour Greenstone!' | eval $gsdliconv
[6774]120 ;;
121 "ru")
[6892]122 echo '÷ÁÛÅ ÏËÒÕÖÅÎÉÅ ÕÖÅ ÎÁÓÔÒÏÅÎÏ ÄÌÑ Greenstone!' | eval $gsdliconv
[6774]123 ;;
124 *)
[6820]125 echo 'Your environment is already set up for Greenstone!'
[6774]126 ;;
127 esac
[2719]128elif test ! -f setup.bash ; then
[6774]129 case "$gsdllang" in
130 "es")
[6892]131eval $gsdliconv <<EOF
132Usted debe compilar el guión desde el interior del directorio de inicio
133de Greenstone.
134EOF
[6774]135 ;;
136 "fr")
[6892]137echo 'Vous devez trouver la source du script dans le répertoire de base de Greenstone' | eval $gsdliconv
[6774]138 ;;
139 "ru")
[6892]140eval $gsdliconv <<EOF
141÷ÁÍ ÎÅÏÂÈÏÄÉÍ ÉÓÔÏÞÎÉË ÓËÒÉÐÔÁ ÉÚ ÂÁÚÏ×ÏÊ ÄÉÒÅËÔÏÒÉÉ Greenstone
142EOF
[6774]143 ;;
144 *)
[6820]145 echo 'You must source the script from within the Greenstone home directory'
[6774]146 ;;
147 esac
[2719]148else
[2906]149 GSDLHOME=`pwd`
150 export GSDLHOME
[2943]151 GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
[2749]152 # check for running bash under cygwin
[2719]153 if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
154 then
155 GSDLOS=windows
156 fi
[2906]157 export GSDLOS
158
[18198]159 PATH=$GSDLHOME/bin/$GSDLOS/wv/bin:$GSDLHOME/bin/script:$GSDLHOME/bin/$GSDLOS:$PATH
[2906]160 export PATH
[18188]161
162 # Allow wvWare binary to find the required libraries.
163 if test "$GSDLOS" = "linux" ; then
[18192]164 LD_LIBRARY_PATH="$GSDLHOME/bin/$GSDLOS/wv/lib:$LD_LIBRARY_PATH"
[18188]165 export LD_LIBRARY_PATH
166
167 elif test "$GSDLOS" = "darwin" ; then
[18192]168 DYLD_LIBRARY_PATH="$GSDLHOME/bin/$GSDLOS/wv/lib:$DYLD_LIBRARY_PATH"
[18188]169 export DYLD_LIBRARY_PATH
170 fi
[17667]171
172
173
174 # Override Imagemagick and Ghostscript paths to the bundled applications shipped with greenstone if they exists otherwise use default environment variables.
175
[17673]176if test -d $GSDLHOME/bin/$GSDLOS/imagemagick ; then
177 PATH="$GSDLHOME/bin/$GSDLOS/imagemagick/bin:$PATH"
178 export PATH
[17667]179
[17673]180 MAGICK_HOME="$GSDLHOME/bin/$GSDLOS/imagemagick"
181 export MAGICK_HOME
[17667]182
[17673]183 if test "$GSDLOS" = "linux" ; then
[17667]184 LD_LIBRARY_PATH="$GSDLHOME/bin/$GSDLOS/imagemagick/lib:$LD_LIBRARY_PATH"
185 export LD_LIBRARY_PATH
186
187 elif test "$GSDLOS" = "darwin" ; then
[17673]188 DYLD_LIBRARY_PATH="$GSDLHOME/bin/$GSDLOS/imagemagick/lib:$DYLD_LIBRARY_PATH"
[17667]189 export DYLD_LIBRARY_PATH
[17673]190 fi
[17667]191fi
192
[17673]193
194 # Note: Ghostscript is only bundled with Greenstone on Mac and Windows, not on Linux. The code below should be used only for the Darwin platform
195 # for Windows please see setup.bat
[17667]196if test -d $GSDLHOME/bin/$GSDLOS/ghostscript ; then
[17673]197 PATH="$GSDLHOME/bin/$GSDLOS/ghostscript/bin":"$PATH"
198 export PATH
[17667]199
[17673]200 GS_LIB="$GSDLHOME/bin/$GSDLOS/ghostscript/share/ghostscript/8.63/lib"
201 export GS_LIB
[17667]202
[17673]203 GS_FONTPATH="$GSDLHOME/bin/$GSDLOS/ghostscript/share/ghostscript/8.63/Resource/Font"
204 export GS_FONTPATH
[17667]205fi
206
207
208
[2906]209 MANPATH=$MANPATH:$GSDLHOME/packages/mg/man
210 export MANPATH
[6774]211 case "$gsdllang" in
212 "es")
[6892]213 echo 'Su ambiente ha sido configurado para correr los programas Greenstone.' | eval $gsdliconv
[6774]214 ;;
215 "fr")
[6892]216 echo 'Votre environnement a été configuére avec succès pour exécuter Greenstone' | eval $gsdliconv
[6774]217 ;;
218 "ru")
[6892]219eval $gsdliconv <<EOF
220÷ÁÛÅ ÏËÒÕÖÅÎÉÅ ÂÙÌÏ ÕÓÐÅÛÎÏ ÎÁÓÔÒÏÅÎÏ, ÞÔÏÂÙ ÕÓÔÁÎÏ×ÉÔØ Greenstone
221EOF
[6774]222 ;;
223 *)
[6820]224 echo 'Your environment has successfully been set up to run Greenstone'
[6774]225 ;;
226 esac
[2719]227fi
228unset gsdl_not_sourced
[6892]229unset gsdliconv
230unset gsdlfromenc
231unset gsdltoenc
[14980]232
[17667]233if test -e ext ; then
[14980]234 for gsdl_ext in ext/* ; do
[16795]235 cd $gsdl_ext > /dev/null
[17667]236 if test -e setup.bash ; then
237 . ./setup.bash
[14980]238 fi
239 cd ../..
240 done
241fi
242
[18488]243if test -e apache-httpd ; then
244 echo "Adding in executable path for apache-httpd"
245 PATH=$GSDLHOME/apache-httpd/$GSDLOS/bin:$PATH
246 export PATH
247fi
248
249
[17667]250if test -e local ; then
[18488]251 if test -e local/setup.bash ; then
252 echo "Sourcing local/setup.bash"
253 cd local ; source setup.bash ; cd ..
254 fi
255
[17667]256 PATH=$GSDLHOME/local/bin:$PATH
257 export PATH
258 LD_LIBRARY_PATH=$GSDLHOME/local/lib:$LD_LIBRARY_PATH
259 export LD_LIBRARY_PATH
[14980]260fi
261
262
[18488]263
Note: See TracBrowser for help on using the repository browser.