Commit | Line | Data |
---|---|---|
5898af2c DHW |
1 | #!/bin/sh |
2 | ### Copyright (C) 1991, 1992, Cygnus Support | |
3 | ### All Rights Reserved. | |
4 | ||
5 | ### This really needs to nestle up snuggly to the Release notes. If you change | |
6 | ### this script, please be sure the release notes get coordinated too. | |
7 | ||
8 | set -e | |
9 | ||
10 | ### this is our version number. | |
11 | VERSION=cygnus-sol2-||RELNO|| | |
12 | ||
13 | ### this is the default installation repository. We use this to test whether or | |
14 | ### not GCC_EXEC_PREFIX should be set when doing "Install test comp-tools". | |
15 | #INSTALLDIR_DEFAULT=/giga/rich/tmp/installdir | |
16 | INSTALLDIR_REAL=/opt | |
17 | INSTALLDIR_DEFAULT=${INSTALLDIR_REAL} | |
18 | ### this is where we install into. (useful for testing). | |
19 | INSTALLDIR=${INSTALLDIR_DEFAULT} | |
20 | ||
21 | ### where to write the log files | |
22 | LOGDIR=${INSTALLDIR}/${VERSION} | |
23 | ||
24 | ### who to call in bad situations | |
25 | HOTLINE="the Cygnus Support Hotline at +1 415 322 7836" | |
26 | ||
27 | ### what the release doc is called and a few sections thereof | |
28 | NOTES="the Installation Notes" | |
29 | CHANGING_PATHS="\"Changing the Paths\"" | |
30 | NO_ACCESS="\"No Access to ${INSTALLDIR}\?\"" | |
31 | MIGHT_WRONG="\"Some Things that Might go Wrong\"" | |
32 | WHY_FIXINCLUDES="Why Convert System Header Files\?" | |
33 | ANOTHER_TAPE="\"Steps to install with another machine\'s tape drive\"" | |
34 | ||
35 | ### for debugging | |
36 | #PATH=/bin:/usr/bin ; export PATH | |
37 | ||
38 | ### default the tape device | |
39 | case "${TAPE}" in | |
40 | "") TAPE=||DEVdflt|| | |
41 | ;; | |
42 | *) | |
43 | ;; | |
44 | esac # ${TAPE} | |
45 | ||
46 | ### clear and/or initialize some variables | |
47 | ARCH= | |
48 | TOOLS= | |
49 | FTPRELEASE=no | |
50 | ||
51 | REMOVE=no | |
52 | EXTRACT=no | |
53 | FIXINCLUDES=no | |
54 | TESTINSTALLATION=no | |
55 | ||
56 | INSTALLHOST=default | |
57 | ERROR= | |
58 | ||
59 | ### where the binaries are in the release | |
60 | #EXECDIR=${VERSION}/H-${INSTALLHOST} | |
61 | EXECDIR=${VERSION} | |
62 | ||
63 | ### some tool defaults | |
64 | ### perhaps these should be hard coded to absolute paths instead? | |
65 | TAR=tar | |
66 | TARKEYS="xvvopf -" | |
67 | SED=sed | |
68 | MT=mt | |
69 | ||
70 | ### trigger words on the command line are: | |
71 | ### bin, src | |
72 | ### emacs, comp-tools | |
73 | ### -tape=/dev/device | |
74 | ### -installdir=/foo | |
75 | ### extract, fixincludes, test-installation, remove | |
76 | ||
77 | for arg in $* ; do | |
78 | case "${arg}" in | |
79 | ### options | |
80 | -tape=* | --tape=* | --tap=* | --ta=* | --t=*) | |
81 | TAPE=`echo ${arg} | ${SED} 's/-*t[a-z]*=//'` | |
82 | ;; | |
83 | ||
84 | -installdir=* | --installdir=* | --installdi=* | --installd=* | --install=* | --instal=* | --insta=* | --inst=* | --ins=* | --in=* | --i=*) | |
85 | INSTALLDIR=`echo ${arg} | ${SED} 's/-*i[a-z]*=//'` | |
86 | # we will make it an absolute path shortly. | |
87 | ;; | |
88 | ||
89 | ### actions | |
90 | *remove* | rm | -rm | --rm) ACTIONS="${ACTIONS} rm" ;; | |
91 | *extract*) ACTIONS="${ACTIONS} extract" ;; | |
92 | *fix*) ACTIONS="${ACTIONS} fix" ;; | |
93 | *test*) ACTIONS="${ACTIONS} test" ;; | |
94 | ### hosts | |
95 | *src* | *sour*) ARCH="${ARCH} src" ;; | |
96 | *bin*) ARCH="${ARCH} bin" ;; | |
97 | ||
98 | ### packages | |
99 | *emacs*) TOOLS="${TOOLS} emacs" ;; | |
100 | *comp*) TOOLS="${TOOLS} comp" ;; | |
101 | *help*) ERROR=true ;; | |
102 | *) | |
103 | echo '***' I do not understand the option \"${arg}\". | |
104 | ERROR=true | |
105 | ;; | |
106 | esac # ${arg} | |
107 | done # arg in $* | |
108 | ||
109 | ### | |
110 | ### | |
111 | ### check for a myriad of sins | |
112 | ### | |
113 | ### | |
114 | ||
115 | if [ ! -d "${INSTALLDIR}" ] ; then | |
116 | echo '*** ' Can not cd to \"${INSTALLDIR}\" because it does not exist. | |
117 | echo '*** ' Try creating it with \"mkdir ${INSTALLDIR}\" and then try running Install again. | |
118 | exit 1 | |
119 | else | |
120 | if (cd "${INSTALLDIR}") ; then | |
121 | true | |
122 | else | |
123 | echo '*** ' Can not cd to \"${INSTALLDIR}\" because I do not have execute permission. | |
124 | ls -lad ${INSTALLDIR} | |
125 | echo '*** ' Please fix this and then try running Install again. | |
126 | exit 1 | |
127 | fi # ! cd ${INSTALLDIR} | |
128 | fi # ! -d ${INSTALLDIR} | |
129 | ||
130 | # Make INSTALLDIR absolute (parts below might need it that way). | |
131 | # FIXME, do they really? | |
132 | # FIXME, handle pwd failure from upper dir permission | |
133 | INSTALLDIR=`cd ${INSTALLDIR} ; pwd` | |
134 | LOGDIR=${INSTALLDIR}/${VERSION} | |
135 | ||
136 | case "${ERROR}" in | |
137 | "") | |
138 | ### default tools | |
139 | case "${TOOLS}" in | |
140 | "") TOOLS="||BUNDLE||" ;; | |
141 | *) ;; | |
142 | esac # ${TOOLS} | |
143 | ||
144 | INSTALLHOST= | |
145 | ||
146 | ### decide where we are: try arch first. | |
147 | if (arch) > /dev/null 2>&1 ; then | |
148 | MAYBE=`arch` | |
149 | else | |
150 | true | |
151 | fi # (arch) | |
152 | ||
153 | case "${MAYBE}" in | |
154 | sun3) INSTALLHOST=${MAYBE} | |
155 | ;; | |
156 | *) | |
157 | ### next try uname | |
158 | if (uname > /dev/null) 2>&1 ; then | |
159 | UNAME=`echo \`uname -s\`\`uname -m\`\`uname -r\`` | |
160 | else | |
161 | UNAME="machine without a uname command (type of machine unknown)" | |
162 | fi # (uname) | |
163 | ||
164 | ### map into names we recognize | |
165 | case "${UNAME}" in | |
166 | AIX*) | |
167 | INSTALLHOST=rs6000 | |
168 | MT=tctl | |
169 | ;; | |
170 | ULTRIXRISC) INSTALLHOST=decstation ;; | |
171 | SunOSsun4*5*) INSTALLHOST=sparc-sun-solaris2 ;; | |
172 | SunOSsun4*) INSTALLHOST=sun4 ;; | |
173 | SunOSsun3*) INSTALLHOST=sun3 ;; | |
174 | IRIX*) INSTALLHOST=iris4 ;; | |
175 | *) INSTALLHOST=unknown ;; | |
176 | esac # ${UNAME} | |
177 | ;; | |
178 | esac # ${MAYBE} | |
179 | ||
180 | ### default arch | |
181 | case "${ARCH}" in | |
182 | "") ARCH="bin src" ;; | |
183 | *) ;; | |
184 | esac # ${ARCH} | |
185 | ||
186 | ### default actions | |
187 | ||
188 | case "${ACTIONS}" in | |
189 | "") | |
190 | case "${FTPRELEASE}" in | |
191 | "yes") ACTIONS="test" ;; | |
192 | "no" ) ACTIONS="extract test" ;; | |
193 | esac # ${FTPRELEASE} | |
194 | ||
195 | ||
196 | ### fixincludes only if comp-tools | |
197 | for tool in ${TOOLS} ; do | |
198 | case ${tool} in | |
199 | comp) | |
200 | if echo ${ARCH} | grep bin > /dev/null 2>&1 ; then | |
201 | ACTIONS="${ACTIONS} fix" | |
202 | fi | |
203 | ;; | |
204 | *) ;; | |
205 | esac # ${TOOLS} | |
206 | done # for tool in ${TOOLS} | |
207 | ;; | |
208 | *) ;; | |
209 | esac # ${ACTIONS} | |
210 | ;; | |
211 | *) ;; | |
212 | esac # ${ERROR} | |
213 | ||
214 | case "${ERROR}" in | |
215 | "") | |
216 | ### if binaries are not intended for this machine | |
217 | case "${INSTALLHOST}" in | |
218 | "||HOSTstr||") ### binaries are intended for this machine | |
219 | for action in ${ACTIONS} ; do | |
220 | case ${action} in | |
221 | test) | |
222 | for tool in ${TOOLS} ; do | |
223 | OURWD=`(cd ${INSTALLDIR}; pwd) 2>/dev/null` | |
224 | DEFAULTWD=`(cd ${INSTALLDIR_REAL}; pwd) 2>/dev/null` | |
225 | case ${tool} in | |
226 | comp) | |
227 | case "${OURWD}" in | |
228 | "${DEFAULTWD}") ;; | |
229 | *) | |
230 | echo '***' If you want to use the compilation tools in an alternate | |
231 | echo '*** ' directory, GCC_EXEC_PREFIX must be set. You probably | |
232 | echo '*** ' want to set it with: | |
233 | echo GCC_EXEC_PREFIX=${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/ ; export GCC_EXEC_PREFIX | |
234 | GCC_EXEC_PREFIX=${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/ ; export GCC_EXEC_PREFIX | |
235 | echo '*** ' This is what I will use for the installation tests. | |
236 | # skip C++ msg on Solaris | |
237 | case "${INSTALLHOST}" in | |
238 | sparc-sun-solaris2) ;; | |
239 | *) | |
240 | echo '*** ' And for g++ I will use the options: | |
241 | echo '*** ' -I${INSTALLDIR}/${EXECDIR}/lib/g++-include | |
242 | echo '*** ' -L${INSTALLDIR}/${EXECDIR}/lib | |
243 | ;; | |
244 | esac # ${INSTALLHOST} | |
245 | echo '*** ' For further help, please refer to ${CHANGING_PATHS} | |
246 | echo '*** ' in ${NOTES}. | |
247 | ||
248 | GPLUSOPTIONS="-I${INSTALLDIR}/${EXECDIR}/lib/g++-include -L${INSTALLDIR}/${EXECDIR}/lib" | |
249 | ;; | |
250 | esac # ${INSTALLDIR} | |
251 | ;; | |
252 | emacs) | |
253 | case "${OURWD}" in | |
254 | "${DEFAULTWD}") ;; | |
255 | *) | |
256 | echo '***' I cannot test Emacs. | |
257 | echo '*** ' The provided Emacs binary can only run from the default | |
258 | echo '*** ' installation directory. If you wish to run emacs, please | |
259 | echo '*** ' refer to ${CHANGING_PATHS} in ${NOTES}. | |
260 | exit 1 | |
261 | ;; | |
262 | esac # ${INSTALLDIR} | |
263 | ;; | |
264 | *) true ;; | |
265 | esac # ${tool} | |
266 | done # for tool in ${TOOLS} | |
267 | ;; | |
268 | *) true ;; | |
269 | esac # ${action} | |
270 | done # for action in ${ACTIONS} | |
271 | ;; | |
272 | ||
273 | *) | |
274 | for action in ${ACTIONS} ; do | |
275 | case ${action} in | |
276 | rm | extract) true ;; | |
277 | fix) | |
278 | if echo ${TOOLS} | grep comp > /dev/null ; then | |
279 | NOTFIXED="fixincludes" | |
280 | if echo ${ACTIONS} | grep test > /dev/null ; then | |
281 | JOINER=" or " | |
282 | else | |
283 | true | |
284 | fi # echo ${ACTIONS} | |
285 | else | |
286 | # echo '***' If you only install Emacs you do not need to run fixincludes. | |
287 | # ERROR=true | |
288 | true | |
289 | fi # echo ${TOOLS} | |
290 | ;; | |
291 | test) NOTTESTED="the installation tests" ;; | |
292 | esac # ${action} | |
293 | done # for action in ${ACTIONS} | |
294 | ;; | |
295 | esac # ${INSTALLHOST} | |
296 | ;; | |
297 | *) ;; | |
298 | esac # ${ERROR} | |
299 | ||
300 | if [ -n "${NOTFIXED}" -o -n "${NOTTESTED}" ] ; then | |
301 | case "${INSTALLHOST}" in | |
302 | "||HOSTstr||") ;; | |
303 | *) | |
304 | echo '*** ' This machine appears to be a \"${INSTALLHOST}\". | |
305 | echo '*** ' You may still run \"$0 -extract ...\" on this machine and then | |
306 | echo '*** ' run the other steps on the machine on which you wish to install. | |
307 | echo '*** ' You will need to do these steps separately. | |
308 | echo '*** ' For more information, please refer to | |
309 | echo '*** ' ${ANOTHER_TAPE} in ${NOTES}. | |
310 | ERROR=true | |
311 | ;; | |
312 | esac # ${INSTALLHOST} | |
313 | fi # [ -n ${NOTFIXED -o -n ${NOTTESTED} ] | |
314 | ||
315 | ### if we can't read the tape drive... | |
316 | popdir=`pwd` | |
317 | ||
318 | if [ ! -d "${LOGDIR}" ] ; then | |
319 | if mkdir ${LOGDIR}; then | |
320 | true | |
321 | else | |
322 | echo '*** ' Can not write logs to \"${LOGDIR}\" because it does not exist. | |
323 | echo '*** ' Try creating it with \"mkdir ${LOGDIR}\" and then try running Install again. | |
324 | exit 1 | |
325 | fi | |
326 | else | |
327 | if [ ! -w "${LOGDIR}" ] ; then | |
328 | echo '*** ' Can not write logs to \"${LOGDIR}\" because I do not have write permission. | |
329 | ls -lad ${LOGDIR} | |
330 | echo '*** ' Please fix this and then try running Install again. | |
331 | exit 1 | |
332 | fi # ! -r ${LOGDIR} | |
333 | fi # ! -d ${LOGDIR} | |
334 | ||
335 | ||
336 | cd ${INSTALLDIR} | |
337 | ||
338 | ### There is a window here that I don't know how to handle gracefully from | |
339 | ### shell. If the directory DID exist and WAS executable but dissappeared | |
340 | ### before we could cd into it, we're kinda hosed. If you get a call about | |
341 | ### this, make sure the directory exists, is readable, is executable, is the | |
342 | ### either the default installation directory or the -installdir=directory | |
343 | ### given on the command line. Then ask them to just try again. A few times. | |
344 | ### If you get the same error every time, we've got a very strange bug. I | |
345 | ### can't help you. | |
346 | ||
347 | if [ "$?" != "0" ] ; then | |
348 | echo '***' Cannot cd to \"${INSTALLDIR}\". This is a problem. | |
349 | echo '*** ' For further help, please refer to | |
350 | echo '*** ' ${NO_ACCESS} in ${NOTES} or call | |
351 | echo '*** ' ${HOTLINE} | |
352 | exit 1 | |
353 | fi | |
354 | ||
355 | if echo ${ACTIONS} | grep extract > /dev/null ; then | |
356 | if [ -z "${ERROR}" -a ! -r "${TAPE}" ] ; then | |
357 | ### try checking for a relative tape path | |
358 | if [ -r ${popdir}/${TAPE} ] ; then | |
359 | TAPE=${popdir}/${TAPE} | |
360 | echo '***' Using TAPE device \"${TAPE}\". | |
361 | else | |
362 | echo '***' Can not read from TAPE device, \"${TAPE}\". | |
363 | cd ${popdir} ; ls -lasd ${TAPE} | |
364 | echo '*** ' Try using \"./Install -tape=/dev/something ...\" to name your tape | |
365 | echo '*** ' drive or refer to ${MIGHT_WRONG} in | |
366 | echo '*** ' ${NOTES}. | |
367 | exit 1 | |
368 | fi # ! -r ${popdir}/${TAPE} | |
369 | fi # -z ${ERROR} | |
370 | fi # extract in ${ACTIONS} | |
371 | ||
372 | cd ${popdir} | |
373 | ||
374 | ### bail out | |
375 | ||
376 | case "${ERROR}" in | |
377 | "") ;; | |
378 | *) | |
379 | cat <<EOF | |
380 | You may supply at least one format on the command line. Recognized formats | |
381 | are: | |
382 | binaries for binaries | |
383 | source for source code | |
384 | The default is both source and binaries. | |
385 | ||
386 | You may also supply actions. Recognized actions are: | |
387 | extract read the appropriate files from tape | |
388 | fixincludes build a directory of corrected header files for comp-tools | |
389 | test run a very brief verification of your installation | |
390 | Default actions are extract, fixincludes, and test, although fixincludes is not | |
391 | necessary for emacs. | |
392 | ||
393 | There are two other options: | |
394 | -tape=DEVICE asks Install to read the necessary files from DEVICE. The | |
395 | default DEVICE is ||DEVdflt||, the ||TAPdflt||, cartridge tape | |
396 | drive on most ||HOSTstr||s. | |
397 | -installdir=DIRECTORY asks Install to install files into DIRECTORY. | |
398 | The default DIRECTORY is ${INSTALLDIR_DEFAULT}. | |
399 | No action has been taken. | |
400 | EOF | |
401 | exit 1 | |
402 | ;; | |
403 | esac | |
404 | ||
405 | ||
406 | ### | |
407 | ### | |
408 | ### build a file list | |
409 | ### (easy this round because we have only one package). | |
410 | ### | |
411 | ||
412 | FILE_LIST= | |
413 | TRIGGERS= | |
414 | ||
415 | for arch in ${ARCH} ; do | |
416 | case ${arch} in | |
417 | bin) | |
418 | FILE_LIST="${FILE_LIST} \ | |
419 | ${VERSION}/Install \ | |
420 | ${VERSION}/CYGNUS \ | |
421 | ${EXECDIR}/lib \ | |
422 | ${EXECDIR}/bin \ | |
423 | ${VERSION}/include \ | |
424 | ${VERSION}/info \ | |
425 | ${VERSION}/lib \ | |
426 | ${VERSION}/man" | |
427 | for tool in ${TOOLS} ; do | |
428 | case ${tool} in | |
429 | comp) TRIGGERS="${TRIGGERS} ${EXECDIR}/bin/gcc" ;; | |
430 | emacs) TRIGGERS="${TRIGGERS} ${EXECDIR}/bin/emacs" ;; | |
431 | *) | |
432 | echo '***' Oops. Sanity failure on triggers for binaries for ${tool}. | |
433 | exit 1 | |
434 | ;; | |
435 | esac | |
436 | done | |
437 | ;; | |
438 | src) | |
439 | FILE_LIST="${FILE_LIST} \ | |
440 | ${VERSION}/Install \ | |
441 | ${VERSION}/CYGNUS \ | |
442 | ${VERSION}/src" | |
443 | for tool in ${TOOLS} ; do | |
444 | case ${tool} in | |
445 | comp) TRIGGERS="${TRIGGERS} ${VERSION}/src/gcc/gcc.c" ;; | |
446 | emacs) TRIGGERS="${TRIGGERS} ${VERSION}/src/emacs/src/emacs.c" ;; | |
447 | *) | |
448 | echo '***' Oops. Sanity failure on triggers for source for ${tool}. | |
449 | exit 1 | |
450 | ;; | |
451 | esac | |
452 | done | |
453 | ;; | |
454 | *) | |
455 | echo '***' Oops. Sanity failure on triggers for arch ${arch}. | |
456 | ;; | |
457 | esac | |
458 | done | |
459 | ||
460 | ### | |
461 | ### | |
462 | ### removal | |
463 | ### | |
464 | ### | |
465 | ||
466 | if echo ${ACTIONS} | grep rm > /dev/null 2>&1 ; then | |
467 | if [ ! -d "${INSTALLDIR}" ] ; then | |
468 | echo '***' Cannot remove anything from \"${INSTALLDIR}\" because it does not exist. | |
469 | echo '*** ' You probably do not need to remove anything. | |
470 | else | |
471 | popdir=`pwd` | |
472 | if [ ! -d "${INSTALLDIR}" ] ; then | |
473 | echo '***' Can not cd to \"${INSTALLDIR}\" because it does not exist. | |
474 | echo '*** ' You probably do not need to remove anything. | |
475 | exit 1 | |
476 | else | |
477 | if [ ! -r "${INSTALLDIR}" ] ; then | |
478 | echo '***' Can not cd to \"${INSTALLDIR}\" because I do not have execute permission. | |
479 | ls -lad ${INSTALLDIR} | |
480 | echo '*** ' Please fix this and then try running Install again. For | |
481 | echo '*** ' more information, please refer to ${NO_ACCESS} | |
482 | echo '*** ' in ${NOTES}. | |
483 | exit 1 | |
484 | fi | |
485 | fi | |
486 | ||
487 | cd ${INSTALLDIR} | |
488 | ||
489 | ### see also the above note about the timing window. | |
490 | ||
491 | if [ "$?" != "0" ] ; then | |
492 | echo '***' Cannot cd to \"${INSTALLDIR}\". This is a problem. | |
493 | echo '*** ' For further help, please refer to | |
494 | echo '*** ' ${NO_ACCESS} in ${NOTES} or call | |
495 | echo '*** ' ${HOTLINE} | |
496 | exit 1 | |
497 | else | |
498 | true | |
499 | fi | |
500 | ||
501 | if [ ! -d "${VERSION}" ] ; then | |
502 | echo '***' Cannot remove anything from \"${INSTALLDIR}/${VERSION}\" because it does not exist. | |
503 | echo '*** ' You probably do not need to remove anything. | |
504 | exit 1 | |
505 | else | |
506 | true | |
507 | fi | |
508 | ||
509 | echo Removing from \"${INSTALLDIR}\"... | |
510 | ||
511 | if rm -rf ${FILE_LIST} ; then | |
512 | # if neither binaries nor source are installed, remove installdir | |
513 | if [ -d ${INSTALLDIR}/${EXECDIR} \ | |
514 | -o -d ${INSTALLDIR}/${VERSION}/src ] ; then | |
515 | true | |
516 | else | |
517 | if rm -rf "${INSTALLDIR}/${VERSION}" ; then | |
518 | true | |
519 | else | |
520 | if [ ! -w "${INSTALLDIR}" ] ; then | |
521 | echo '***' I can not remove ${INSTALLDIR}/${VERSION} | |
522 | echo '*** ' because I do not have write access to \"${INSTALLDIR}\" | |
523 | echo '*** ' Please fix this and try running Install again. For more information | |
524 | echo '*** ' please refer to ${NO_ACCESS} in ${NOTES}. | |
525 | exit 1 | |
526 | else | |
527 | echo '***' I do not know why I can not remove ${INSTALLDIR}/${VERSION}. This is | |
528 | echo '*** ' probably not a problem. | |
529 | fi | |
530 | exit 1 | |
531 | fi | |
532 | fi | |
533 | ||
534 | echo Removed. | |
535 | else | |
536 | echo '***' There appears to have been a removal error. | |
537 | echo '*** ' Chances are that this is not a problem, but you might try removing | |
538 | echo '*** ' again. | |
539 | exit 1 | |
540 | fi | |
541 | fi | |
542 | echo Cygnus Support software distribution removed! | |
543 | else | |
544 | true | |
545 | fi # if removing | |
546 | ||
547 | ### | |
548 | ### | |
549 | ### extraction | |
550 | ### | |
551 | ### | |
552 | ||
553 | if echo ${ACTIONS} | grep extract > /dev/null 2>&1 ; then | |
554 | if [ ! -d "${INSTALLDIR}" ] ; then | |
555 | echo Trying to create \"${INSTALLDIR}\"... | |
556 | if mkdir ${INSTALLDIR} ; then | |
557 | echo Created \"${INSTALLDIR}\". | |
558 | else | |
559 | echo '***' I can not make directory, \"${INSTALLDIR}\". | |
560 | ||
561 | ### attempt to diagnose... | |
562 | ||
563 | DIR=`echo ${INSTALLDIR} | ${SED} -e 's:/[^/]*$::'` | |
564 | if [ ! -d "${DIR}" ] ; then | |
565 | echo '*** ' It looks as though \"${DIR}\" does not even exist. | |
566 | exit 1 | |
567 | else | |
568 | if [ ! -w "${DIR}" ] ; then | |
569 | echo '*** ' It looks as though you do not have write access to \"${DIR}\". | |
570 | echo '*** ' Please fix this and try running Install again. For more information | |
571 | echo '*** ' please refer to ${NO_ACCESS} in ${NOTES}. | |
572 | exit 1 | |
573 | else | |
574 | echo '*** ' I do not know why I can not create \"${INSTALLDIR}\". This is a problem. | |
575 | echo '*** ' Please call ${HOTLINE} | |
576 | exit 1 | |
577 | fi # ! -w ${DIR} | |
578 | fi # ! -d ${DIR} | |
579 | fi # mkdir ${INSTALLDIR} | |
580 | else | |
581 | true | |
582 | fi # ! -d ${INSTALLDIR} | |
583 | ||
584 | cd ${INSTALLDIR} | |
585 | ||
586 | if [ "$?" = "0" ] ; then | |
587 | for trigger in ${TRIGGERS} ; do | |
588 | if [ -r "${trigger}" ] ; then | |
589 | echo '***' \"${INSTALLDIR}/${trigger}\" exists and I will not overwrite it. | |
590 | echo '*** ' If you really want to install it again, please remove it first. | |
591 | exit 1 | |
592 | else | |
593 | true | |
594 | fi # -r ${trigger} | |
595 | done # for trigger | |
596 | else | |
597 | echo '***' I can not cd to \"${INSTALLDIR}\". | |
598 | ||
599 | ### attempt to diagnose... | |
600 | ||
601 | if [ ! -r "${INSTALLDIR}" ] ; then | |
602 | echo '*** ' It looks as though you do not have execute permission to \"${INSTALLDIR}\". | |
603 | else | |
604 | true | |
605 | fi # ! -r ${INSTALLDIR} | |
606 | ||
607 | echo '*** ' For further help, please refer to | |
608 | echo '*** ' ${NO_ACCESS} in ${NOTES}. | |
609 | exit 1 | |
610 | fi # status is zero | |
611 | ||
612 | ||
613 | ### remove redundant names from the list | |
614 | echo ${FILE_LIST} ${COMMONS} ${EMACSHIBIN} | tr ' ' ' | |
615 | ' | sort | uniq > ${LOGDIR}/extract_list | |
616 | ||
617 | echo It will take some time for me to read the tape. | |
618 | echo Verbose output will be saved in ${LOGDIR}/tar.log | |
619 | echo Extracting into \"${INSTALLDIR}\"... | |
620 | ||
621 | ### make sure things come off the tape as they were written, but minus what could be a security hole. | |
622 | umask 0 | |
623 | ||
624 | ### using the no rewind device, so rewind and fsf to be sure. | |
625 | ||
626 | if ${MT} -f ${TAPE} rewind > /dev/null 2>&1 ; then | |
627 | if ${MT} -f ${TAPE} fsf 1 ; then | |
628 | true | |
629 | else | |
630 | echo '***' Could not forward space tape device \"${TAPE}\". | |
631 | exit 1 | |
632 | fi | |
633 | else | |
634 | if test -r ${TAPE} ; then | |
635 | true | |
636 | else | |
637 | echo '***' Could not rewind tape device \"${TAPE}\". | |
638 | exit 1 | |
639 | fi | |
640 | fi # mt ${TAPE} rewind | |
641 | ||
642 | if dd if=${TAPE} bs=124b | compress -d | ${TAR} ${TARKEYS} `cat ${LOGDIR}/extract_list` > ${LOGDIR}/tar.log 2>&1 && test -d ${VERSION} ; then | |
643 | if [ -d ${INSTALLDIR}/${EXECDIR}/bin ] ; then | |
644 | echo Extracted. | |
645 | else | |
646 | echo '***' The extraction has failed. The directory | |
647 | echo '***' ${INSTALLDIR}/${EXECDIR}/bin was not extracted. | |
648 | echo '*** ' The output from the tar command has been logged in ${LOGDIR}/tar.log | |
649 | echo '*** ' I do not know how to continue until this problem has been | |
650 | echo '*** ' corrected. If you do not know how to fix it either, please | |
651 | echo '*** ' call ${HOTLINE}. | |
652 | exit 1 | |
653 | fi | |
654 | ||
655 | if (${MT} -f ${TAPE} rewind > /dev/null 2>&1) ; then | |
656 | true | |
657 | else | |
658 | true | |
659 | fi # mt rewind | |
660 | else | |
661 | echo '***' There appears to have been an extraction error. | |
662 | echo '*** ' The output from the tar command has been logged in ${LOGDIR}/tar.log | |
663 | echo '*** ' I do not know how to continue until this problem has been | |
664 | echo '*** ' corrected. If you do not know how to fix it either, please | |
665 | echo '*** ' call ${HOTLINE}. | |
666 | exit 1 | |
667 | fi # dd | compress | tar .... | |
668 | ||
669 | rm -f ${LOGDIR}/extract_list | |
670 | echo Cygnus Support software distribution extracted! | |
671 | else | |
672 | true | |
673 | fi # extraction in actions | |
674 | ||
675 | ### | |
676 | ### | |
677 | ### fixincludes | |
678 | ### | |
679 | ### | |
680 | ||
681 | if echo ${ACTIONS} | grep fix > /dev/null 2>&1 ; then | |
682 | echo Running fixincludes for ${INSTALLHOST}. | |
683 | echo Verbose output will be stored in ${LOGDIR}/fixincludes.log | |
684 | echo This will take some time. | |
685 | LIB=${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include ; export LIB | |
686 | ||
687 | if mkdir ${LIB}/tmpdir && mv ${LIB}/*.h ${LIB}/tmpdir ; then | |
688 | if ${INSTALLDIR}/${VERSION}/lib/fixincludes ${LIB} /usr/include ${INSTALLDIR}/${VERSION}/src/gcc > ${LOGDIR}/fixincludes.log ; then | |
689 | mv ${LIB}/tmpdir/* ${LIB} && rmdir ${LIB}/tmpdir | |
690 | echo Finished with fixincludes. | |
691 | else | |
692 | echo '***' There seems to have been a problem with fixincludes. | |
693 | echo '*** ' The verbose output from the fixincludes script has been logged in | |
694 | echo '*** ' ${INSTALLDIR}/${VERSION}/fixincludes.log. | |
695 | echo '*** ' I do not know how to continue until this problem has been | |
696 | echo '*** ' corrected. If you do not know how to fix it either, please | |
697 | echo '*** ' call ${HOTLINE}. | |
698 | mv ${LIB}/tmpdir/* ${LIB} && rmdir ${LIB}/tmpdir | |
699 | exit 1 | |
700 | fi # | |
701 | else | |
702 | echo '***' Not able to create the temporary include dir | |
703 | echo '*** ' Please ensure that write permissions for | |
704 | echo '*** ' ${LIB} are allowed. | |
705 | echo '*** ' Or call ${HOTLINE} for more information. | |
706 | exit 1 | |
707 | fi | |
708 | echo Fixed include files installed! | |
709 | else | |
710 | true | |
711 | fi # fix in actions | |
712 | ||
713 | ### | |
714 | ### | |
715 | ### testing the installation | |
716 | ### | |
717 | ### | |
718 | ||
719 | if echo ${ACTIONS} | grep test > /dev/null 2>&1 && echo ${ARCH} | grep bin > /dev/null 2>&1 ; then | |
720 | popdir=`pwd` | |
721 | cd ${LOGDIR} | |
722 | for tool in ${TOOLS} ; do | |
723 | case ${tool} in | |
724 | comp) | |
725 | if [ -f ${INSTALLDIR}/${EXECDIR}/bin/gcc ] ; then | |
726 | cat > ${LOGDIR}/hello.c <<'e!o!f' | |
727 | #include <stdio.h> | |
728 | ||
729 | extern int printf(); | |
730 | ||
731 | int main(int argc, char **argv) { | |
732 | (void) printf("hello: The compilation tools appear to be installed correctly on your %s.\n", | |
733 | MACHINE); | |
734 | return(0); | |
735 | } /* main() */ | |
736 | e!o!f | |
737 | if ${INSTALLDIR}/${EXECDIR}/bin/gcc -Wall -O -g \ | |
738 | -DMACHINE=\"${INSTALLHOST}\" ${LOGDIR}/hello.c -o ${LOGDIR}/hello ; then | |
739 | if ${LOGDIR}/hello ; then | |
740 | echo This is good. | |
741 | else | |
742 | echo '***' Hello.c fails to run. This is a problem. | |
743 | echo '*** ' Please call ${HOTLINE} | |
744 | exit 1 | |
745 | fi # ./hello | |
746 | else | |
747 | echo '***' Hello.c fails to compile. This is a problem. | |
748 | echo '*** ' Please call ${HOTLINE} | |
749 | exit 1 | |
750 | fi # run gcc | |
751 | ||
752 | ### now check for fixed includes. | |
753 | cat > ${LOGDIR}/test-ioctl.c << 'e!o!f' | |
754 | #include <sys/types.h> | |
755 | #include <sys/stat.h> | |
756 | #include <fcntl.h> | |
757 | #include <math.h> | |
758 | ||
759 | double atof(const char *); | |
760 | ||
761 | #ifdef __sun__ | |
762 | #include <sys/filio.h> | |
763 | ||
764 | extern int ioctl(); | |
765 | extern int perror(); | |
766 | #endif /* __sun__ */ | |
767 | ||
768 | extern int printf(); | |
769 | ||
770 | int main(int argc, char **argv) { | |
771 | #ifdef __sun__ | |
772 | long l; | |
773 | int fd; | |
774 | int retval; | |
775 | ||
776 | if ((fd = open("/dev/tty", O_RDONLY)) == -1) { | |
777 | (void) perror("test-ioctl: can't open /dev/null"); | |
778 | return(1); | |
779 | } else if ((retval = ioctl(fd, FIONREAD, &l)) != 0) { | |
780 | (void) perror("test-ioctl: ioctl failed"); | |
781 | (void) printf("test-ioctl: Most likely, you have not run \"Install fixincludes\" on this machine.\n"); | |
782 | return(2); | |
783 | } | |
784 | #endif /* __sun__ */ | |
785 | ||
786 | printf("test-ioctl: Ansi versions of the system header files, (the fixed includes),\n"); | |
787 | printf("test-ioctl: appear to be installed correctly.\n"); | |
788 | ||
789 | /* that's right. If closing /dev/tty fails, I don't want to know about it. */ | |
790 | ||
791 | return(0); | |
792 | } | |
793 | e!o!f | |
794 | ||
795 | case "||HOSTstr||" in | |
796 | sun3 | sun4 | decstation) | |
797 | if ${INSTALLDIR}/${EXECDIR}/bin/gcc -Wall -O -g \ | |
798 | -DMACHINE=\"${INSTALLHOST}\" ${LOGDIR}/test-ioctl.c -o ${LOGDIR}/test-ioctl ; then | |
799 | if ${LOGDIR}/test-ioctl ; then | |
800 | echo This is good. | |
801 | else | |
802 | case "$?" in | |
803 | 1) | |
804 | echo '***' test-ioctl.c fails to read /dev/tty. If you were running Install | |
805 | echo '*** ' in batch or from a daemon, please try running it again interactively. | |
806 | echo '*** ' If not, please call ${HOTLINE} | |
807 | exit 1 | |
808 | ;; | |
809 | 2) | |
810 | echo '***' test-ioctl.c fails to ioctl. | |
811 | echo '*** ' Most likely you need to run \"Install fixincludes\". | |
812 | echo '*** ' Please run \"Install fixincludes\" and | |
813 | echo '*** ' then try this test again. For an explanation see | |
814 | echo '*** ' ${WHY_FIXINCLUDES} in ${NOTES}. | |
815 | exit 1 | |
816 | ;; | |
817 | *) | |
818 | echo '***' test-ioctl.c fails to run. This is a problem. | |
819 | echo '*** ' Please call ${HOTLINE} | |
820 | exit 1 | |
821 | ;; | |
822 | esac # $? | |
823 | exit 1 | |
824 | fi # test-ioctl | |
825 | else | |
826 | ### this presupposes that hello.c DID compile. | |
827 | echo '***' test-ioctl.c fails to compile. This is a problem. | |
828 | echo '*** ' Please call ${HOTLINE} | |
829 | exit 1 | |
830 | fi # run gcc | |
831 | ;; | |
832 | iris4) | |
833 | if [ ! -f ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/sys/cfeiroute.h ] | |
834 | then | |
835 | echo '***' You seem to be missing ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/sys/cfeiroute.h. | |
836 | echo '*** ' Most likely you need to run \"Install fixincludes\". | |
837 | echo '*** ' Please run \"Install fixincludes\" and | |
838 | echo '*** ' then try this test again. For an explanation see | |
839 | echo '*** ' ${WHY_FIXINCLUDES} in ${NOTES}. | |
840 | exit 1 | |
841 | fi # test fixincluded file | |
842 | ;; | |
843 | sparc-sun-solaris2) | |
844 | if [ ! -f ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/ieeefp.h ] | |
845 | then | |
846 | echo '***' You seem to be missing ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/ieeefp.h. | |
847 | echo '*** ' Most likely you need to run \"Install fixincludes\". | |
848 | echo '*** ' Please run \"Install fixincludes\" and | |
849 | echo '*** ' then try this test again. For an explanation see | |
850 | echo '*** ' ${WHY_FIXINCLUDES} in ${NOTES}. | |
851 | exit 1 | |
852 | fi | |
853 | ;; | |
854 | ||
855 | rs6000) | |
856 | if [ ! -f ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/piostruct.h ] | |
857 | then | |
858 | echo '***' You seem to be missing ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/piostruct.h. | |
859 | echo '*** ' Most likely you need to run \"Install fixincludes\". | |
860 | echo '*** ' Please run \"Install fixincludes\" and | |
861 | echo '*** ' then try this test again. For an explanation see | |
862 | echo '*** ' ${WHY_FIXINCLUDES} in ${NOTES}. | |
863 | exit 1 | |
864 | fi # test fixincluded file | |
865 | ;; | |
866 | esac # ||HOSTstr|| | |
867 | else | |
868 | true | |
869 | fi # test if gcc present | |
870 | ||
871 | ### now check for g++. | |
872 | if [ -f ${INSTALLDIR}/${EXECDIR}/bin/g++ ] ; then | |
873 | cat > ${LOGDIR}/hello.C << 'e!o!f' | |
874 | #include <iostream.h> | |
875 | ||
876 | int main(int argc, char**argv) | |
877 | { | |
878 | char *machine = MACHINE; | |
879 | cout << "hello: g++ appears to be installed correctly on your " | |
880 | << machine << ".\n"; | |
881 | return(0); | |
882 | } | |
883 | e!o!f | |
884 | if ${INSTALLDIR}/${EXECDIR}/bin/gcc ${GPLUSOPTIONS} -Wall -O -g \ | |
885 | -DMACHINE=\"${INSTALLHOST}\" ${LOGDIR}/hello.C -o ${LOGDIR}/Hello -lg++ ; then | |
886 | if ${LOGDIR}/Hello ; then | |
887 | echo This is good. | |
888 | else | |
889 | echo '***' hello.C fails to run. This is a problem. | |
890 | echo '*** ' Please call ${HOTLINE} | |
891 | exit 1 | |
892 | fi # ./Hello | |
893 | else | |
894 | ### this presupposes that hello.c DID compile. | |
895 | echo '***' hello.C fails to compile. This is a problem. | |
896 | echo '*** ' Please call ${HOTLINE} | |
897 | exit 1 | |
898 | fi # run g++ | |
899 | ||
900 | ### now check for static initialization. | |
901 | cat > ${LOGDIR}/static-init.C << 'e!o!f' | |
902 | #include <iostream.h> | |
903 | int Three; | |
904 | ||
905 | struct Foo { | |
906 | Foo(int i) { Three = i; } | |
907 | }; | |
908 | ||
909 | Foo foo(3); | |
910 | ||
911 | int main(int argc, char**argv) | |
912 | { | |
913 | if (Three != 3) { | |
914 | cout << "static-init: static initialization fails.\n"; | |
915 | return(1); | |
916 | } | |
917 | ||
918 | cout << "static-init: static initialization appears to work.\n"; | |
919 | return(0); | |
920 | } | |
921 | e!o!f | |
922 | if ${INSTALLDIR}/${EXECDIR}/bin/gcc ${GPLUSOPTIONS} -Wall -O -g \ | |
923 | -DMACHINE=\"${INSTALLHOST}\" ${LOGDIR}/static-init.C -o ${LOGDIR}/static-init -lg++ ; then | |
924 | if ${LOGDIR}/static-init ; then | |
925 | echo This is good. | |
926 | else | |
927 | echo '***' Static initialization is not working. This is a problem. | |
928 | echo '*** ' Please call ${HOTLINE} | |
929 | exit 1 | |
930 | fi # run static-init | |
931 | else | |
932 | ### this presupposes that it DID compile. | |
933 | echo '***' static-init.c fails to compile. This is a problem. | |
934 | echo '*** ' Please call ${HOTLINE} | |
935 | exit 1 | |
936 | fi # run g++ | |
937 | else # no g++, so don't test it | |
938 | true | |
939 | fi # no g++ | |
940 | ;; | |
941 | emacs) | |
942 | cat > ${LOGDIR}/hello.el <<'e!o!f' | |
943 | (server-start) | |
944 | (message "Emacs appears to be installed correctly.") | |
945 | (kill-emacs 0) | |
946 | e!o!f | |
947 | if ${INSTALLDIR}/${EXECDIR}/bin/emacs -batch -l ${LOGDIR}/hello.el ; then | |
948 | echo This is good. | |
949 | else | |
950 | echo '***' Emacs fails to run. This is a problem. | |
951 | echo '*** ' Please call ${HOTLINE} | |
952 | exit 1 | |
953 | fi | |
954 | ;; | |
955 | src) # if anyone can tell me how to test the installation of source... | |
956 | true | |
957 | ;; | |
958 | *) | |
959 | echo '***' I do not know how to test for tool \"${tool}\" because I have never | |
960 | echo '*** ' heard of it. This is a problem. Please call ${HOTLINE}. | |
961 | exit 1 | |
962 | ;; | |
963 | esac | |
964 | done | |
965 | rm -f hello* test-ioctl* static-init* Hello* | |
966 | cd ${popdir} | |
967 | echo Cygnus Support software distribution tested! | |
968 | else | |
969 | true | |
970 | fi | |
971 | ||
972 | echo Done. | |
973 | ||
974 | exit 0 | |
975 | ||
976 | ### | |
977 | ### Local Variables: | |
978 | ### comment-column: 0 | |
979 | ### fill-column: 131 | |
980 | ### End: | |
981 | ### | |
982 | ||
983 | ### End of Install |