2
# @(#)helpmidas.sh 19.1 (ESO-IPG) 02/25/03 14:31:59
3
# .COPYRIGHT: Copyright (c) 1988 European Southern Observatory,
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)
15
# .COMMENTS Script to start MIDAS Help. It uses the following environment:
16
# MIDASHOME and MIDVERS variables if they exist, otherwise
18
# It checks arguments if any and exec to $GUI_EXE/XHelp.exe
20
# .REMARKS MIDASHOME0 & MIDVERS0 are set to defaults values by option
21
# "8- MIDAS setup" in the MIDAS "config" script.
23
# .VERSION 1.1 930803: CG. Implementation
24
#**************************************************************************
26
#**************************************************************************
29
# Modify the default values of MIDASHOME0 and MIDVERS0
30
# accordingly to your site.
32
# Environment variables MIDASHOME and MIDVERS overwrite these defaults.
34
# Done automaticaly by option "8- setup MIDAS" in the "config" script.
39
# END of Configure Here
40
#**************************************************************************
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
*) echo "Usage: helpmidas [-h midashome] [-r midvers] "
52
echo "[-d display] [-m mid_work]"
58
# If MIDASHOME variable not defined then set to default.
60
if [ -z "$MIDASHOME" ]; then
61
if [ -z "$MIDASHOME0" ]; then
62
echo "Environment variable MIDASHOME not defined"
63
echo "and no default MIDASHOME0 found in this script. EXIT."
66
MIDASHOME="$MIDASHOME0"; export MIDASHOME
71
# If MIDVERS variable not defined then set to default.
73
if [ -z "$MIDVERS" ]; then
74
if [ -z "$MIDVERS0" ]; then
75
echo "Environment variable MIDVERS not defined"
76
echo "and no default MIDVERS0 found in this script. EXIT."
79
MIDVERS="$MIDVERS0"; export MIDVERS
84
# Check access to directories and files
86
if [ ! -d $MIDASHOME ]; then
87
echo "${MIDASHOME}: not such directory."
88
echo "Call your MIDAS operator. EXIT."
91
if [ ! -d $MIDASHOME/$MIDVERS ]; then
92
echo "$MIDASHOME/${MIDVERS}: not such directory."
93
echo "Call your MIDAS operator. EXIT."
98
# get all the variables (logical names)
100
if [ -f $MIDASHOME/$MIDVERS/monit/midlogs.sh ]; then
101
. $MIDASHOME/$MIDVERS/monit/midlogs.sh
103
echo "$MIDASHOME/$MIDVERS/monit/midlogs.sh not such file."
104
echo "Call your MIDAS operator. EXIT."
109
# if necessary create MIDAS work directory
111
if [ -z "$MID_WORK" ]; then
112
MID_WORK=$HOME/midwork/ ; export MID_WORK
116
# if last char. of MID_WORK != '/' append a '/'
118
if [ `expr $MID_WORK : '.*\(.\)'` != '/' ]; then
119
MID_WORK=$MID_WORK/ ; export MID_WORK
122
if [ ! -d $MID_WORK ]; then
123
mkdir `expr $MID_WORK : '\(.*\).'` #use MID_WORK except last char.
125
echo Could not create directory `expr $MID_WORK : '\(.*\).'`
130
if [ -f $MID_MONIT/syskeys.unix ]; then
131
SYSKEYS=$MID_MONIT/syskeys.unix
132
elif [ -f $MID_MONIT/syskeys.dat ]; then
133
SYSKEYS=$MID_MONIT/syskeys.dat
135
echo "No such file: $MID_MONIT/syskeys.unix or $MID_MONIT/syskeys.dat"
139
mail=`awk -F/ '{ if (found == 1) {print $0; exit } if ($1 == "MID$MAIL") found=1 }' $SYSKEYS`
141
print=`awk -F/ '{ if (found == 1) {print $0; exit } if ($1 == "SYSCOMS") found=1 }' $SYSKEYS | sed -e 's/....................\(....................\).*/\1/'`
143
#echo MIDVERS=$MIDVERS
146
#echo MID_CONTEXT=$MID_CONTEXT
147
#echo MID_WORK=$MID_WORK
148
#echo GUI_EXE=$GUI_EXE
151
# Set PATH for shared libraries
156
if [ -z "$LD_LIBRARY_PATH" ] ; then
157
LD_LIBRARY_PATH=$MIDASHOME/$MIDVERS/lib
159
LD_LIBRARY_PATH=$MIDASHOME/$MIDVERS/lib:$LD_LIBRARY_PATH
161
export LD_LIBRARY_PATH
164
if [ -z "$SHLIB_PATH" ] ; then
165
SHLIB_PATH=$MIDASHOME/$MIDVERS/lib
167
SHLIB_PATH=$MIDASHOME/$MIDVERS/lib:$SHLIB_PATH
176
# run help.exe (94NOV) or XHelp.exe
178
if [ -f $GUI_EXE/help.exe ]; then
179
echo "Preparing the HELP graphic user interface..."
180
$GUI_EXE/help.exe $MIDVERS $mail "$print" $MID_CONTEXT $MID_WORK " " &
181
elif [ -f $GUI_EXE/XHelp.exe ]; then
182
echo "Preparing the XHelp user interface..."
183
$GUI_EXE/XHelp.exe $MIDVERS $mail "$print" $MID_CONTEXT $MID_WORK " " &
185
echo "No such file: $GUI_EXE/XHelp.exe"