File: install3.sh

package info (click to toggle)
eso-midas 15.09pl1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 146,960 kB
  • ctags: 55,836
  • sloc: ansic: 360,661; sh: 7,357; makefile: 6,229; pascal: 535; perl: 40; awk: 36; sed: 14
file content (154 lines) | stat: -rw-r--r-- 4,219 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#! /bin/bash
# .COPYRIGHT: Copyright (c) 2011 European Southern Observatory,
#                                         all rights reserved
# .TYPE           command
# .NAME           install3.sh
# .LANGUAGE       shell script
# .ENVIRONMENT    Unix Systems. Executable under SHELL and C-SHELL
# .COMMENTS       Installation procedure of the MIDAS system starting from
#                 scratch.
#                 Usage: install system [options]
#
# .AUTHOR         Klaus Banse
# .VERSION 
# 110825	creation
# 111206	last modif


#*************** building dummy NAG library *********************

# the install3 script is called from install1 with one parameter
# par1   = manual (to use an edited make_options file),
# or     = -a (via  autoconfig)
# or no parameter at all
 
cd $MID_HOME/system/ext
make 
if [ $? !=  0 ]; then
   echo "Error building esoext."
   exit 1
fi
#
cd $MID_HOME/libsrc/nag
rm -f ../../lib/libnag.a

make all
if [ $? !=  0 ]; then
   echo "Error creating dummy NAG library."
   exit 1
else
   continue
fi

#**************************************************************


cd $MID_INSTALL

echo ""
echo "MIDAS INSTALLATION PROCEDURE"
echo "============================"
echo "MIDASHOME: $MIDASHOME"
echo "MIDVERS:   $MIDVERS"

if [ $1 = "manual" ]; then
   echo "Your own MAKE_OPTIONS after checks and/or editing:"
else
   echo "Your final MAKE_OPTIONS after all checks:"
fi

echo "<$MID_HOME/local/make_options>"

awk -F# '{if ($1 != "") {printf "\t  %s\n",$1} }' $MID_HOME/local/make_options
echo ""

echo "Do you want to check the OS library [yn]? (y): " $SV_NONL
unset answ
if [ "$1" != "-a" ]; then    
  read answ
fi
if [ -z "$answ" ]; then
    answ=y
fi
if [ "$answ" != "y" -a "$answ" != "Y" ]
then
    continue
else
    cd $MID_HOME/libsrc/os/unix
    rm -f $MID_HOME/lib/libos.a
    make clean_exec
    make clean
    make all
    make testos.exe
    if [ $? != 0 ]; then
	echo ""
	echo " **********************************************"
	echo " *               ATTENTION                    *"
	echo " * There was a severe error in your <oslib.a> *"
	echo " * that should be corrected before continuing *"
	echo " * with the MIDAS installation.               *"
	echo " *                                            *"
	echo " * Go to $MID_HOME/libsrc/os/unix "
	echo " * and type by hand:                          *"
	echo " *                                            *"
        echo " *     make clean_exec                        *"
        echo " *     make clean                             *"
        echo " *     make all                               *"
        echo " *     make testos.exe                        *"
	echo " *                                            *"
        echo " * The sequence above should be executed      *"
        echo " * without any error (Warnings are tolerated) *"
        echo " * MIDAS installation will be aborted !!      *"
        echo " *                                            *"
        echo " * For help contact ESO's Midas support:      *"
        echo " * midas@eso.org                              *"
	echo " **********************************************"
        echo ""
	$echo "Type return to exit: " $SV_NONL
	read return
	exit 1
    fi
fi

echo ""
echo "WARNING: MIDAS installation will delete all dependent files."
echo "         It will run in background and the output will be sent to"
echo "         the file <$MID_HOME/tmp/install.$$>"
echo ""
echo "Do you want to continue [yn]? (y): " $SV_NONL
unset answ
if [ "$1" != "-a" ]; then 
  read answ
fi
if [ -z "$answ" ]; then
    answ=y
fi
if [ "$answ" != "y" -a "$answ" != "Y" ]
then
    echo "Bye"
    exit 0
fi

#
# if $MID_HOME/tmp does not exist then create it
#
if [ ! -d $MID_HOME/tmp ]; then
    mkdir $MID_HOME/tmp
fi

# do we have the 'time' command?
if [ $CMND_YES = 2 ] ; then
   /bin/bash $MID_INSTALL/install -i > $MID_HOME/tmp/install.$$ 2>&1 &
else
   time /bin/bash $MID_INSTALL/install -i > $MID_HOME/tmp/install.$$ 2>&1 &
fi

echo "Running install in background"
echo "Results are coming in $MID_HOME/tmp/install.$$"
if [ "$1" = "-a" ]; then 
  echo "Waiting for MIDAS installation to finish..."  $SV_NONL
  wait
  echo "Finished."
  echo ""
fi
exit 0