~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to system/unix/setmidas.sh

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# @(#)setmidas.sh       19.1 (ESO-IPG) 02/25/03 14:32:00
 
3
# .COPYRIGHT: Copyright (c) 1988 European Southern Observatory,
 
4
#
 
5
# .TYPE         command
 
6
# .NAME         setmidas.csh
 
7
# .LANGUAGE     Bourne-shell script
 
8
# .ENVIRONMENT  Unix Systems. Executable ONLY under "sh" or "bash" with the
 
9
#               command "."
 
10
# .USAGE        . <path_name>/setmidas.sh
 
11
#               It can be simplified with an environment definition:
 
12
#               setmidas=". <path_name>/setmidas.sh"
 
13
#               and executed as $setmidas.
 
14
# .COMMENTS     Interface to the MIDAS environment. It sets the variables
 
15
#               MIDASHOME, MIDVERS, MIDOPTION & MIDWORK for the next script 
 
16
#               "inmidas".
 
17
#
 
18
# .REMARKS      This file helps users to chose between several releases of 
 
19
#               MIDAS. It is not necessary if you have only one release of
 
20
#               MIDAS installed.
 
21
#
 
22
# .REMARKS      MIDASHOME0 & MIDVERS0 are set to defaults values by option 
 
23
#               "8- MIDAS setup" in the MIDAS "config" script.
 
24
#
 
25
# .VERSION 1.1  910221: CG. Implementation
 
26
# .VERSION 2.1  930706: CG. Adding options
 
27
#-------------------------------------------------------------------------
 
28
 
 
29
#**************************************************************************
 
30
# Configure Here: 
 
31
# ---------------
 
32
# Modify the values of MIDVERS? and MIDASHOME? accordingly to your site. 
 
33
# MIDVERS0 and MIDASHOME0 represents the default release of MIDAS.
 
34
#
 
35
# Other releases of MIDAS can be invoked from here by setting MIDVERS[123]
 
36
#
 
37
# MIDVERS0: Release of MIDAS by default. Cumpulsory.
 
38
#
 
39
MIDVERS0=test
 
40
MIDASHOME0=/auto/home/ns2b/midas
 
41
#
 
42
# Other MIDAS releases here. Set them in comments if you do not use them
 
43
#
 
44
#MIDVERS1=
 
45
#MIDASHOME1=/midas
 
46
#
 
47
#MIDVERS2=
 
48
#MIDASHOME2=/midas
 
49
#
 
50
#MIDVERS3=
 
51
#MIDASHOME3=/midas
 
52
#
 
53
# END of Configure Here
 
54
#**************************************************************************
 
55
export MIDASHOME MIDVERS MIDOPTION MID_WORK
 
56
 
 
57
#
 
58
# Check echo command
 
59
#
 
60
necho=echo
 
61
if [ "`echo -n `" = "-n" ]; then
 
62
  SV_NONL="\c"
 
63
else
 
64
  necho="echo -n"
 
65
fi
 
66
 
 
67
#
 
68
# Check MIDVERS0 variable is defined.
 
69
#
 
70
if [ -z "$MIDVERS0" ]; then
 
71
        echo "MIDVERS0: Undefined variable."
 
72
        echo "File <setmidas.sh> must contain this definition."
 
73
        echo "Call your MIDAS operator. EXIT."
 
74
        shift >/dev/null 2>&1   # Equivalent to exit
 
75
fi
 
76
 
 
77
#
 
78
# Check MIDASHOME0 variable is defined.
 
79
#
 
80
if [ -z "$MIDASHOME0" ]; then
 
81
        echo "MIDASHOME0: Undefined variable."
 
82
        echo "File <setmidas.sh> must contain this definition."
 
83
        echo "Call your MIDAS operator. EXIT."
 
84
        shift >/dev/null 2>&1   # Equivalent to exit
 
85
fi
 
86
 
 
87
#
 
88
# Here comes output-text
 
89
#
 
90
VERS_AVAIL="Versions of MIDAS available: $MIDVERS0 $MIDVERS1 $MIDVERS2 $MIDVERS3"
 
91
ENTER_VERS="Enter MIDAS version (default="
 
92
OPT_AVAIL="MIDAS option: PARALLEL, NOPARALLEL"
 
