|
|
1.1 root 1: OLDEST_nmake=910111 OLDEST_pax=881111 OLDEST_shipop=910211
2: :
3: #
4: # software shipment installation control
5: #
6: # @(#)shipin (ulysses!gsf) 03/31/91
7: #
8: # ship/shipin [options] [component ...] [name=value ...]
9: #
10: # options:
11: #
12: # -c don't compute closure if components specified
13: # -i read in from spool but do not uncrate or build
14: # (files set up for shipout)
15: # -n show actions but do not execute
16: # -r usr usr is the shipment recipient
17: # -s dir shipment spool hierarchy copied to dir
18: # -t show component closure but do not build
19: # -u uncrate shipment source but do not build
20: # -x set -x
21: # -E ignore previous tool build errors
22: # -F force (re)build (not uncrating unless -u)
23: # -X tool exclude tools from uncrating or building
24: #
25: # The component arguments cause shipin to build only on those components.
26: # All component source will be uncrated.
27: #
28: # The remaining arguments are passed as arguments to the generating
29: # makes or shell scripts -- handy for `name=value' overrides.
30: #
31: # The minimum configuration must have an $INSTALLROOT/ship subdirectory.
32: # See $INSTALLROOT/ship/README for more details.
33: #
34:
35: #
36: # we don't do csh here
37: #
38:
39: ":" || exec sh $0 $argv:q || exit 1
40:
41: #
42: # this script may be overwritten while it is being executed
43: # so copy it and exec from the copy
44: #
45:
46: case $1 in
47: -x) set -x
48: ;;
49: *) case $- in
50: *x*) set '' -x ${1+"$@"}; shift ;;
51: esac
52: ;;
53: esac
54: case $- in
55: *x*) case $PS4 in
56: *'$LINENO'*) ;;
57: *) PS4='+[$LINENO]+ ' ;;
58: esac
59: ;;
60: esac
61: _command_=ship/shipin
62: case $0 in
63: *.save) ;;
64: *) cp $_command_ $_command_.save 2>/dev/null && exec $_command_.save ${1+"$@"} ;;
65: esac
66:
67: #
68: # the components in ORDER are built first
69: # OLDEST_<cmd> is the oldest version of <cmd> that can be used
70: #
71:
72: INSTALLROOT=`pwd`
73: export INSTALLROOT
74:
75: ORDER="ksh nmake"
76:
77: USER=${USER-${LOGNAME-`echo $HOME | sed 's/.*\///'`}}
78: INSTALLER=$USER
79: export INSTALLER
80: RECIPIENT=${RECIPIENT-$USER}
81: FROMSYS=`(uname -n || hostname || cat /etc/whoami) 2>/dev/null`
82: PATH=:$PATH:$INSTALLROOT/bin
83: export PATH
84: case $PS4 in
85: +\ *|+*\ )
86: ;;
87: *) PS4="+ $PS4"
88: export PS4
89: ;;
90: esac
91:
92: SHIP=$INSTALLROOT/ship
93: BIN=$INSTALLROOT/bin
94: _bypass_=Install
95: LOG=in.log
96: _mail_=/bin/mail
97: OWNER=owner
98: PAX_INFO="!PAX!CA!"
99: _read_=
100: REPORT=report
101: SHIPDATE=[0-9][0-9][0-9][0-9][0-9][0-9]
102: SHIPMENT=*$SHIPDATE
103: SHIPSLOG=$SHIP/shipslog
104: TMP=tmp
105:
106: for f in $ORDER
107: do eval RELEASE_$f=
108: eval STATE_$f=
109: done
110:
111: if (unalias make) 2> /dev/null
112: then unalias cp make rm
113: fi
114:
115: #
116: # check for old exit status botch
117: #
118:
119: _set_=
120: (set -e; false || true) && _set_=e || echo "$_command_: command errors ignored because of shell botch" >&2
121: _set_="set -x$_set_;"
122:
123: #
124: # force the native preroot
125: #
126:
127: if /etc/preroot / /bin/cat </dev/null >/dev/null 2>&1
128: then ccs=native
129: if test -d /$ccs
130: then r=`ls -lid / | sed 's,/.*,,'`
131: p=`ls -lid /$ccs | sed 's,/.*,,'`
132: case $p in
133: $r) ;;
134: *) CCS=$ccs
135: export CCS
136: exec /etc/preroot /$ccs ${SHELL-/bin/sh} $_command_ ${1+"$@"}
137: ;;
138: esac
139: fi
140: else ccs=
141: fi
142:
143: #
144: # gobble the options
145: #
146:
147: _closure_=1
148: _exclude_=" bin cmd lib src shipslog "
149: _force_=
150: _ignore_=
151: _intermediate_=
152: _options_=
153: _total_=
154: _trace_=
155: _uncrate_=
156: _uuspool_=
157: while :
158: do case $# in
159: 0) break ;;
160: esac
161: case $1 in
162: -[rsX]) case $# in
163: 1) set '?'; continue ;;
164: esac
165: case $1 in
166: -r) RECIPIENT=$2 ;;
167: -s) _uuspool_="$_uuspool_ $2" ;;
168: -X) _exclude_="$_exclude$2 " ;;
169: esac
170: _options_="$_options_ $1"
171: shift
172: ;;
173: -c) _closure_= ORDER= ;;
174: -i) _intermediate_=1 ;;
175: -n) _trace_=echo ;;
176: -t) _total_=1 _trace_=: _components_= ;;
177: -u) _uncrate_=1 ;;
178: -x) set -x ;;
179: -E) _ignore_=1 ;;
180: -F) _force_=1 ;;
181: --) _options_="$_options_ $1"; shift; break ;;
182: '?'|[-+]*) echo "Usage: $_command_ [-cintuxEF] [-r recipient] [-s spool-dir] [-X tool] [tool ...] [name=value ...]" >&2; exit 2 ;;
183: *) break ;;
184: esac
185: _options_="$_options_ $1"
186: shift
187: done
188:
189: #
190: # option controlled vars
191: #
192:
193: export RECIPIENT
194: case $_uuspool_ in
195: "") case $SHIPSPOOL in
196: "") SHIPSPOOL="/usr/spool/uucppublic/$RECIPIENT/* /usr/spool/uucppublic/receive/$RECIPIENT/*" ;;
197: esac
198: ;;
199: *) SHIPSPOOL=$_uuspool_ ;;
200: esac
201: export SHIPSPOOL
202:
203: #
204: # must be in $INSTALLROOT
205: #
206:
207: if test ! -d ship
208: then echo "$_command_: must have \$INSTALLROOT/ship directory" >&2; exit 1
209: fi
210:
211: #
212: # recover from previous incomplete shipins
213: #
214:
215: cd ship
216: case $_trace_ in
217: ?*) $_trace_ cd ship ;;
218: esac
219: for f in shipseal*
220: do if test -f $f
221: then $_trace_ rm -f $f
222: fi
223: done
224: for f in O?*
225: do if test -f $f
226: then $_trace_ mv $f `echo $f | sed 's/^O//'`
227: fi
228: done
229: cd $INSTALLROOT
230: case $_trace_ in
231: ?*) $_trace_ cd $INSTALLROOT ;;
232: esac
233:
234: #
235: # shipop provides the C language ship support
236: #
237:
238: _shipop_=$SHIP/shipop
239: test -f $_shipop_ && ($_shipop_) </dev/null >/dev/null 2>&1 && test "`sed -e '/^@(#)shipop .* [0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]$/!d' -e 's/.*\(..\)\/\(..\)\/\(..\)$/\3\1\2/' < $_shipop_`" -ge "$OLDEST_shipop" 2>/dev/null || _shipop_=': WARNING : reship shipop.c'
240:
241: #
242: # check the manifest and mail the validation seal for each shipment
243: # then copy from the spool area to $SHIP
244: #
245: # the validation seal will eventually be a digital signature
246: #
247:
248: _reship_=
249: _verify_=
250: for UUSHIP in $SHIPSPOOL
251: do if test -d $UUSHIP
252: then cd $UUSHIP
253: case $_trace_ in
254: ?*) $_trace_ cd $UUSHIP ;;
255: esac
256: for f in ${SHIPDATE}*.*
257: do if test -f $f/manifest
258: then _manifest_=`cat $f/manifest`
259: d=
260: for i in $_manifest_
261: do if test ! -f $i
262: then echo "$f: $i has not arrived yet" >&2
263: d=1
264: fi
265: done
266: case $d in
267: ?*) continue ;;
268: esac
269: if test -f $f/id
270: then _id_=`cat $f/id`
271: _key_=`echo "$_id_" | sed -e 's/[^ ]*[ ]//'`
272: _id_=`echo "$_id_" | sed -e 's/[ ].*//'`
273: case $_trace_ in
274: "") case $_shipop_ in
275: $SHIP/shipop)
276: ;;
277: *) if ($SHIP/shipop) </dev/null >/dev/null 2>&1
278: then _shipop=$SHIP/shipop
279: else for d in $SHIP $f
280: do if test -f $d/shipop.c
281: then cc -o $SHIP/shipop $d/shipop.c
282: rm -f shipop.o
283: if ($SHIP/shipop) </dev/null >/dev/null 2>&1
284: then _shipop_=$SHIP/shipop
285: else case $_shipop_ in
286: *ERROR*)
287: ;;
288: *) _shipop_=': ERROR : shipop.c compile failed'
289: echo "$f: warning: shipop required to validate shipments" >&2
290: ;;
291: esac
292: rm -f $SHIP/shipop
293: fi
294: break
295: fi
296: done
297: fi
298: ;;
299: esac
300: case $_shipop_ in
301: $SHIP/shipop) _seal_=`$_shipop_ seal $_manifest_` ;;
302: *) _seal_=$_shipop_ ;;
303: esac
304: $_mail_ $_id_ > /dev/null 2>&1 <<!
305: Subject: software shipment seal
306: $_key_ $_seal_
307: !
308: ;;
309: esac
310: else case $_shipop_ in
311: *WARNING*) ;;
312: *) echo "$f: warning: shipment missing validation id" >&2 ;;
313: esac
314: fi
315: _unspool_=
316: for i in $_manifest_
317: do case $i in
318: $f/shipin) _reship_=1 ;;
319: $f/unspool) _unspool_=$i ;;
320: esac
321: case $i in
322: $f/*) b=`echo $i | sed 's/.*\///'`
323: if test -f $SHIP/$b
324: then $_trace_ cp $SHIP/$b $SHIP/O${b}
325: _verify_="$_verify_ $b"
326: fi
327: ;;
328: esac
329: done
330: if test "" != "$_unspool_" -a -f $_unspool_ && $_trace_ . $_unspool_
331: then : ok
332: else echo "$f: cannot unspool shipment" >&2; continue
333: fi
334: d=
335: for i in $_manifest_
336: do case $i in
337: $f/*) ;;
338: *.000) d="$d $i" ;;
339: esac
340: done
341: d=`echo "$d " | sed -e 's,//*[^/ ]* , ,g'`
342: $_trace_ rm -rf $f $d
343: fi
344: done
345: cd $INSTALLROOT
346: case $_trace_ in
347: ?*) $_trace_ cd $INSTALLROOT ;;
348: esac
349: fi
350: done
351: case $_trace_ in
352: "") _reship_=
353: cd $SHIP
354: for i in $_verify_
355: do if test "`sed -e '/^@(#).* [0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]$/!d' -e 's/.*\(..\)\/\(..\)\/\(..\)$/\3\1\2/' < O$i`" -ge "`sed -e '/^@(#).* [0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]$/!d' -e 's/.*\(..\)\/\(..\)\/\(..\)$/\3\1\2/' < $i`"
356: then mv O$i $i
357: else case $i in
358: shipin) _reship_=1
359: ;;
360: shipop.c)
361: cc -o Oshipop shipop.c
362: rm -f shipop.o
363: if (Oshipop) </dev/null >/dev/null 2>&1
364: then mv Oshipop shipop
365: _shipop_=$SHIP/shipop
366: else rm -f Oshipop
367: fi
368: ;;
369: esac
370: rm -f O$i
371: fi
372: done
373: cd $INSTALLROOT
374: ;;
375: esac
376: case $_reship_ in
377: ?*) $_trace_ exec $_command_ $_options_ ${1+"$@"} ;;
378: esac
379:
380: #
381: # intermediate unpacking from spool area done
382: #
383:
384: case $_intermediate_ in
385: ?*) exit 0 ;;
386: esac
387:
388: #
389: # must have shipop by this point
390: #
391:
392: if test -f "$_shipop_" && ($_shipop_) </dev/null >/dev/null 2>&1
393: then :
394: elif test -f $SHIP/shipop.c && cc -o $SHIP/shipop $SHIP/shipop.c && ($SHIP/shipop) </dev/null >/dev/null 2>&1
395: then rm -f shipop.o
396: _shipop_=$SHIP/shipop
397: else echo "$_command_: must have shipop to continue [$_shipop_]" >&2
398: exit 1
399: fi
400:
401: #
402: # grab the select args
403: #
404:
405: SELECT=" "
406: while :
407: do case $# in
408: 0) break ;;
409: esac
410: case $1 in
411: *=*) break ;;
412: esac
413: SELECT="$SELECT$1 "
414: shift
415: done
416:
417: #
418: # handle character class botch -- it's hard to believe 9th edition
419: # did this, easier to believe BSD never added it
420: #
421:
422: cclasstype='^'
423: case a in
424: [${cclasstype}0]) ;;
425: [!0]) cclasstype='!' ;;
426: *) cclasstype='' ;;
427: esac
428:
429: #
430: # set up and verify the default directory hierarchy
431: #
432:
433: hierarchy="src src/cmd src/lib ship/shipslog"
434: case $_uncrate_ in
435: "") hierarchy="$hierarchy bin etc fun include lib man man/man1 man/man3 man/man8" ;;
436: esac
437: for d in $hierarchy
438: do if test ! -d $d
439: then $_trace_ mkdir $d
440: fi
441: done
442: if test ! -f src/Makefile
443: then case $_trace_ in
444: "") echo ":MAKE: lib - cmd" > src/Makefile ;;
445: *) $_trace_ echo ":MAKE: lib - cmd" "> src/Makefile" ;;
446: esac
447: fi
448: if test ! -f src/lib/Makefile
449: then case $_trace_ in
450: "") echo ":MAKE: libx - *" > src/lib/Makefile ;;
451: *) $_trace_ echo ":MAKE: libx - *" "> src/lib/Makefile" ;;
452: esac
453: fi
454: if test ! -f src/cmd/Makefile
455: then case $_trace_ in
456: "") echo ":MAKE: probe - ccc cpp - *" > src/cmd/Makefile ;;
457: *) $_trace_ echo ":MAKE: probe - ccc cpp - *" "> src/cmd/Makefile" ;;
458: esac
459: fi
460:
461: #
462: # ignore and silent may be used by nmake generated bootstraps
463: #
464:
465: case $_trace_$_uncrate_ in
466: "") if test ! -f bin/ignore
467: then cat > bin/ignore <<'!'
468: :
469: "$@"
470: exit 0
471: !
472: chmod +x bin/ignore
473: fi
474: if test ! -f bin/silent
475: then cat > bin/silent <<'!'
476: :
477: case $1 in
478: +|-|"") exit 0 ;;
479: esac
480: "$@"
481: !
482: chmod +x bin/silent
483: fi
484: ;;
485: esac
486: trap 'exit 2' 1 2
487:
488: #
489: # check if we can use pax -- punt to cpio
490: #
491:
492: _path_=`echo $PATH | sed -e 's/:/ /g' -e 's,///*,/,g'`
493: NEED_pax=
494: CPIO=
495: PAX=
496: for p in $_path_
497: do for f in $p/pax $p/pax.save
498: do if ($f -f /dev/null -z /dev/null) >/dev/null 2>&1 && test "`sed -e '/^@(#)pax .* [0-9][0-9]\/[0-9][0-9]\/[0-9][0-9]$/!d' -e 's/.*\(..\)\/\(..\)\/\(..\)$/\3\1\2/' < $f`" -ge "$OLDEST_pax" 2>/dev/null
499: then case $f in
500: $BIN/pax) if test ! -f $f.save
501: then $_trace_ cp $f $f.save
502: fi
503: ;;
504: esac
505: PAX=$f
506: break 2
507: fi
508: done
509: done
510: case $PAX in
511: "") local=
512: for p in $_path_
513: do if test -f $p/cpio
514: then case $p in
515: $BIN) local=$p/cpio ;;
516: *) CPIO=$p/cpio; break ;;
517: esac
518: fi
519: done
520: case $CPIO in
521: "") case $local in
522: "") echo $_command_: must have cpio to uncrate >&2; exit 1 ;;
523: esac
524: CPIO=$local
525: ;;
526: esac
527: ;;
528: esac
529:
530: #
531: # finish up initialization
532: #
533:
534: case $_trace_ in
535: ?*) $_trace_ cd $SHIP ;;
536: esac
537: cd $SHIP
538:
539: #
540: # uncrate the archives into the source tree
541: #
542:
543: COMPONENTS_SELECT=" "
544: for NAME in *
545: do case $_exclude_ in
546: *" $NAME "*) continue ;;
547: esac
548: if test -f $NAME/items
549: then # don't rebuild items under local control
550: echo "$_command_: warning: $NAME: delete ship/$NAME/items to build" >&2
551: continue
552: fi
553: case $cclasstype in
554: '!'|'^')
555: case $NAME in
556: *[${cclasstype}a-zA-Z_0-9]*)
557: continue ;;
558: esac
559: ;;
560: '') case "`echo $NAME | grep '[^a-zA-Z_0-9]'`" in
561: ?*) continue ;;
562: esac
563: ;;
564: esac
565: if test -d $NAME
566: then _release_=
567: _state_=found
568: case $NAME in
569: *_*) eval `echo $NAME | sed 's/\([^_]*\)_\(.*\)/_system_=\1 _tool_=\2/'`
570: _root_=$INSTALLROOT/$_system_
571: if test ! -d $_root_
572: then $_trace_ mkdir $_root_
573: fi
574: for d in $hierarchy
575: do case $d in
576: ship/*) ;;
577: *) if test ! -d $_root_/$d
578: then $_trace_ mkdir $_root_/$d
579: fi
580: ;;
581: esac
582: done
583: ;;
584: *) _root_=$INSTALLROOT
585: _tool_=$NAME
586: ;;
587: esac
588: case $_tool_ in
589: lib*) _type_=lib ;;
590: *) _type_=cmd ;;
591: esac
592: _source_=$_root_/src/$_type_/$_tool_
593: if test ! -d $_source_
594: then $_trace_ mkdir $_source_
595: fi
596: cd $NAME
597: base= # newest base
598: delta= # newest delta for newest base [not in dlist]
599: dlist= # list of deltas for newest base [no delta]
600: need= # pax needed to uncrate
601: new= # delta shipments requiring new base
602: old= # first base for new chain
603: remove= # old shipments to be removed
604: for d in $SHIPMENT
605: do case $d in
606: "$SHIPMENT")
607: ;;
608: *) if test -f $d/base
609: then remove="$remove $base $dlist $delta $need $new"
610: base=$d
611: delta=
612: need=
613: new=
614: else case $PAX in
615: "") need="$need $d"
616: ;;
617: *) case $base in
618: "") dlist="$dlist $d"
619: ;;
620: *) if test -f $d/$base
621: then dlist="$dlist $delta"
622: delta=$d
623: elif test "" != "$delta" -a -f $d/$delta
624: then dlist="$dlist $base"
625: case $new in
626: "") old=$base ;;
627: esac
628: new="$new $delta"
629: base=$delta
630: delta=$d
631: else dlist="$dlist $d"
632: fi
633: ;;
634: esac
635: ;;
636: esac
637: fi
638: ;;
639: *) dlist="$dlist $d"
640: ;;
641: esac
642: done
643: for i in $new
644: do echo generate $NAME $i base from $old >&2
645: case $_trace_ in
646: "") echo "generate $NAME $i base from $old [`date`]" >> $SHIP/$NAME/$LOG
647: if $PAX -rw -z $old/base < $i/$old > $i/base
648: then touch $i/GENERATED
649: else echo "cannot generate $i base from $old" >&2
650: echo "cannot generate $i base from $old" >> $SHIP/$NAME/$LOG
651: break
652: fi
653: ;;
654: *) $_trace_ "$PAX -rw -z $SHIP/$NAME/$old/base < $SHIP/$NAME/$i/$old > $i/base"
655: $_trace_ touch $SHIP/$NAME/$i/GENERATED
656: ;;
657: esac
658: old=$i
659: done
660: case $base in
661: "") echo "$_command_: warning: $NAME: no base archive" >&2
662: cd $SHIP
663: continue
664: ;;
665: esac
666: case `echo $remove $dlist` in
667: ?*) case $_trace_ in
668: "") rm -rf $remove $dlist 2>/dev/null ;;
669: *) $_trace_ "(cd $NAME; rm -rf" $remove $dlist")" ;;
670: esac
671: ;;
672: esac
673: cd $_source_
674: case $delta in
675: "") _release_=$base type=base ;;
676: *) _release_=$delta type=delta ;;
677: esac
678: if test 11 = "$_force_$_uncrate_" -o ! -f $SHIP/$NAME/$_release_/UNCRATED
679: then echo uncrate $NAME $_release_ $type >&2
680: case $_trace_ in
681: "") echo "uncrate $NAME $_release_ $type [`date`]" >> $SHIP/$NAME/$LOG ;;
682: esac
683: error=
684: if test ! -f $SHIP/$NAME/$_release_/items
685: then echo "$_command_: warning: $NAME: no items file" >&2
686: fi
687: case $type in
688: base) if test ! -f $SHIP/$NAME/$_release_/GENERATED
689: then case $_trace_ in
690: "") rm -rf * ;;
691: *) $_trace_ "(cd $_source_; rm -rf *)" ;;
692: esac
693: fi
694: case $PAX in
695: "") case $_trace_ in
696: "") if $CPIO -icdmu < $SHIP/$NAME/$_release_/base
697: then test -f $PAX_INFO && $_shipop_ xap `$CPIO -ictmu` && rm -f $PAX_INFO
698: else error="$CPIO $type read failed"
699: fi
700: ;;
701: *) $_trace_ "$CPIO -icdmu < $SHIP/$NAME/$_release_/base" ;;
702: esac
703: ;;
704: *) if $_trace_ $PAX -r -f $SHIP/$NAME/$_release_/base
705: then : ok
706: else error="$PAX $type read failed"
707: fi
708: ;;
709: esac
710: ;;
711: delta) if $_trace_ $PAX -r -f $SHIP/$NAME/$_release_/$base -z $SHIP/$NAME/$base/base
712: then $_trace_ touch $SHIP/$NAME/$base/UNCRATED
713: else error="$PAX $type read failed"
714: fi
715: ;;
716: esac
717: case $error in
718: "") $_trace_ touch $SHIP/$NAME/$_release_/UNCRATED ;;
719: *) echo "$_command_: $NAME: $_release_: uncrate error: $error" >&2
720: case $_trace_ in
721: "") echo "uncrate $NAME $_release_ $type error: $error" >> $SHIP/$NAME/$LOG ;;
722: esac
723: _state_=error
724: ;;
725: esac
726: fi
727: cd $SHIP
728: eval STATE_$NAME=$_state_
729: case $_state_ in
730: error) ;;
731: *) eval RELEASE_$NAME=$_release_ SOURCE_$NAME=$_source_ TOOL_$NAME=$_tool_
732: COMPONENTS_SELECT="$COMPONENTS_SELECT$NAME "
733: for i in $need
734: do NEED_pax="$NEED_pax $NAME/$i"
735: done
736: ;;
737: esac
738: fi
739: done
740: case $COMPONENTS_SELECT in
741: " ") exit 0 ;;
742: esac
743: case $_uncrate_ in
744: ?*) case $NEED_pax in
745: ?*) case $STATE_pax in
746: found) ;;
747: *) echo $_command_: pax required to uncrate$NEED_pax >&2 ;;
748: esac
749: ;;
750: esac
751: exit 0
752: ;;
753: esac
754:
755: #
756: # determine the ordered list of components to (re)build
757: #
758:
759: case $SELECT in
760: " ") COMPONENTS="$ORDER $COMPONENTS_SELECT" ;;
761: *) COMPONENTS=
762: for NAME in $COMPONENTS_SELECT
763: do case $SELECT in
764: *" $NAME "*) COMPONENTS="$COMPONENTS $NAME" ;;
765: esac
766: done
767: ;;
768: esac
769:
770: #
771: # get the component closure
772: #
773:
774: case $_closure_ in
775: "") ORDER=$COMPONENTS
776: ;;
777: *) ORDER=
778: for NAME in $COMPONENTS
779: do old=
780: new=$NAME
781: while :
782: do case $new in
783: $old) break ;;
784: esac
785: dup=
786: for _item_ in $new
787: do # we assume ITEMS_* not in environment
788: eval _items_='"$'ITEMS_$_item_'"'
789: case $_items_ in
790: "") eval _release_='$'RELEASE_$_item_
791: _items_=`cat $_item_/$_release_/items 2>/dev/null`" $_item_"
792: eval ITEMS_$_item_='"$'_items_'"'
793: ;;
794: esac
795: dup="$dup $_items_"
796: done
797: old=$new
798: new=
799: for _item_ in $dup
800: do eval SEEN_$_item_=
801: done
802: for _item_ in $dup
803: do eval seen='$'SEEN_$_item_
804: case $seen in
805: "") eval SEEN_$_item_=1
806: new="$new $_item_"
807: ;;
808: esac
809: done
810: done
811: eval ITEMS_$NAME='"'$new'"'
812: ORDER="$ORDER $new"
813: done
814: dup=$ORDER
815: ORDER=
816: for NAME in $dup
817: do eval SEEN_$NAME=
818: done
819: for NAME in $dup
820: do eval seen='$'SEEN_$NAME
821: case $seen in
822: "") eval SEEN_$NAME=1
823: ORDER="$ORDER $NAME"
824: ;;
825: esac
826: done
827: ;;
828: esac
829: _built_=
830: COMPONENTS=
831: for NAME in $ORDER
832: do case $_exclude_ in
833: *" $NAME "*) continue ;;
834: esac
835: eval _release_='$'RELEASE_$NAME
836: test -f $NAME/$_release_/items || continue
837: case $_force_ in
838: "") _built_=$NAME/$_release_/BUILT
839: eval _items_='$'ITEMS_$NAME
840: for i in $_items_
841: do case " $COMPONENTS " in
842: *" $i "*) _built_=; break ;;
843: esac
844: case $i in
845: $NAME) ;;
846: *) eval _built_='"'$_built_ $i/'$'RELEASE_$i/BUILT'"' ;;
847: esac
848: done
849: case $_built_ in
850: ?*) if $_shipop_ newer $_built_
851: then continue
852: fi
853: ;;
854: esac
855: ;;
856: esac
857: $_trace_ rm -f $NAME/$_release_/BUILT
858: if test "" != "$_force_" -o "" != "$_ignore_" -o ! -f $NAME/$_release_/ERROR
859: then COMPONENTS="$COMPONENTS $NAME"
860: $_trace_ rm -f $NAME/$_release_/ERROR
861: elif test ! -f $NAME/$_release_/BYPASS
862: then echo "$_command_: $NAME/$_release_: new shipment required" >&2
863: fi
864: done
865:
866: #
867: # check if we can use nmake from the start
868: #
869:
870: ACCEPT=nmake
871: _make_=
872: for p in $_path_
873: do if test -f $p/nmake && test "`$p/nmake -n -f - 'error 0 $(MAKEVERSION:@/.*\(..\)\/\(..\)\/\(..\)$/\3\1\2/)' . 2>&1`" -ge "$OLDEST_nmake" 2>/dev/null
874: then _make_=$p/nmake
875: STATE_nmake=installed
876: ACCEPT=
877: break
878: fi
879: done
880: case $_make_ in
881: ""|$BIN/nmake)
882: MAKEPP=$INSTALLROOT/lib/cpp
883: MAKERULES=$INSTALLROOT/lib/make/makerules
884: export MAKEPP MAKERULES
885: _make_=$BIN/nmake
886: ;;
887: esac
888: MAKEPATH=
889: VPATH=
890: export MAKEPATH VPATH
891:
892: #
893: # (re)build the components
894: #
895:
896: cd $INSTALLROOT
897: for NAME in $COMPONENTS
898: do eval _items_='$'ITEMS_$NAME
899: case $_trace_ in
900: "") for i in $_items_
901: do case $i in
902: $NAME) ;;
903: *) eval r='$'RELEASE_$i
904: if test ! -f $SHIP/$i/$r/BUILT
905: then echo "$i needed to build $NAME" >&2
906: echo "$i needed to build $NAME" >> $SHIP/$NAME/$LOG
907: continue 2
908: fi
909: ;;
910: esac
911: done
912: ;;
913: esac
914: eval _release_='$'RELEASE_$NAME _source_='$'SOURCE_$NAME _tool_='$'TOOL_$NAME
915: case $_total_ in
916: ?*) _components_="$_components_ $NAME/$_release_"
917: continue
918: ;;
919: esac
920: echo build $NAME $_release_ >&2
921: $_trace_ cd $_source_
922: case $_trace_ in
923: "") start="`date`"
924: if test -f $_bypass_
925: then touch $SHIP/$NAME/$_release_/BYPASS
926: else case $STATE_nmake in
927: installed|ok)
928: case $NAME in
929: nmake) $_make_ -o "ignorelock mismatch" ${1+"$@"}
930: MAKEPP=$INSTALLROOT/lib/cpp ./nmake -o "ignorelock mismatch" -bcf Makerules.mk
931: MAKEPP=$INSTALLROOT/lib/cpp MAKERULES=./Makerules.mo ./nmake -o "ignorelock mismatch" install ${1+"$@"}
932: ;;
933: *) $_make_ -o "ignorelock mismatch" install ${1+"$@"}
934: ;;
935: esac
936: error=$?
937: ;;
938: *) if test -f Mamfile
939: then # here it is -- make+state in v7 shell
940: case $_read_ in
941: "") case `(echo ok | (read -r a; echo $a) 2>/dev/null)` in
942: ok) _read_='read -r' ;;
943: *) _read_=read ;;
944: esac
945: ;;
946: esac
947: (
948: _list_=
949: _main_=0
950: _mam_=MAM
951: _targ_=install
952:
953: trap "rm -f $_mam_.*.tmp; exit 1" 1 2
954: # some shells die with diff,next,same in vars
955: : > $_mam_.diff.tmp
956: exec 9> $_mam_.list.tmp
957: if test -f $_mam_.list -a -f $_mam_.time
958: then $_shipop_ state $_mam_.list < $_mam_.list | sort > $_mam_.sort.tmp
959: comm -12 $_mam_.time $_mam_.sort.tmp | sed 's/ .*//' > $_mam_.same.tmp
960: rm -f $_mam_.sort.tmp
961: else : > $_mam_.same.tmp
962: fi
963:
964: _index_=_
965: _ifs_=$IFS
966: case $_read_ in
967: "read") # read strips \ -- thanks a lot
968: # tmp file avoids char at a time read
969: sed 's/\\/\\\\/g' Mamfile > $_mam_.read.tmp
970: exec < $_mam_.read.tmp
971: rm -f $_mam_.read.tmp
972: ;;
973: *) exec < Mamfile
974: ;;
975: esac
976: eval `sed -e '1,/^make /d' -e '/^setv /!d' -e 's/^setv \([^ ]*\).*/\1= /' Mamfile`
977: for _data_
978: do eval `echo $_data_ | sed -e 's/\"/\\\\"/g' -e 's/=/=\\"/' -e 's/$/\\"/'`
979: done
980: while IFS=' '; $_read_ _op_ _data_
981: do IFS=$_ifs_
982: case $_op_ in
983: "note") continue
984: ;;
985: "setv") set $_data_
986: eval _data_='$'$1
987: case $_data_ in
988: "") _data_=$1
989: shift
990: eval $_data_="$*"
991: ;;
992: esac
993: continue
994: ;;
995: "make") eval _name_$_index_=$_name_
996: eval _prev_$_index_=$_prev_
997: eval _cmds_$_index_='"'"$_cmds_"'"'
998: eval _attr_$_index_=$_attr_
999: eval _name_=$_data_
1000: _prev_=$_index_
1001: _cmds_=
1002: _attr_=U
1003: case $_main_ in
1004: 0) case $_name_ in
1005: $_targ_)_main_=1 ;;
1006: *) _attr_= ;;
1007: esac
1008: ;;
1009: 1) case $_force_ in
1010: "") grep "^$_name_\$" $_mam_.same.tmp >/dev/null && _attr_= ;;
1011: esac
1012: ;;
1013: *) _attr_=
1014: ;;
1015: esac
1016: case $_attr_ in
1017: *U*) echo $_name_ >> $_mam_.diff.tmp ;;
1018: esac
1019: _index_=_$_index_
1020: eval _name_$_index_=$_name_
1021: eval _prev_$_index_=$_prev_
1022: eval _cmds_$_index_=$_cmds_
1023: eval _attr_$_index_=$_attr_
1024: echo $_name_ >&9
1025: continue
1026: ;;
1027: "prev") case $_attr_ in
1028: *U*) ;;
1029: *) case $_force_ in
1030: "") if grep "^$_data_\$" $_mam_.diff.tmp >/dev/null
1031: then _attr_=U$_attr_
1032: elif grep "^$_data_\$" $_mam_.same.tmp >/dev/null
1033: then :
1034: else _attr_=U$_attr_
1035: fi
1036: ;;
1037: *) _attr_=U$_attr_
1038: ;;
1039: esac
1040: ;;
1041: esac
1042: continue
1043: ;;
1044: esac
1045: case $_index_ in
1046: _) echo $_op_: missing make op >&2; continue ;;
1047: esac
1048: case $_op_ in
1049: "attr") case $_data_ in
1050: "meta"|"suff") _attr_=M ;;
1051: esac
1052: ;;
1053: "exec"|"....")
1054: case $_cmds_ in
1055: "") _cmds_=$_data_
1056: ;;
1057: *) _cmds_="$_cmds_
1058: $_data_"
1059: ;;
1060: esac
1061: ;;
1062: "done") eval _data_=$_data_
1063: _prop_=
1064: case $_name_ in
1065: $_targ_) _main_=2 ;;
1066: esac
1067: case $_data_ in
1068: $_name_)case $_attr_ in
1069: *M*) ;;
1070: *U*) case $_cmds_ in
1071: "") case $_attr_ in
1072: *U*) _prop_=U ;;
1073: esac
1074: ;;
1075: *) eval "($_set_$_cmds_) </dev/null" ||
1076: {
1077: _code_=$?
1078: case $_set_ in
1079: *-*e*) ;;
1080: *) case $_cmds_ in
1081: *if*then*fi*|"||") _code_=0 ;;
1082: esac
1083: ;;
1084: esac
1085: case $_code_ in
1086: 0) ;;
1087: *) echo "*** exit code $_code_ making $_name_" >&2
1088: rm -f $_mam_.*.tmp
1089: exit $_code_
1090: ;;
1091: esac
1092: }
1093: _prop_=U
1094: ;;
1095: esac
1096: ;;
1097: esac
1098: _index_=$_prev_
1099: eval _name_='$'_name_$_index_
1100: eval _prev_='$'_prev_$_index_
1101: eval _cmds_='$'_cmds_$_index_
1102: eval _attr_='$'_attr_$_index_
1103: case $_attr_ in
1104: *U*) ;;
1105: *) _attr_=$_prop_$_attr_ ;;
1106: esac
1107: ;;
1108: *) echo $_data_: $_op_ $_name_ expected >&2
1109: ;;
1110: esac
1111: ;;
1112: esac
1113: done
1114: exec 9>&-
1115: mv $_mam_.list.tmp $_mam_.list
1116: rm -f $_mam_.*.tmp
1117: $_shipop_ state $_mam_.list < $_mam_.list | sort > $_mam_.time
1118: case $_main_ in
1119: 2) ;;
1120: *) echo "*** don't know how to make $_targ_" >&2; exit 1 ;;
1121: esac
1122: exit 0
1123: ); error=$?
1124: # ... indent
1125: elif test -f makefile
1126: then make -f makefile install ${1+"$@"}; error=$?
1127: elif test -f Makescript
1128: then ./Makescript ${1+"$@"}; error=$?
1129: elif test -f $_tool_.bs
1130: then ./$_tool_.bs ${1+"$@"}; error=$?
1131: else echo "$_command_: cannot build $NAME" >&2; error=1
1132: fi
1133: ;;
1134: esac
1135: case $error+$NAME in
1136: 0+nmake) $BIN/nmake -n -f /dev/null debug </dev/null >/dev/null 2>&1 || error=1 ;;
1137: esac
1138: case $error in
1139: 0) touch $SHIP/$NAME/$_release_/BUILT ;;
1140: *) touch $SHIP/$NAME/$_release_/ERROR ;;
1141: esac
1142: fi 2>&1 | tee $SHIP/$NAME/$TMP 1>&2
1143: if test -f $SHIP/$NAME/$_release_/BUILT
1144: then state=ok
1145: elif test -f $SHIP/$NAME/$_release_/BYPASS
1146: then state=bypass
1147: else state=error
1148: fi
1149: {
1150: echo "build $NAME $_release_ $state [$start] [`date`]"
1151: case $ccs in
1152: ?*) echo preroot CCS = $CCS ;;
1153: esac
1154: # some egreps blow this
1155: sed \
1156: -e '/^$/d' \
1157: -e '/^[ ]/d' \
1158: -e '/^+ /d' \
1159: -e '/^[^ ]*:$/d' \
1160: -e '/^[a-z] - /d' \
1161: -e '/^[a-zA-Z_][a-zA-Z_0-9]*$/d' \
1162: -e '/^[a-zA-Z_][a-zA-Z_0-9]*=/d' \
1163: -e '/[Cc]opyright/d' \
1164: -e '/: warning: assignment .* == was expected/d' \
1165: -e '/: warning: if .* no effect/d' \
1166: -e '/: warning: Symbol .* multiply defined/d' \
1167: $SHIP/$NAME/$TMP
1168: rm -f $SHIP/$NAME/$TMP
1169: } >> $SHIP/$NAME/$LOG 2> /dev/null
1170: eval STATE_$NAME=$state
1171: ;;
1172: *) if test -f $_source_/$_bypass_
1173: then $_trace_ "refer to $_source_/$_bypass_ to install $NAME"
1174: else case $STATE_nmake in
1175: installed|ok)
1176: case $NAME in
1177: nmake) $_trace_ $_make_ -o "ignorelock mismatch" ${1+"$@"}
1178: $_trace_ ./nmake -o "ignorelock mismatch" -bcf Makerules.mk
1179: $_trace_ ./nmake -o "ignorelock mismatch" install ${1+"$@"}
1180: ;;
1181: *) $_trace_ $_make_ -o "ignorelock mismatch" install ${1+"$@"}
1182: ;;
1183: esac
1184: ;;
1185: *) if test -f $_source_/Mamfile
1186: then $_trace_ "mamexec < Mamfile"
1187: elif test -f $_source_/Makescript
1188: then $_trace_ ./Makescript ${1+"$@"}
1189: elif test -f $_source_/$_tool_.bs
1190: then $_trace_ ./$_tool_.bs ${1+"$@"}
1191: else $_trace_ install $NAME
1192: fi
1193: ;;
1194: esac
1195: fi
1196: ;;
1197: esac
1198: $_trace_ cd $INSTALLROOT
1199:
1200: #
1201: # accept stuff built before nmake to sync the state files
1202: #
1203:
1204: case $NAME in
1205: $ACCEPT)
1206: for NAME in $COMPONENTS
1207: do eval state='$'STATE_$NAME _source_='$'SOURCE_$NAME
1208: case $state in
1209: ok) case $_trace_ in
1210: "") cd $_source_
1211: {
1212: $BIN/nmake -o "accept ignorelock mismatch" install
1213: } 2>&1 | tee $SHIP/$NAME/$TMP 1>&2
1214: {
1215: echo "accept $NAME"
1216: egrep -v '^([^ ]*:$| |\+ |[a-z] - |[a-zA-Z_][a-zA-Z_0-9]*=|$)' $SHIP/$NAME/$TMP
1217: rm -f $SHIP/$NAME/$TMP
1218: } 2>&1 >> $SHIP/$NAME/$LOG
1219: cd $INSTALLROOT
1220: ;;
1221: *) $_trace_ cd $_source_
1222: $_trace_ $BIN/nmake -o "accept ignorelock mismatch" install
1223: $_trace_ cd $INSTALLROOT
1224: ;;
1225: esac
1226: ;;
1227: esac
1228: done
1229: case $NAME in
1230: $ACCEPT) break ;;
1231: esac
1232: ;;
1233: esac
1234: done
1235: case $_total_ in
1236: ?*) case $RANDOM in
1237: $RANDOM)cd $SHIP
1238: ls -Cd $_components_
1239: ;;
1240: *) PS3=''
1241: eval ' select i in $_components_
1242: do :
1243: done </dev/null'
1244: ;;
1245: esac
1246: exit 0
1247: ;;
1248: esac
1249:
1250: #
1251: # check for installation reports
1252: #
1253:
1254: bypass=
1255: owners=
1256:
1257: for NAME in $COMPONENTS
1258: do eval state='$'STATE_$NAME _release_='$'RELEASE_$NAME _source_='$'SOURCE_$NAME
1259: case $state in
1260: bypass) bypass="$bypass
1261: $_source_/$_bypass_"
1262: ;;
1263: esac
1264: o=$SHIP/$NAME/$_release_/$OWNER
1265: if test -s $o
1266: then r=`cat $SHIP/$NAME/$_release_/$REPORT 2>/dev/null`
1267: case $r in
1268: *\[no\]*) r= ;;
1269: esac
1270: case $r' + '$state in
1271: ?*' + '*|*' + 'error)
1272: address=`cat $o`
1273: owner=`echo $address | sed -e 's/.*\(.............\)/\1/' -e 's/^[^a-zA-Z_]/_/' -e 's/[^a-zA-Z_0-9]/_/g'`
1274: eval f='$'built_$owner
1275: eval built_$owner='"$'f $NAME'"'
1276: report=
1277: for f in $SHIP/$NAME/$LOG $r
1278: do case `ls -dt $f $SHIPSLOG/!$owner 2>/dev/null` in
1279: $f*) report="$report $f" ;;
1280: esac
1281: done
1282: case $report in
1283: ?*) eval f='$'address_$owner
1284: case $f in
1285: "") owners="$owners $owner"
1286: eval address_$owner=$address
1287: ;;
1288: esac
1289: eval eval report_$owner=\\\"\$report_$owner \\\[$NAME\\\] $report\\\"
1290: ;;
1291: esac
1292: ;;
1293: esac
1294: fi
1295: done
1296:
1297: #
1298: # mail the bypass installation message
1299: #
1300:
1301: case $_trace_' + '$bypass in
1302: ' + '?*) $_mail_ $INSTALLER > /dev/null 2>&1 <<!
1303: Subject: software shipment manual installation
1304:
1305: refer to the following for manual installation:$bypass
1306: !
1307: ;;
1308: esac
1309:
1310: #
1311: # mail the installation reports, one per owner
1312: #
1313:
1314:
1315: for owner in $owners
1316: do eval address='$'address_$owner
1317: case $_trace_ in
1318: "") {
1319: eval report='$'report_$owner
1320: echo "Subject: software shipment report"
1321: echo
1322: eval f='"$'built_$owner'"'
1323: case $INSTALLER in
1324: $RECIPIENT) echo "by $FROMSYS!$INSTALLER on [`date`] :" $f ;;
1325: *) echo "by $FROMSYS!$INSTALLER for $RECIPIENT on [`date`] :" $f ;;
1326: esac
1327: id="`(uname -a) 2>/dev/null`"
1328: case $id in
1329: ?*) echo "system $id" ;;
1330: esac
1331: id=
1332: for f in $report
1333: do case $f in
1334: \[*\]) id="$f "; continue ;;
1335: $SHIP/*)echo ----- $id`echo $f | sed 's/.*\///'` ----- ;;
1336: *) echo ----- $id$f ----- ;;
1337: esac
1338: cat $f
1339: case $f in
1340: $SHIP/*/$LOG) rm -f $f ;;
1341: esac
1342: done
1343: } > $SHIPSLOG/!$owner
1344: $_mail_ $address < $SHIPSLOG/!$owner > /dev/null 2>&1
1345: case $? in
1346: 0) ;;
1347: *) $_mail_ $INSTALLER <<!
1348: Subject: please forward this to $address
1349:
1350: `cat $SHIPSLOG/!$owner`
1351: !
1352: ;;
1353: esac
1354: ;;
1355: *) $_trace_ $_mail_ $address "< $SHIPSLOG/!$owner" ;;
1356: esac
1357: done
1358:
1359: #
1360: # check if any components required pax to uncrate
1361: #
1362:
1363: case $NEED_pax in
1364: ?*) case $STATE_pax in
1365: ok) $_trace_ exec $_command_ $_options_ $SELECT ${1+"$@"} ;;
1366: *) echo $_command_: pax required to uncrate$NEED_pax >&2 ;;
1367: esac
1368: ;;
1369: esac
1370:
1371: #
1372: # done
1373: #
1374:
1375: exit 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.