[17808] | 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 | gsdllang=en
|
---|
| 4 | # encoding inputs and outputs
|
---|
| 5 | gsdltoenc=""
|
---|
| 6 | gsdlfromenc=""
|
---|
| 7 |
|
---|
| 8 | # see if the shell has any language environment variables set
|
---|
| 9 | # see locale(7) manpage for this ordering.
|
---|
| 10 | if test ! -z "$LC_ALL" ; then
|
---|
| 11 | gsdllang="$LC_ALL"
|
---|
| 12 | elif test ! -z "$LANG"; then
|
---|
| 13 | gsdllang="$LANG"
|
---|
| 14 | fi
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 | # note... all our output strings have the charset hard-coded, but
|
---|
| 18 | # people may be using a different encoding in their terminal. LANG
|
---|
| 19 | # strings look like "en_NZ.UTF-8".
|
---|
| 20 |
|
---|
| 21 | # Determine the requested output encoding
|
---|
| 22 | case $gsdllang in
|
---|
| 23 | *.*)
|
---|
| 24 | gsdltoenc=`echo $gsdllang | sed 's/.*\.//'`
|
---|
| 25 | ;;
|
---|
| 26 | esac
|
---|
| 27 |
|
---|
| 28 | # Our french and spanish strings are currently in iso-8859-1 encoding.
|
---|
| 29 | case $gsdllang in
|
---|
| 30 | fr*|FR*)
|
---|
| 31 | gsdllang=fr
|
---|
| 32 | gsdlfromenc="iso-8859-1"
|
---|
| 33 | ;;
|
---|
| 34 | es*|ES*)
|
---|
| 35 | gsdllang=es
|
---|
| 36 | gsdlfromenc="iso-8859-1"
|
---|
| 37 | ;;
|
---|
| 38 | ru*|RU*)
|
---|
| 39 | gsdllang=ru
|
---|
| 40 | gsdlfromenc="koi8r"
|
---|
| 41 | ;;
|
---|
| 42 | *) # default
|
---|
| 43 | gsdllang=en
|
---|
| 44 | gsdlfromenc="iso-8859-1"
|
---|
| 45 | ;;
|
---|
| 46 | esac
|
---|
| 47 |
|
---|
| 48 | # "iconv" is the program for converting text between encodings.
|
---|
| 49 | gsdliconv=`which iconv 2>/dev/null`
|
---|
| 50 | if test $? -ne 0 || test ! -x "$gsdliconv" || test -z "$gsdlfromenc" || test -z "$gsdltoenc"; then
|
---|
| 51 | # we can't convert encodings from some reason
|
---|
| 52 | gsdliconv="cat"
|
---|
| 53 | else
|
---|
| 54 | # add the encodings
|
---|
| 55 | gsdliconv="$gsdliconv -f $gsdlfromenc -t $gsdltoenc"
|
---|
| 56 | fi
|
---|
| 57 |
|
---|
| 58 | # make sure we are sourced, and not run
|
---|
| 59 |
|
---|
| 60 | if 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
|
---|
| 67 | fi
|
---|
| 68 |
|
---|
| 69 | if test -n "$gsdl_not_sourced" ; then
|
---|
| 70 | case "$gsdllang" in
|
---|
| 71 | "es")
|
---|
| 72 | eval $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
|
---|
| 79 | EOF
|
---|
| 80 | ;;
|
---|
| 81 | "fr")
|
---|
| 82 | eval $gsdliconv <<EOF
|
---|
| 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
|
---|
| 89 | EOF
|
---|
| 90 | ;;
|
---|
| 91 | "ru")
|
---|
| 92 | eval $gsdliconv <<EOF
|
---|
| 93 | ᅵᅵᅵᅵᅵᅵ: ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ ᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵ. ᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵ.
|
---|
| 94 | ᅵᅵᅵᅵᅵᅵᅵᅵ:
|
---|
| 95 | $ source setup.bash
|
---|
| 96 | ᅵᅵᅵ
|
---|
| 97 | $ . ./setup.bash
|
---|
| 98 | ᅵᅵᅵ
|
---|
| 99 | $ ./setup.bash
|
---|
| 100 | EOF
|
---|
| 101 | ;;
|
---|
| 102 | *)
|
---|
| 103 | eval $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
|
---|
| 110 | EOF
|
---|
| 111 | ;;
|
---|
| 112 | esac
|
---|
| 113 | elif test -n "$GSDLHOME" ; then
|
---|
| 114 | case "$gsdllang" in
|
---|
| 115 | "es")
|
---|
| 116 | echo 'ᅵSu ambiente ya estᅵ listo para Greenstone!' | eval $gsdliconv
|
---|
| 117 | ;;
|
---|
| 118 | "fr")
|
---|
| 119 | echo 'Votre environnement est dᅵjᅵ prᅵparᅵ pour Greenstone!' | eval $gsdliconv
|
---|
| 120 | ;;
|
---|
| 121 | "ru")
|
---|
| 122 | echo 'ᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵ Greenstone!' | eval $gsdliconv
|
---|
| 123 | ;;
|
---|
| 124 | *)
|
---|
| 125 | echo 'Your environment is already set up for Greenstone!'
|
---|
| 126 | ;;
|
---|
| 127 | esac
|
---|
| 128 | elif test ! -f setup.bash ; then
|
---|
| 129 | case "$gsdllang" in
|
---|
| 130 | "es")
|
---|
| 131 | eval $gsdliconv <<EOF
|
---|
| 132 | Usted debe compilar el guiï¿œn desde el interior del directorio de inicio
|
---|
| 133 | de Greenstone.
|
---|
| 134 | EOF
|
---|
| 135 | ;;
|
---|
| 136 | "fr")
|
---|
| 137 | echo 'Vous devez trouver la source du script dans le rï¿œpertoire de base de Greenstone' | eval $gsdliconv
|
---|
| 138 | ;;
|
---|
| 139 | "ru")
|
---|
| 140 | eval $gsdliconv <<EOF
|
---|
| 141 | ᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵ ᅵᅵ ᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ Greenstone
|
---|
| 142 | EOF
|
---|
| 143 | ;;
|
---|
| 144 | *)
|
---|
| 145 | echo 'You must source the script from within the Greenstone home directory'
|
---|
| 146 | ;;
|
---|
| 147 | esac
|
---|
| 148 | else
|
---|
| 149 | GSDLHOME=`pwd`
|
---|
| 150 | export GSDLHOME
|
---|
| 151 | GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
---|
| 152 | # check for running bash under cygwin
|
---|
| 153 | if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ;
|
---|
| 154 | then
|
---|
| 155 | GSDLOS=windows
|
---|
| 156 | fi
|
---|
| 157 | export GSDLOS
|
---|
| 158 |
|
---|
| 159 | PATH=$PATH:$GSDLHOME/bin/script:$GSDLHOME/bin/$GSDLOS
|
---|
| 160 | export PATH
|
---|
| 161 |
|
---|
| 162 |
|
---|
| 163 |
|
---|
| 164 | # Override Imagemagick and Ghostscript paths to the bundled applications shipped with greenstone if they exists otherwise use default environment variables.
|
---|
| 165 |
|
---|
| 166 | if test -d $GSDLHOME/bin/$GSDLOS/imagemagick ; then
|
---|
| 167 | PATH="$GSDLHOME/bin/$GSDLOS/imagemagick/bin:$PATH"
|
---|
| 168 | export PATH
|
---|
| 169 |
|
---|
| 170 | MAGICK_HOME="$GSDLHOME/bin/$GSDLOS/imagemagick"
|
---|
| 171 | export MAGICK_HOME
|
---|
| 172 |
|
---|
| 173 | if test "$GSDLOS" = "linux" ; then
|
---|
| 174 | LD_LIBRARY_PATH="$GSDLHOME/bin/$GSDLOS/imagemagick/lib:$LD_LIBRARY_PATH"
|
---|
| 175 | export LD_LIBRARY_PATH
|
---|
| 176 |
|
---|
| 177 | elif test "$GSDLOS" = "darwin" ; then
|
---|
| 178 | DYLD_LIBRARY_PATH="$GSDLHOME/bin/$GSDLOS/imagemagick/lib:$DYLD_LIBRARY_PATH"
|
---|
| 179 | export DYLD_LIBRARY_PATH
|
---|
| 180 | fi
|
---|
| 181 | fi
|
---|
| 182 |
|
---|
| 183 |
|
---|
| 184 | # 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
|
---|
| 185 | # for Windows please see setup.bat
|
---|
| 186 | if test -d $GSDLHOME/bin/$GSDLOS/ghostscript ; then
|
---|
| 187 | PATH="$GSDLHOME/bin/$GSDLOS/ghostscript/bin":"$PATH"
|
---|
| 188 | export PATH
|
---|
| 189 |
|
---|
| 190 | GS_LIB="$GSDLHOME/bin/$GSDLOS/ghostscript/share/ghostscript/8.63/lib"
|
---|
| 191 | export GS_LIB
|
---|
| 192 |
|
---|
| 193 | GS_FONTPATH="$GSDLHOME/bin/$GSDLOS/ghostscript/share/ghostscript/8.63/Resource/Font"
|
---|
| 194 | export GS_FONTPATH
|
---|
| 195 | fi
|
---|
| 196 |
|
---|
| 197 |
|
---|
| 198 |
|
---|
| 199 | MANPATH=$MANPATH:$GSDLHOME/packages/mg/man
|
---|
| 200 | export MANPATH
|
---|
| 201 | case "$gsdllang" in
|
---|
| 202 | "es")
|
---|
| 203 | echo 'Su ambiente ha sido configurado para correr los programas Greenstone.' | eval $gsdliconv
|
---|
| 204 | ;;
|
---|
| 205 | "fr")
|
---|
| 206 | echo 'Votre environnement a ᅵtᅵ configuᅵre avec succᅵs pour exᅵcuter Greenstone' | eval $gsdliconv
|
---|
| 207 | ;;
|
---|
| 208 | "ru")
|
---|
| 209 | eval $gsdliconv <<EOF
|
---|
| 210 | ᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵ, ᅵᅵᅵᅵᅵ ᅵᅵᅵᅵᅵᅵᅵᅵᅵᅵ Greenstone
|
---|
| 211 | EOF
|
---|
| 212 | ;;
|
---|
| 213 | *)
|
---|
| 214 | echo 'Your environment has successfully been set up to run Greenstone'
|
---|
| 215 | ;;
|
---|
| 216 | esac
|
---|
| 217 | fi
|
---|
| 218 | unset gsdl_not_sourced
|
---|
| 219 | unset gsdliconv
|
---|
| 220 | unset gsdlfromenc
|
---|
| 221 | unset gsdltoenc
|
---|
| 222 |
|
---|
| 223 | if test -e ext ; then
|
---|
| 224 | for gsdl_ext in ext/* ; do
|
---|
| 225 | cd $gsdl_ext > /dev/null
|
---|
| 226 | if test -e setup.bash ; then
|
---|
| 227 | . ./setup.bash
|
---|
| 228 | fi
|
---|
| 229 | cd ../..
|
---|
| 230 | done
|
---|
| 231 | fi
|
---|
| 232 |
|
---|
| 233 | if test -e local ; then
|
---|
| 234 | PATH=$GSDLHOME/local/bin:$PATH
|
---|
| 235 | export PATH
|
---|
| 236 | LD_LIBRARY_PATH=$GSDLHOME/local/lib:$LD_LIBRARY_PATH
|
---|
| 237 | export LD_LIBRARY_PATH
|
---|
| 238 | fi
|
---|
| 239 |
|
---|
| 240 |
|
---|