| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | nargs=$# |
|---|
| 5 | args="$*" |
|---|
| 6 | |
|---|
| 7 | # Add to the path variable named by $1 the component $2. $3 must be |
|---|
| 8 | # "append" or "prepend" to indicate where the component is added. |
|---|
| 9 | |
|---|
| 10 | # error message function |
|---|
| 11 | err () { |
|---|
| 12 | echo "`basename $0`: $@" 1>&2 |
|---|
| 13 | exit 1 |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | addpath () { |
|---|
| 17 | eval value=\"\$$1\" |
|---|
| 18 | case "$value" in |
|---|
| 19 | *:$2:*|*:$2|$2:*|$2) |
|---|
| 20 | result="$value" |
|---|
| 21 | ;; |
|---|
| 22 | "") |
|---|
| 23 | result="$2" |
|---|
| 24 | ;; |
|---|
| 25 | *) |
|---|
| 26 | case "$3" in |
|---|
| 27 | p*) |
|---|
| 28 | result="$2:${value}" |
|---|
| 29 | ;; |
|---|
| 30 | *) |
|---|
| 31 | result="${value}:$2" |
|---|
| 32 | ;; |
|---|
| 33 | esac |
|---|
| 34 | esac |
|---|
| 35 | eval $1=$result |
|---|
| 36 | unset result value |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | # convenience routine which appends a string to a path. |
|---|
| 40 | append () { |
|---|
| 41 | addpath "$1" "$2" append |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | # convenience routine which prepends a string to a path. |
|---|
| 45 | prepend () { |
|---|
| 46 | addpath "$1" "$2" prepend |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | case "X${ARBHOME}" in |
|---|
| 51 | X) |
|---|
| 52 | if [ -x /usr/arb/bin/arb ];then |
|---|
| 53 | ARB=/usr/arb/bin/arb |
|---|
| 54 | else |
|---|
| 55 | case "$0" in |
|---|
| 56 | /*) |
|---|
| 57 | ARB="$0";; |
|---|
| 58 | *) |
|---|
| 59 | if ARB=`which $0`; then |
|---|
| 60 | echo $ARB |
|---|
| 61 | else |
|---|
| 62 | ARB=`pwd`/$0 |
|---|
| 63 | fi;; |
|---|
| 64 | esac |
|---|
| 65 | fi |
|---|
| 66 | |
|---|
| 67 | ARBBIN=`dirname $ARB` |
|---|
| 68 | export ARBBIN |
|---|
| 69 | ARBHOME=`dirname $ARBBIN` |
|---|
| 70 | export ARBHOME |
|---|
| 71 | echo "Environment Variable ARBHOME not set" |
|---|
| 72 | echo " set to $ARBHOME";; |
|---|
| 73 | esac |
|---|
| 74 | |
|---|
| 75 | prepend PATH $ARBHOME/bin |
|---|
| 76 | prepend LD_LIBRARY_PATH $ARBHOME/lib |
|---|
| 77 | append LD_LIBRARY_PATH /usr/dt/lib |
|---|
| 78 | append LD_LIBRARY_PATH /usr/openwin/lib |
|---|
| 79 | prepend SHLIB_PATH $ARBHOME/lib |
|---|
| 80 | |
|---|
| 81 | # environment variables that this shell script sets/changes: |
|---|
| 82 | export LD_LIBRARY_PATH MANPATH PATH ARBHOME SHLIB_PATH |
|---|
| 83 | |
|---|
| 84 | # global envs: |
|---|
| 85 | |
|---|
| 86 | export PWD HOME USER |
|---|
| 87 | |
|---|
| 88 | if [ -x $ARBHOME/bin/ghostview ] ; then |
|---|
| 89 | GS_LIB="$ARBHOME/DEPOT/ghostscript" |
|---|
| 90 | export GS_LIB |
|---|
| 91 | fi |
|---|
| 92 | |
|---|
| 93 | if [ "X$ARBMACROHOME" = "X" ] ; then |
|---|
| 94 | ARBMACROHOME="$ARBHOME/lib/macros" |
|---|
| 95 | export ARBMACROHOME |
|---|
| 96 | fi |
|---|
| 97 | |
|---|
| 98 | ARB_PID="$$"; export ARB_PID |
|---|
| 99 | |
|---|
| 100 | if [ ! -d ${HOME}/.arb_prop ] ; then |
|---|
| 101 | echo 'Directory $HOME/.arb_prop not found creating ...' |
|---|
| 102 | mkdir ${HOME}/.arb_prop |
|---|
| 103 | fi |
|---|
| 104 | |
|---|
| 105 | if [ "X$GDE_HELP_DIR" = "X" ] ; then |
|---|
| 106 | GDE_HELP_DIR="$ARBHOME/GDEHELP" |
|---|
| 107 | export GDE_HELP_DIR |
|---|
| 108 | fi |
|---|
| 109 | |
|---|
| 110 | # Default Texteditor/CMDTOOL used by ARB |
|---|
| 111 | . $ARBHOME/lib/config.`uname` |
|---|
| 112 | |
|---|
| 113 | # save LD_LIBRARY_PATH |
|---|
| 114 | ARB_LIBRARY_PATH="${LD_LIBRARY_PATH}" |
|---|
| 115 | export ARB_LIBRARY_PATH |
|---|
| 116 | |
|---|
| 117 | echo "Program ARB will be startet in the background, please wait" |
|---|
| 118 | (arb_ntree $args;arb_clean >/dev/null 2>&1;echo ARB done) & |
|---|
| 119 | |
|---|
| 120 | |
|---|