Debian Codegraph @

system/unix/helpmidas.sh

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2 # @(#)helpmidas.sh 19.1 (ESO-IPG) 02/25/03 14:31:59
3 # .COPYRIGHT: Copyright (c) 1988 European Southern Observatory,
4 #
5 # .TYPE command
6 # .NAME helpmidas
7 # .LANGUAGE Bourne-shell script
8 # .ENVIRONMENT Unix Systems. Executable under any SHELL.
9 # .USAGE helpmidas [-h midashome] [-r midvers] [-d display] [-m mid_work]
10 # display: X server for display and graphical windows.
11 # midashome: Home directory for MIDAS. (default: MIDASHOME0)
12 # midvers: Version of MIDAS. (default: MIDVERS0)
13 # mid_work: MIDAS startup directory (default: $HOME/mid_work)
14 #
15 # .COMMENTS Script to start MIDAS Help. It uses the following environment:
16 # MIDASHOME and MIDVERS variables if they exist, otherwise
17 # takes defaults.
18 # It checks arguments if any and exec to $GUI_EXE/XHelp.exe
19 #
20 # .REMARKS MIDASHOME0 & MIDVERS0 are set to defaults values by option
21 # "8- MIDAS setup" in the MIDAS "config" script.
22 #
23 # .VERSION 1.1 930803: CG. Implementation
24 #**************************************************************************
25
26 #**************************************************************************
27 # Configure Here:
28 # ---------------
29 # Modify the default values of MIDASHOME0 and MIDVERS0
30 # accordingly to your site.
31 #
32 # Environment variables MIDASHOME and MIDVERS overwrite these defaults.
33 #
34 # Done automaticaly by option "8- setup MIDAS" in the "config" script.
35 #
36 MIDASHOME0=/midasscip-shell filesystem . . `/midas`.
37 MIDVERS0=95NOV
38 #
39 # END of Configure Here
40 #**************************************************************************
41
42 # Check for options:
43 #
44 while [scip-shell system . . `[`. -n "$1" ]
45 do
46 case $1 in
47 -h) MIDASHOME=$2; export MIDASHOME; shift; shift ;;
48 -r) MIDVERS=$2; export MIDVERS; shift; shift ;;
49 -d) DISPLAY=$2; export DISPLAY; shift; shift ;;
50 -m) MID_WORK=$2; export MID_WORK; shift; shift ;;
51 *) echoscip-shell system . . echo. "Usage: helpmidas [-h midashome] [-r midvers] "
52 echoscip-shell system . . echo. "[-d display] [-m mid_work]"
53 exit 1 ;;
54 esac
55 done
56
57 #
58 # If MIDASHOME variable not defined then set to default.
59 #
60 if [scip-shell system . . `[`. -z "$MIDASHOME" ]; then
61 if [scip-shell system . . `[`. -z "$MIDASHOME0" ]; then
62 echoscip-shell system . . echo. "Environment variable MIDASHOME not defined"
63 echoscip-shell system . . echo. "and no default MIDASHOME0 found in this script. EXIT."
64 exit 1
65 else
66 MIDASHOME="$MIDASHOME0"; export MIDASHOME
67 fi
68 fi
69
70 #
71 # If MIDVERS variable not defined then set to default.
72 #
73 if [scip-shell system . . `[`. -z "$MIDVERS" ]; then
74 if [scip-shell system . . `[`. -z "$MIDVERS0" ]; then
75 echoscip-shell system . . echo. "Environment variable MIDVERS not defined"
76 echoscip-shell system . . echo. "and no default MIDVERS0 found in this script. EXIT."
77 exit 1
78 else
79 MIDVERS="$MIDVERS0"; export MIDVERS
80 fi
81 fi
82
83 #
84 # Check access to directories and files
85 #
86 if [scip-shell system . . `[`. ! -d $MIDASHOME ]; then
87 echoscip-shell system . . echo. "${MIDASHOME}: not such directory."
88 echoscip-shell system . . echo. "Call your MIDAS operator. EXIT."
89 exit 1
90 fi
91 if [scip-shell system . . `[`. ! -d $MIDASHOME/$MIDVERS ]; then
92 echoscip-shell system . . echo. "$MIDASHOME/${MIDVERS}: not such directory."
93 echoscip-shell system . . echo. "Call your MIDAS operator. EXIT."
94 exit 1
95 fi
96
97 #
98 # get all the variables (logical names)
99 #
100 if [scip-shell system . . `[`. -f $MIDASHOME/$MIDVERS/monit/midlogs.sh ]; then
101 . $MIDASHOME/$MIDVERS/monit/midlogs.sh
102 else
103 echoscip-shell system . . echo. "$MIDASHOME/$MIDVERS/monit/midlogs.sh not such file."
104 echoscip-shell system . . echo. "Call your MIDAS operator. EXIT."
105 exit 1
106 fi
107
108 #
109 # if necessary create MIDAS work directory
110 #
111 if [scip-shell system . . `[`. -z "$MID_WORK" ]; then
112 MID_WORK=$HOME/midwork/ ; export MID_WORK
113 fi
114
115 #
116 # if last char. of MID_WORK != '/' append a '/'
117 #
118 if [scip-shell system . . `[`. `exprscip-shell system . . expr. $MID_WORK : '.*\(.\)'` != '/scip-shell filesystem . . `/`.' ]; then
119 MID_WORK=$MID_WORK/ ; export MID_WORK
120 fi
121
122 if [scip-shell system . . `[`. ! -d $MID_WORK ]; then
123 mkdirscip-shell system . . mkdir. `exprscip-shell system . . expr. $MID_WORK : '\(.*\).'` #use MID_WORK except last char.
124 if [scip-shell system . . `[`. $? != 0 ]; then
125 echoscip-shell system . . echo. Could not create directory `exprscip-shell system . . expr. $MID_WORK : '\(.*\).'`
126 exit 1
127 fi
128 fi
129
130 if [scip-shell system . . `[`. -f $MID_MONIT/syskeys.unix ]; then
131 SYSKEYS=$MID_MONIT/syskeys.unix
132 elif [scip-shell system . . `[`. -f $MID_MONIT/syskeys.dat ]; then
133 SYSKEYS=$MID_MONIT/syskeys.dat
134 else
135 echoscip-shell system . . echo. "No such file: $MID_MONIT/syskeys.unix or $MID_MONIT/syskeys.dat"
136 exit 1
137 fi
138
139 mail=`awkscip-shell system . . awk. -F/ '{ if (found == 1) {print $0; exit } if ($1 == "MID$MAIL") found=1 }' $SYSKEYS`
140
141 print=`awkscip-shell system . . awk. -F/ '{ if (found == 1) {print $0; exit } if ($1 == "SYSCOMS") found=1 }' $SYSKEYS | sedscip-shell system . . sed. -e 's/....................\(....................\).*/\1/'`
142
143 #echo MIDVERS=$MIDVERS
144 #echo mail=$mail
145 #echo print=$print
146 #echo MID_CONTEXT=$MID_CONTEXT
147 #echo MID_WORK=$MID_WORK
148 #echo GUI_EXE=$GUI_EXE
149
150 #
151 # Set PATH for shared libraries
152 #
153 os=`unamescip-shell system . . uname.`
154 case "$os" in
155 "SunOS"|"Linux")
156 if [scip-shell system . . `[`. -z "$LD_LIBRARY_PATH" ] ; then
157 LD_LIBRARY_PATH=$MIDASHOME/$MIDVERS/lib
158 else
159 LD_LIBRARY_PATH=$MIDASHOME/$MIDVERS/lib:$LD_LIBRARY_PATH
160 fi
161 export LD_LIBRARY_PATH
162 ;;
163 "HP-UX")
164 if [scip-shell system . . `[`. -z "$SHLIB_PATH" ] ; then
165 SHLIB_PATH=$MIDASHOME/$MIDVERS/lib
166 else
167 SHLIB_PATH=$MIDASHOME/$MIDVERS/lib:$SHLIB_PATH
168 fi
169 export SHLIB_PATH
170 ;;
171 *)
172 ;;
173 esac
174
175 #
176 # run help.exe (94NOV) or XHelp.exe
177 #
178 if [scip-shell system . . `[`. -f $GUI_EXE/help.exe ]; then
179 echoscip-shell system . . echo. "Preparing the HELP graphic user interface..."
180 $GUI_EXE/help.exe $MIDVERS $mail "$print" $MID_CONTEXT $MID_WORK " " &
181 elif [scip-shell system . . `[`. -f $GUI_EXE/XHelp.exe ]; then
182 echoscip-shell system . . echo. "Preparing the XHelp user interface..."
183 $GUI_EXE/XHelp.exe $MIDVERS $mail "$print" $MID_CONTEXT $MID_WORK " " &
184 else
185 echoscip-shell system . . echo. "No such file: $GUI_EXE/XHelp.exe"
186 exit 1
187 fi
188
189 exit 0