Debian Codegraph @

install/unix/preinstall

raw symbols SCIP
1 #! /bin/bashscip-shell filesystem . . `/bin/bash`.
2 # .TYPE command
3 # .NAME preinstall.sh
4 # .LANGUAGE shell script
5 # .ENVIRONMENT Unix Systems. Executable under Bourne shell
6 # .COMMENTS
7 # Usage: preinstall
8 #
9 # The preinstall command will :
10 #
11 # a) Copy files from:
12 #
13 # $MID_INSTALL/install/unix/systems/<system>
14 # to
15 # $MID_HOME/local
16 #
17 #
18 # .AUTHOR Carlos Guirao
19 # .VERSION 1.1 881023: Implementation
20 # .VERSION 1.3 910424: Removing first argument
21 # .VERSION 2.1 910725: Much easier.
22 # .VERSION 2.2 910917: Much easier yet.
23 # .VERSION 3.2 930727: Using output of uname command.
24 # .VERSION 3.3 021028: Using -a argument for all packages
25 #
26 # 120420 last modif
27
28 echo=echo
29 if [scip-shell system . . `[`. "$1" != "-a" ]; then
30 if [scip-shell system . . `[`. "`echoscip-shell system . . echo. -n`" = "-n" ] ; then
31 SV_NONL="\c"
32 else
33 echo="echo -n"
34 fi
35 fi
36
37 #
38 # First of all, goto the config directory
39 # <dirname> & <basename> commands emulated with <sed>
40 #
41 if [scip-shell system . . `[`. -z "$MIDASHOME" -o -z "$MIDVERS" ] ; then
42 cd `echoscip-shell system . . echo. $0 | sedscip-shell system . . sed. -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
43 MID_INSTALL=`pwdscip-shell system . . pwd.`
44 VERSDIR=`echoscip-shell system . . echo. $MID_INSTALL | sedscip-shell system . . sed. 's/\/install\/unix$//'`
45 MIDVERS=`echoscip-shell system . . echo. $VERSDIR | sedscip-shell system . . sed. -e 's/^.*\///'`
46 MIDASHOME=`echoscip-shell system . . echo. $VERSDIR | sedscip-shell system . . sed. -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
47 else
48 cd $MIDASHOME/$MIDVERS/install/unix
49 fi
50
51 MID_INSTALL=$MIDASHOME/$MIDVERS/install/unix
52 MID_HOME=$MIDASHOME/$MIDVERS
53
54 if [scip-shell system . . `[`. ! -d $MID_HOME/local ]; then
55 mkdirscip-shell system . . mkdir. $MID_HOME/local
56 fi
57
58 if [scip-shell system . . `[`. ! -d $MID_HOME/pipeline ]; then
59 mkdirscip-shell system . . mkdir. $MID_HOME/pipeline
60 chmodscip-shell system . . chmod. 775 $MID_HOME/pipeline
61 fi
62
63 if [scip-shell system . . `[`. -f $MID_HOME/local/default.mk ]; then
64 rmscip-shell system . . rm. -f $MID_HOME/local/default.mk~
65 mvscip-shell system . . mv. $MID_HOME/local/default.mk $MID_HOME/local/default.mk~
66 fi
67
68 if [scip-shell system . . `[`. -f $MID_HOME/local/preinstall ]; then
69 mvscip-shell system . . mv. $MID_HOME/local/preinstall $MID_HOME/local/preinstall~
70 fi
71
72 while :
73 do
74 echoscip-shell system . . echo. ""
75 echoscip-shell system . . echo. "Your current definitions:"
76 echoscip-shell system . . echo. "------------------------"
77 echoscip-shell system . . echo. "MIDASHOME=$MIDASHOME"
78 echoscip-shell system . . echo. "MIDVERS=$MIDVERS"
79 echoscip-shell system . . echo. ""
80 $echo "Do you want to modify these definitions [yn]? (n): " $SV_NONL
81 if [scip-shell system . . `[`. "$1" != "-a" ]; then
82 read answ
83 fi
84 if [scip-shell system . . `[`. -z "$answ" ]; then
85 break
86 fi
87 if [scip-shell system . . `[`. "$answ" = "n" -o "$answ" = "N" ]; then
88 break
89 fi
90 while :
91 do
92 $echo "MIDASHOME: " $SV_NONL
93 read MIDASHOME
94 if [scip-shell system . . `[`. ! -d $MIDASHOME ]; then
95 echoscip-shell system . . echo. "No such directory: $MIDASHOME"
96 continue
97 else
98 break
99 fi
100 done
101 while :
102 do
103 $echo "MIDVERS: " $SV_NONL
104 read MIDVERS
105 if [scip-shell system . . `[`. ! -d $MIDASHOME/$MIDVERS ]; then
106 echoscip-shell system . . echo. "No such directory: $MIDASHOME/$MIDVERS"
107 continue
108 else
109 break
110 fi
111 done
112 done
113
114 (echoscip-shell system . . echo. "MIDASHOME=$MIDASHOME"; echoscip-shell system . . echo. "MIDVERS=$MIDVERS" ) | catscip-shell system . . cat. - default_mk \
115 > $MIDASHOME/$MIDVERS/local/default.mk
116 echoscip-shell system . . echo. "File $MIDASHOME/$MIDVERS/local/default.mk created."
117
118 cd systems
119 uname=`(unamescip-shell system . . uname.) | sedscip-shell system . . sed. 's/\//-/g' 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
120 unode=`(unamescip-shell system . . uname. -n) 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
121 urels=`(unamescip-shell system . . uname. -r) 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
122 machine=`(unamescip-shell system . . uname. -m) 2>/dev/nullscip-shell filesystem . . `/dev/null`.`
123
124 if [scip-shell system . . `[`. -d "Debian" -a -f "/etc/debian_versionscip-shell filesystem . . `/etc/debian_version`." ]; then
125 system="Debian"
126
127 elif [scip-shell system . . `[`. "$uname" = "Darwin" ]; then
128 system="Darwin"
129
130 elif [scip-shell system . . `[`. "$machine" = "x86_64" ]; then
131 system="Linux_AMD64"
132
133 elif [scip-shell system . . `[`. -d "${uname}_$urels" ]; then
134 system="${uname}_$urels"
135
136 elif [scip-shell system . . `[`. -d "${uname}_$machine" ]; then
137 system="${uname}_$machine"
138
139 elif [scip-shell system . . `[`. -d "$uname" ]; then
140 system="$uname"
141
142 elif [scip-shell system . . `[`. -d "$unode" ]; then
143 system="$unode"
144
145 else
146 unamescip-shell system . . uname. -o 2>/dev/nullscip-shell filesystem . . `/dev/null`. #not all systems support -o option
147 exitstat=$?
148 if [scip-shell system . . `[`. $exitstat = 0 ]; then
149 temp=`unamescip-shell system . . uname. -o`
150 if [scip-shell system . . `[`. -d "$temp" ]; then
151 system="$temp"
152 fi
153 fi
154 fi
155
156 if [scip-shell system . . `[`. -z "$system" ]; then
157 echoscip-shell system . . echo. ""
158 while :
159 do
160 echoscip-shell system . . echo. "Select your system (or q to QUIT) :"
161 echoscip-shell system . . echo. ""
162 for i in `lsscip-shell system . . ls.`
163 do
164 if [scip-shell system . . `[`. -d $i ]
165 then
166 echoscip-shell system . . echo. " $i"
167 fi
168 done
169 $echo "System: " $SV_NONL
170 read system
171 if [scip-shell system . . `[`. "$system" = "q" -o "$system" = "Q" ]; then
172 exit 0
173 fi
174 if [scip-shell system . . `[`. ! -d "$system" ]; then
175 echoscip-shell system . . echo. "No such directory: $system"
176 else
177 break
178 fi
179 done
180 else
181 echoscip-shell system . . echo. system chosen: $system
182 fi
183
184 echoscip-shell system . . echo. ""
185 echoscip-shell system . . echo. "All files from the <systems/$system> directory will be copied"
186 echoscip-shell system . . echo. "into your <$MID_HOME/local> directory"
187 $echo "Do you want to continue [yn]? (y): " $SV_NONL
188 if [scip-shell system . . `[`. "$1" != "-a" ]; then
189 read answ
190 fi
191 if [scip-shell system . . `[`. -z "$answ" ]; then
192 answ=y
193 fi
194 if [scip-shell system . . `[`. "$answ" = "n" -o "$answ" = "N" ]; then
195 exit 0
196 fi
197
198 #
199 # Choose libsrc/ftoc according to $system.
200 #
201 rmscip-shell system . . rm. -rf $MIDASHOME/$MIDVERS/libsrc/ftoc
202 lnscip-shell system . . ln. -s $MIDASHOME/$MIDVERS/libsrc/ftoc-new $MIDASHOME/$MIDVERS/libsrc/ftoc
203
204 #
205 # Using the script copy instead of cpio, which not always exists.
206
207 cd $system
208
209 # Option prune does not exist in Ultrix. Anaway SCCS is never included in tape
210 #find . ! \( -name "SCCS" -prune \) -print -exec ../../copy {} \;
211 #find . -print -exec ../../copy {} \;
212 # CG. For some obscure reasons "-print" has to be at the end on IBM6000
213
214 findscip-shell system . . find. . -exec ../../copy {} \; -print
215
216 if [scip-shell system . . `[`. -f "$MID_HOME/local/README" ] ; then
217 catscip-shell system . . cat. $MID_HOME/local/README
218 $echo "Type <RETURN> to continue...." $SV_NONL
219 if [scip-shell system . . `[`. "$1" != "-a" ]; then
220 read key
221 fi
222 fi
223
224 #
225 # CG 15.02.2017 Edit make_options with g77 only if g77 exists
226 #
227 whichscip-shell system . . which. g77 >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
228 if [scip-shell system . . `[`. $? -eq 0 ] ; then
229 if [scip-shell system . . `[`. ! -f $MID_HOME/local/make_options ]; then
230 touchscip-shell system . . touch. $MID_HOME/local/make_options
231 else
232 G77_F2C_PATH=`g77 -print-libgcc-file-name`
233 G77_F2C_PATH=`dirnamescip-shell system . . dirname. $G77_F2C_PATH`
234 echoscip-shell system . . echo. "F2C_LIBS=-L${G77_F2C_PATH} -lg2c" >> $MID_HOME/local/make_options
235 fi
236 fi
237
238 #
239 # CG 02.05.2011 Edit make_options with gfortran only if gfortran exists
240 #
241 whichscip-shell system . . which. gfortran >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
242 if [scip-shell system . . `[`. $? -eq 0 ] ; then
243 if [scip-shell system . . `[`. ! -f $MID_HOME/local/make_options ]; then
244 touchscip-shell system . . touch. $MID_HOME/local/make_options
245 else
246 gccversion=`$MID_INSTALL/getvers`
247 if [scip-shell system . . `[`. "$gccversion" = "gfortran" ] ; then
248 sedscip-shell system . . sed. -e 's/g77/gfortran/' $MID_HOME/local/make_options > $MID_INSTALL/maky
249 mvscip-shell system . . mv. $MID_INSTALL/maky $MID_HOME/local/make_options
250 fi
251 fi
252 fi
253
254 echoscip-shell system . . echo. ""
255 echoscip-shell system . . echo. "Your MAKE_OPTIONS after pre-install:"
256 echoscip-shell system . . echo. " <$MID_HOME/local/make_options>"
257 awkscip-shell system . . awk. -F# '{if ($1 != "") {printf "\t %s\n",$1} }' $MID_HOME/local/make_options
258
259 echoscip-shell system . . echo. ""
260 echoscip-shell system . . echo. "Preinstallation of MIDAS completed."
261 $echo "Type <RETURN> to continue...." $SV_NONL
262 if [scip-shell system . . `[`. "$1" != "-a" ]; then
263 read key
264 fi
265 #
266 # Check if there is a preinstall in the local directory
267 #
268 if [scip-shell system . . `[`. -f "$MID_HOME/local/preinstall" ] ; then
269 /bin/bashscip-shell filesystem . . `/bin/bash`. $MID_HOME/local/preinstall
270 fi
271
272 exit