93
ENTER_OPT="Enter MIDAS option (default="
 
94
DEF_WORK="Default MIDAS startup directory= "
 
95
ENTER_WORK="Enter MIDAS startup directory: "
 
96
 
 
97
#
 
98
# If MIDVERS variable not defined then set to default.
 
99
#
 
100
if [ -z "$MIDVERS" ]; then
 
101
   MIDVERS=$MIDVERS0
 
102
fi
 
103
 
 
104
#
 
105
# Check MIDAS versions:
 
106
# If none of them then set to default.
 
107
#
 
108
case  "$MIDVERS" in
 
109
"$MIDVERS0")
 
110
   MIDVERS=$MIDVERS0
 
111
   MIDASHOME=$MIDASHOME0
 
112
   ;; 
 
113
"$MIDVERS1")
 
114
   MIDVERS=$MIDVERS1
 
115
   MIDASHOME=$MIDASHOME1
 
116
   ;; 
 
117
"$MIDVERS2")
 
118
   MIDVERS=$MIDVERS2
 
119
   MIDASHOME=$MIDASHOME2
 
120
   ;; 
 
121
"$MIDVERS3")
 
122
   MIDVERS=$MIDVERS3
 
123
   MIDASHOME=$MIDASHOME3
 
124
   ;;
 
125
*)
 
126
   MIDVERS=$MIDVERS0
 
127
   MIDASHOME=$MIDASHOME0
 
128
   ;;
 
129
esac
 
130
 
 
131
#
 
132
# Check for another MIDVERS
 
133
#
 
134
while :
 
135
do
 
136
  echo ""
 
137
  echo $VERS_AVAIL
 
138
  $necho ${ENTER_VERS}${MIDVERS}"): " $SV_NONL
 
139
  read NEWMIDVERS
 
140
 
 
141
  case "$NEWMIDVERS" in
 
142
  '')   
 
143
     ;;
 
144
  "$MIDVERS0")
 
145
     MIDVERS=$MIDVERS0
 
146
     MIDASHOME=$MIDASHOME0
 
147
     ;;
 
148
  "$MIDVERS1")
 
149
     MIDVERS=$MIDVERS1
 
150
     MIDASHOME=$MIDASHOME1
 
151
     ;;
 
152
  "$MIDVERS2")
 
153
     MIDVERS=$MIDVERS2
 
154
     MIDASHOME=$MIDASHOME2
 
155
     ;;
 
156
  "$MIDVERS3")
 
157
     MIDVERS=$MIDVERS3
 
158
     MIDASHOME=$MIDASHOME3
 
159
     ;;
 
160
  *)
 
161
     continue
 
162
     ;;
 
163
  esac
 
164
  break
 
165
done
 
166
 
 
167
#
 
168
# MIDOPTION set to default
 
169
#
 
170
if [ "$MIDOPTION" != "PARALLEL" ]; then
 
171
   MIDOPTION=NOPARALLEL
 
172
fi
 
173
 
 
174
while :
 
175
do
 
176
  echo ""
 
177
  echo $OPT_AVAIL
 
178
  $necho ${ENTER_OPT}${MIDOPTION}"): " $SV_NONL
 
179
  read NEWMIDOPT
 
180
 
 
181
  case "$NEWMIDOPT" in
 
182
  P*|p*)
 
183
    MIDOPTION=PARALLEL
 
184
    ;;
 
185
  N*|n*)
 
186
    MIDOPTION=NOPARALLEL
 
187
    ;;
 
188
  '')
 
189
    ;;
 
190
  *)
 
191
    continue
 
192
    ;;
 
193
  esac
 
194
  break
 
195
done
 
196
 
 
197
#
 
198
# MID_WORK set to default
 
199
#
 
200
if [ -z "$MID_WORK" ]; then
 
201
  MID_WORK=$HOME/midwork
 
202
fi
 
203
 
 
204
echo ""
 
205
echo ${DEF_WORK}${MID_WORK}
 
206
$necho ${ENTER_WORK} $SV_NONL
 
207
read NEWMIDOPT
 
208
case "$NEWMIDOPT" in
 
209
'')
 
210
  ;;
 
211
*)
 
212
  MID_WORK=$NEWMIDOPT
 
213
  ;;
 
214
esac