Debian Codegraph @

install/unix/setup

raw symbols SCIP
1 #! /bin/bashscip-shell filesystem . . `/bin/bash`.
2 # .COPYRIGHT: Copyright (c) 1988-2011 European Southern Observatory,
3 # all rights reserved
4 # .TYPE command
5 # .NAME setup.sh
6 # .LANGUAGE shell script
7 # .ENVIRONMENT Unix Systems. Executable under SHELL and C-SHELL
8 # .COMMENTS
9 # Usage: setup
10 # .REMARKS The external variable $MIDASHOME and $MIDVERS must be set
11 #
12 # .AUTHOR Carlos Guirao
13 # .VERSION 3.2 910213 Implementation
14 # .VERSION 3.3 910929 Now also mail address for MIDAS manager.
15 # .VERSION 3.4 911005 IDIDEV is changed without using s/RE/re/number
16 # This feature does not exist for ed-Ultrix
17 # .VERSION 4.1 920119 MID$SYS (31:40) name of editor to use.
18 # .VERSION 4.2 920119 MID$SYS (31:40) by default "vi".
19 # .VERSION 4.3 920121 Using "ex" instead of "ed" (for PC/Linux)
20 # .VERSION 4.4 990324 Checking EDITOR (default ex, otherwise ed)
21 #
22 # 111116 last modif KB
23 #
24 # Check how echo command removes new-line.
25 #
26 cmd=`basenamescip-shell system . . basename. $0`
27 echo=echo
28 if [scip-shell system . . `[`. "$1" != "-a" ]; then
29 if [scip-shell system . . `[`. "`echoscip-shell system . . echo. -n`" = "-n" ] ; then
30 SV_NONL="\c"
31 else
32 echo="echo -n"
33 fi
34 fi
35
36 #
37 # Check if 'ex' editor exists otherwise use 'ed'
38 # "ed" is substituted by "ex" for PC/Linux except in SuSE
39 #
40 EDITOR=ex
41 whichscip-shell system . . which. ex
42 if [scip-shell system . . `[`. $? != 0 ]; then
43 EDITOR=ed
44 fi
45
46 #
47 # First of all, goto the config directory adn
48 # <dirname> & <basename> commands emulated with <sed>
49 # cd `dirname $0`
50 # MIDVERS=`basename $VERSDIR`
51 # MIDASHOME=`dirname $VERSDIR`
52 #
53 if [scip-shell system . . `[`. -z "$MIDASHOME" -o -z "$MIDVERS" ] ; then
54 cd `echoscip-shell system . . echo. $0 | sedscip-shell system . . sed. -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
55 MID_INSTALL=`pwdscip-shell system . . pwd.`
56 VERSDIR=`echoscip-shell system . . echo. $MID_INSTALL | sedscip-shell system . . sed. 's/\/install\/unix$//'`
57 MIDVERS=`echoscip-shell system . . echo. $VERSDIR | sedscip-shell system . . sed. -e 's/^.*\///'`
58 MIDASHOME=`echoscip-shell system . . echo. $VERSDIR | sedscip-shell system . . sed. -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
59 else
60 cd $MIDASHOME/$MIDVERS/install/unix
61 fi
62
63 MID_INSTALL=$MIDASHOME/$MIDVERS/install/unix
64 MID_HOME=$MIDASHOME/$MIDVERS
65
66 #
67 # Reading local variables from local/setup
68 #
69 if [scip-shell system . . `[`. -f $MIDASHOME/$MIDVERS/local/setup ]; then
70 echoscip-shell system . . echo. "Reading your local setup $MIDASHOME/$MIDVERS/local/setup..."
71 echoscip-shell system . . echo. ""
72 . $MIDASHOME/$MIDVERS/local/setup #setting host_os, debugger, ...
73 fi
74
75 #
76 # Checking existence of syskeys.unix
77 #
78 if [scip-shell system . . `[`. ! -f $MIDASHOME/$MIDVERS/monit/syskeys.unix ]; then
79 cd $MIDASHOME/$MIDVERS/monit
80 makescip-shell system . . make. syskeys.unix >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
81 cd $MIDASHOME/$MIDVERS/install/unix
82 fi
83
84 while :
85 do
86 if [scip-shell system . . `[`. -z "$host_os" ]; then
87 $echo "Name of the computer/system. (Max 20 char., e.g. IBM/AIX): " $SV_NONL
88 read host_os
89 if [scip-shell system . . `[`. -z "$host_os" ] ; then
90 continue
91 fi
92 fi
93 host_os=`echoscip-shell system . . echo. $host_os | \
94 sed -e 's/$/ /' \
95 -e 's/^\(....................\).*$/\1/'`
96 echoscip-shell system . . echo. "Name of the computer/system: $host_os"
97 $echo "OK? [yn] (y): " $SV_NONL
98 if [scip-shell system . . `[`. "$1" != "-a" ]; then
99 read answ
100 fi
101 if [scip-shell system . . `[`. -z "$answ" ]; then
102 answ=y
103 fi
104 if [scip-shell system . . `[`. "$answ" = "y" -o "$answ" = "Y" ]; then
105 break
106 fi
107 unset host_os
108 done
109
110
111 # Editor to be used, set by default to vi
112 editor="vi"
113 editor=`echoscip-shell system . . echo. $editor | sedscip-shell system . . sed. -e 's/$/ /' -e 's/^\(.........\).*$/\1/'`
114
115 while :
116 do
117 if [scip-shell system . . `[`. -z "$ps_print" ]; then
118 echoscip-shell system . . echo. "Command to print a PostScript file in a PostScript printer."
119 $echo "(Max 20 char., e.g. lpr -h -P): " $SV_NONL
120 read ps_print
121 if [scip-shell system . . `[`. -z "$ps_print" ] ; then
122 continue
123 fi
124 fi
125 ps_print=`echoscip-shell system . . echo. $ps_print | \
126 sed -e 's/$/ /' \
127 -e 's/^\(....................\).*$/\1/'`
128 echoscip-shell system . . echo. "Command to print a PostScript file: $ps_print"
129 $echo "OK? [yn] (y): " $SV_NONL
130 if [scip-shell system . . `[`. "$1" != "-a" ]; then
131 read answ
132 fi
133 if [scip-shell system . . `[`. -z "$answ" ]; then
134 answ=y
135 fi
136 if [scip-shell system . . `[`. "$answ" = "y" -o "$answ" = "Y" ]; then
137 break
138 fi
139 unset ps_print
140 done
141
142 while :
143 do
144 if [scip-shell system . . `[`. -z "$ascii_print" ]; then
145 echoscip-shell system . . echo. "Command to print an ASCII file in a PostScript printer."
146 $echo "(Max 20 char., e.g. lpr -h -P): " $SV_NONL
147 read ascii_print
148 if [scip-shell system . . `[`. -z "$ascii_print" ] ; then
149 continue
150 fi
151 fi
152 ascii_print=`echoscip-shell system . . echo. $ascii_print | \
153 sed -e 's/$/ /' \
154 -e 's/^\(....................\).*$/\1/'`
155 echoscip-shell system . . echo. "Command to print an ASCII file: $ascii_print"
156 $echo "OK? [yn] (y): " $SV_NONL
157 if [scip-shell system . . `[`. "$1" != "-a" ]; then
158 read answ
159 fi
160 if [scip-shell system . . `[`. -z "$answ" ]; then
161 answ=y
162 fi
163 if [scip-shell system . . `[`. "$answ" = "y" -o "$answ" = "Y" ]; then
164 break
165 fi
166 unset ascii_print
167 done
168
169 while :
170 do
171 echoscip-shell system . . echo. "Email of the MIDAS administrator at your site (problem-report service)"
172 $echo "(Max 40 char., default: [email protected]): " $SV_NONL
173 if [scip-shell system . . `[`. "$1" != "-a" ]; then
174 read mmail
175 fi
176 if [scip-shell system . . `[`. -z "$mmail" ] ; then
177 mmail="[email protected]"
178 fi
179 mmail=`echoscip-shell system . . echo. $mmail | \
180 sed -e 's/$/ /' \
181 -e 's/^\(........................................\).*$/\1/'`
182 echoscip-shell system . . echo. "Email address: $mmail"
183 $echo "OK? [yn] (y): " $SV_NONL
184 if [scip-shell system . . `[`. "$1" != "-a" ]; then
185 read answ
186 fi
187 if [scip-shell system . . `[`. -z "$answ" ]; then
188 answ=y
189 fi
190 if [scip-shell system . . `[`. "$answ" = "y" -o "$answ" = "Y" ]; then
191 break
192 fi
193 unset mmail
194 done
195
196 #echo host_os=$host_os, debugger=$debugger, editor=$editor, mail=$mmail
197
198 $echo "Editing $MIDASHOME/$MIDVERS/monit/syskeys.unix... " $SV_NONL
199
200 $EDITOR $MIDASHOME/$MIDVERS/monit/syskeys.unix <<EOF >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
201 1
202 /^AUX_MODE/
203
204 s/^[^,]*,/2,/
205
206 1
207 /^MID\$SYS/
208
209 i
210 $host_os\$$editor
211 .
212
213 s/^/C /p
214 1
215 /^SYSCOMS/
216
217 s/........................................\(.*\)$/${ps_print}$ascii_print\1/
218
219 1
220 /^MID\$DEBUG/
221
222 s/\$dbx/\$$debugger/
223
224 1
225 /^MID\$MAIL/
226
227 i
228 $mmail
229 .
230
231 s/^/C /p
232 w
233 q
234 EOF
235 echoscip-shell system . . echo. "Done."
236
237 #
238 # Set default MIDASHOME0 and MIDVERS0 to current values
239 #
240 MIDASHOME0=$MIDASHOME
241 MIDVERS0=$MIDVERS
242
243 #
244
245 FILE0=$MIDASHOME/$MIDVERS/system/unix/inmidas
246 FILE1=$MIDASHOME/$MIDVERS/system/unix/helpmidas
247 FILE2=$MIDASHOME/$MIDVERS/system/unix/drs
248
249 if [scip-shell system . . `[`. ! -f $FILE0 ]; then
250 cd $MIDASHOME/$MIDVERS/system/unix
251 makescip-shell system . . make. >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
252 cd $MIDASHOME/$MIDVERS/install/unix
253 fi
254
255 unset answ
256 MIDASHOME0=$MIDASHOME
257 MIDVERS0=$MIDVERS
258 while :
259 do
260 echoscip-shell system . . echo. ""
261 echoscip-shell system . . echo. "Default definitions for <inmidas> script:"
262 echoscip-shell system . . echo. "-------------------------------------------"
263 echoscip-shell system . . echo. "MIDASHOME=$MIDASHOME0"
264 echoscip-shell system . . echo. "MIDVERS=$MIDVERS0"
265 echoscip-shell system . . echo. ""
266 $echo "Do you want to modify these values [yn]? (n): " $SV_NONL
267 if [scip-shell system . . `[`. "$1" != "-a" ]; then
268 read answ
269 fi
270 if [scip-shell system . . `[`. -z "$answ" ]; then
271 break
272 fi
273 echoscip-shell system . . echo. answ="$answ"
274 if [scip-shell system . . `[`. "$answ" = "n" -o "$answ" = "N" ]; then
275 break
276 fi
277 while :
278 do
279 $echo "MIDASHOME: " $SV_NONL
280 read MIDASHOME0
281 if [scip-shell system . . `[`. ! -d $MIDASHOME ]; then
282 echoscip-shell system . . echo. "No such directory: $MIDASHOME"
283 continue
284 else
285 break
286 fi
287 done
288 while :
289 do
290 $echo "MIDVERS: " $SV_NONL
291 read MIDVERS0
292 if [scip-shell system . . `[`. ! -d $MIDASHOME/$MIDVERS ]; then
293 echoscip-shell system . . echo. "No such directory: $MIDASHOME/$MIDVERS"
294 continue
295 else
296 break
297 fi
298 done
299 done
300
301 #
302 # NOTE: This could be done easier with ed, but in UNIX SYSTEM V
303 # ed exits when a pattern is not found.
304 #
305 MIDASHOME_0=`echoscip-shell system . . echo. MIDASHOME0=$MIDASHOME0`
306 MIDVERS_0=`echoscip-shell system . . echo. MIDVERS0=$MIDVERS0`
307 MIDASHOME_0_set="set $MIDASHOME_0"
308 MIDVERS_0_set="set $MIDVERS_0"
309
310 #
311 # IFS: To cancel space as argument separator
312 #
313 IFS=''
314
315 for file in $FILE0 $FILE1 $FILE2
316 do
317 echoscip-shell system . . echo. "Editing $file ..."
318 catscip-shell system . . cat. $file | sedscip-shell system . . sed. \
319 -e 's!^MIDVERS0=.*!'$MIDVERS_0'!' \
320 -e 's!^set MIDVERS0=.*!'$MIDVERS_0_set'!' \
321 -e 's!^MIDASHOME0=.*!'$MIDASHOME_0'!' \
322 -e 's!^set MIDASHOME0=.*!'$MIDASHOME_0_set'!' \
323 > $file.t
324 chmodscip-shell system . . chmod. +xr $file.t
325 mvscip-shell system . . mv. -f $file.t $file
326 done
327 echoscip-shell system . . echo. "Done."
328 echoscip-shell system . . echo. ""
329 echoscip-shell system . . echo. "**********************************************************************"
330 echoscip-shell system . . echo. "Copy the following files to a public directory included in \$PATH"
331 echoscip-shell system . . echo. "(e.g. /usr/local/bin)"
332 echoscip-shell system . . echo. " cp $MIDASHOME/$MIDVERS/system/unix/inmidas /usr/local/bin"
333 echoscip-shell system . . echo. " cp $MIDASHOME/$MIDVERS/system/unix/gomidas /usr/local/bin"
334 echoscip-shell system . . echo. " cp $MIDASHOME/$MIDVERS/system/unix/helpmidas /usr/local/bin"
335 echoscip-shell system . . echo. " cp $MIDASHOME/$MIDVERS/system/unix/drs /usr/local/bin"
336 echoscip-shell system . . echo. ""
337 echoscip-shell system . . echo. "Copy the following man-pages to a directory included in \$MANPATH"
338 echoscip-shell system . . echo. "(e.g. /usr/man/manl)"
339 echoscip-shell system . . echo. " cp $MIDASHOME/$MIDVERS/system/unix/manl/inmidas.l /usr/man/manl"
340 echoscip-shell system . . echo. " cp $MIDASHOME/$MIDVERS/system/unix/manl/gomidas.l /usr/man/manl"
341 echoscip-shell system . . echo. " cp $MIDASHOME/$MIDVERS/system/unix/manl/helpmidas.l /usr/man/manl"
342 echoscip-shell system . . echo. " cp $MIDASHOME/$MIDVERS/system/unix/manl/readline.l /usr/man/manl"
343 echoscip-shell system . . echo. " or modify \$MANPATH to include $MIDASHOME/$MIDVERS/system/unix/manl"
344 echoscip-shell system . . echo. ""
345 echoscip-shell system . . echo. "To run MIDAS, type:"
346 echoscip-shell system . . echo. " inmidas (if you want to run MIDAS defaults)"
347 echoscip-shell system . . echo. " gomidas (to restart the previous MIDAS session)"
348 echoscip-shell system . . echo. " helpmidas (standalone GUI help for MIDAS)"
349 echoscip-shell system . . echo. " drs <midas_command> (execute MIDAS command from Unix command line)"
350 echoscip-shell system . . echo. "**********************************************************************"
351 echoscip-shell system . . echo. "Type any character to continue."
352 if [scip-shell system . . `[`. "$1" != "-a" ]; then
353 read answ
354 fi
355
356 #
357 # Send mail to [email protected]
358 #
359 #cd $MIDASHOME/$MIDVERS/local
360 #uname=`(uname -a) 2>/dev/null`
361 #(echo "MIDAS installed on $uname" | cat - setup make_options | mail [email protected]) >/dev/null 2>&1 &
362 #
363 exit