2 # @(#)shipout (gsf@research.att.com) 07/17/95
4 # shipout [ options ... ] [ name ... ] [ tool ... ]
6 # ship software to recipient using system|user info in $SHIPINFO
8 # options -- + turns the corresponding option off
10 # -b ship bases with deltas
11 # -c don't generate tool closure
12 # -d don't ship deltas
13 # -i list info on specified recipient(s) only
14 # -k mark recipient(s) as having received tool(s)
15 # -l file list of people to ship to
16 # -m don't send shipment manifest mail message
17 # -n show but don't execute
18 # -o set shipment ownership to shipper
19 # -p name next argument is a recipient to ship to
20 # -s don't send shipment support files
21 # -t don't execute but show total shipment
22 # -u [[yy]mm]dd ignore db info for date pattern
23 # -v yymmdd override current date stamp
24 # -w shipment suitable for www
25 # -x format pax output format and compression
26 # -C files add to default crate file list
27 # -D secs delay in seconds between sends
28 # -F force db override
29 # -S files add to default support file list
31 # name -- recipient address
33 # machine!user uucp address
34 # host:directory rcp address
35 # *%[beta.]bin[.arch] compressed cpio binary archive in Z/*[.arch]
36 # *%ftp sh script with ftp get's on stdout
37 # *%[beta.]lib[.arch] compressed cpio binary archive in Z/*[.arch]
38 # *%list shipment file list on stdout
39 # *%pull sh script with datakit pull's on stdout
40 # *%push sh script with datakit push's on stdout
41 # *%[beta.]src compressed cpio src archive in Z/*
43 # the message file is evaluated by the shell and the following variables
44 # are predefined by ship:
46 # f list of expanded file names
53 SHIPSLOG=${SHIPSLOG:-shipslog}
54 SHIPINFO=${SHIPINFO:-$SHIPSLOG/info}
55 SHIPFILES="README shipin shipout"
56 SHIPAUX="shipiffe.sh shipop.c shipproto.c"
57 SHIPMENT=*[0-9][0-9][0-9][0-9][0-9][0-9]
58 SHIPPER=${SHIPPER:-${USER:-${LOGNAME:-${HOME##*/}}}}
59 SHIPSPOOL=${SHIPSPOOL:-/usr/spool/uucppublic}
60 SHIPORG=${SHIPORG:-"Software and Systems Research"}
61 SHIPLOGO=${SHIPLOGO:-"http://www1126.research.att.com/logos/attbllogo.gif align=middle"}
62 SHIPMM2HTML=${SHIPMM2HTML:-mm2html}
63 CRATEFILES="copyright items message promo release report"
64 TMP=${TMPDIR:=/tmp}/ship$$
65 FROMSYS=$( (uname -n || hostname || cat /etc/whoami) 2>/dev/null )
67 test -f shipinit && . ./shipinit
71 # print out an error message on unit 2 and exit
72 print -u2 - "$command: $@"
78 print -u2 - "$command: warning: $@"
81 function cleanup # exitcode
98 # send request to dbm server
99 # status returned in db_status
100 # data returned in db_data
103 function db_request # op args ...
106 read -p db_status db_data
108 ?*) print -u2 DB: "$@": $db_status $db_data ;;
112 E) print -u2 $logfile: $db_data; return 1 ;;
121 function db_init # machine user
123 typeset log=$logfile machine=$1 user=$2 i j l
129 grep) db_access=grep ;;
141 do l=${i}${j}lib/ship/log
142 if test -f $l.dir -a -r $l.dir -a -w $l.dir
151 "") log=$SHIPSLOG/log ;;
160 if cs </dev/null >/dev/null 2>&1
161 then cs -i /dev/tcp/share/dbm/group=ship |&
163 if db_request version
164 then db_request open $log w || errexit $log: cannot access log
172 ?*) print -u2 DB: init: access=$db_access logfile=$logfile ;;
176 db_check - $machine $user shipin "*" base || first_time=1
178 grep) typeset -L2 dir=$machine
180 ?*) mv $logfile $SHIPSLOG/.tmp.
181 sort -r < $SHIPSLOG/.tmp. | sort -m -u +0 -1 > $logfile
182 rm -f $SHIPSLOG/.tmp.
185 logfile=$SHIPSLOG/$dir/$machine/$user
186 if test "" = "$force" -a -r "$logfile"
190 "") if test ! -d "$SHIPSLOG/$dir"
191 then mkdir "$SHIPSLOG/$dir" || logfile=$SHIPSLOG/log
193 if test ! -d "$SHIPSLOG/$dir/$machine"
194 then mkdir "$SHIPSLOG/$dir/$machine" || logfile=$SHIPSLOG/log
213 "") case $db_access in
214 dbm) db_request close
218 grep) case $logfile in
219 ?*) mv $logfile $SHIPSLOG/.tmp.
220 sort -r < $SHIPSLOG/.tmp. | sort -m -u +0 -1 > $logfile
221 rm -f $SHIPSLOG/.tmp.
231 # check if < machine user tool version type > was sent
234 function db_check # [ - ] machine user tool version type
236 typeset k key ks sav x nocheck=
238 case $db_disable:$first_time:$force in
239 1:*:*|*:1:*|*:*:1) return 1 ;;
242 -) shift; nocheck=1 ;;
244 typeset a=$1!$2 n=$3 v=$4 t=$5 m
246 "*") ks="base delta" ;;
254 $sav) eval set -- \$db_val_$k
256 *) case $db_access in
257 dbm) if db_request get $key
262 grep) set -- $(grep "^$key" $logfile)
269 eval db_key_$k='$key' db_val_$k='$*'
294 then m=$(shipop time $n/$1/$2)
295 else m=$(shipop time $n)
306 # note that < machine user tool version type > was sent
309 function db_note # machine user tool version type name
321 then m=$(shipop time $3/$4/$5)
322 else m=$(shipop time $3)
324 v="$1!$2,$3,$k $4 $5 $date $SHIPPER $6 $m"
326 dbm) db_request put $v ;;
327 grep) print $v >> $logfile ;;
332 # output SHIPMENT stamp for file [current date]
335 function shipstamp # file
337 typeset -Z2 day month
339 integer mon Jan=1 Feb=2 Mar=3 Apr=4 May=5 Jun=6 \
340 Jul=7 Aug=8 Sep=9 Oct=10 Nov=11 Dec=12
345 *) set -- $(ls -ld $1 2>/dev/null)
351 Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
381 print $year$month$day
385 # prepare $tool for shipping
388 function package # tool [blocks]
391 integer package_blocks=${2-20}
392 integer package_chunk=package_blocks*8*1024
393 integer size i=0 skip=0
397 if test $tool.000 -nt $tool
402 if ((size <= package_chunk))
405 print packaging $tool
409 dd if=$tool of=$tool.$suffix bs=8k skip=$skip count=$package_blocks 2> /dev/null
410 let i=i+1 skip=skip+package_blocks size=size-package_chunk
414 *.\?\?\?) errexit "$tool: cannot package" ;;
419 function gencontrol # tool
422 typeset format=${1#$tool/}
432 print - "cp $date.$SHIPPER/${tool%/*} \$INSTALLROOT/ship" >> $TMP.u
437 print - "if test ! -f \$INSTALLROOT/ship/$tooldir/items"
438 set -- $tool/$format$parts
440 1) print - "then if test -f $tool/$format$parts"
443 *) print - "then _unspool_nope=
450 case \$_unspool_nope in"
455 base|delete) init= ;;
459 "") print - " $prefix if test ! -d \$INSTALLROOT/ship/$tooldir
460 then mkdir \$INSTALLROOT/ship/$tooldir
462 rm -rf \$INSTALLROOT/ship/$tool
463 mkdir \$INSTALLROOT/ship/$tool"
467 print - " $prefix cat $tool/$format$parts > \$INSTALLROOT/ship/$tool/$format"
468 print - " rm -f $tool/$format$parts"
470 "") for i in $CRATEFILES
471 do if test -s $tool/$i
472 then print - " echo \"$(cat $tool/$i 2>/dev/null)\" > \$INSTALLROOT/ship/$tool/$i"
473 elif test -f $tool/$i
474 then print - " : > \$INSTALLROOT/ship/$tool/$i"
479 else if test "" = "$shipper" -a -s $tool/owner
480 then owner=$(<$tool/owner)
484 ${owner%%!*}) owner=${TOSYS%!*}!$owner ;;
485 *) owner=$TOSYS!$owner ;;
488 print - " echo \"$owner\" > \$INSTALLROOT/ship/$tool/owner"
502 function instructions # first
504 integer item=0 first=$1
505 typeset tool pack packages omit main
509 As a repeat recipient:"
512 ($((item=item+1))) This shipment includes an update to the installation support tools.
513 Any tools that failed to build previously will be attempted again."
518 As a first time recipient:"
523 ($((item=item+1))) Wait for a \\\`copy succeeded' message from uucp for the file:
525 \$user/$FROMSYS/$date.$SHIPPER/manifest"
528 ($((item=item+1))) For safety do not run as root. If you are not running as \$user then:
533 packages=$(for tool in "${ship_list[@]}"
535 if test -f $tool/Mamfile
536 then sed -e '/^setv PACKAGE/!d' -e 's/^setv / /' -e 's/ /=/' -e 's/\$/\\&/g' $tool/Mamfile
538 done | sort -t= -u +0 -1)
541 for tool in "${ship_list[@]}"
543 lib*) tool=${tool%%/*}
547 *) omit="$omit|$tool" ;;
553 ?*) main=$(echo "$packages" | egrep "PACKAGE_($omit)[=_]" | sed -e 's/^ PACKAGE_\([^_=]*\).*/\1/' | sort -u)
554 packages=$(echo "$packages" | egrep -v "PACKAGE_($omit)[=_]")
561 ($((item=item+1))) Name the directory under which previous shipments were installed:
563 INSTALLROOT=<shipment-root-directory>"
569 A good final installation directory name would be /usr/add-on/$main." ;;
572 ($((item=item+1))) Create a shipment root directory under which all source and binaries
573 will be generated. This should not be a final installation directory.$main
575 INSTALLROOT=<shipment-root-directory>
576 test -d \\\$INSTALLROOT || mkdir \\\$INSTALLROOT
578 test -d ship || mkdir ship"
583 ($((item=item+1))) If $uuspool/\$user/$FROMSYS was copied to \\\$SPOOLROOT then:
585 SHIPSPOOL=\\\$SPOOLROOT
589 ($((item=item+1))) If your system has att and bsd/ucb universes then in general the tools
590 will have more functionality when built in the bsd/ucb universe. The
591 exception is on solaris where /usr/ucb/cc is fubar. Set cc by:
593 CC='hackcc -systype bsd43' CCFLAGS='-g' # just an example #
598 ($((item=item+1))) This shipment refers to some installation dependent software packages.
599 Redefine and export any of the following definitions that are incorrect:
606 ($((item=item+1))) Execute the following commands to unpack and install the shipment:
611 cp \\\${SHIPSPOOL-$uuspool/\$user/$FROMSYS}/$date.$SHIPPER/shipin ship/shipin
612 chmod 0755 ship/shipin"
616 nohup ksh ship/shipin &"
619 ($((item=item+1))) Use shipout within \\\$INSTALLROOT/ship to ship to other machines.
620 \\\$INSTALLROOT/ship/README contains more detailed information."
624 function buildscript # machine user
626 # create mscript to execute as a . script
628 integer delta=0 first=1 no_shipin
629 mscript=$TMP.s tfile=$TMP.f
632 print "cat > $tfile <<!EOF!"
633 print "Subject: software shipment"
643 Dear ${name#*,} ${name%,*}:" ;;
649 if db_check $1 $2 shipin "*" base
653 instructions $((first_time||no_shipin))
656 typeset -L n='tool ' d='release '
659 This distribution contains:
667 for tool in "${ship_list[@]}"
668 do format=${tool##*/}
669 tool=${tool%/$format}
670 test -r $tool && eval _notes_${tool%%/*}=0
678 if pax -f $tool/$format -z - 2>/dev/null | egrep 'DELTA!!!|!PAX!D!' >/dev/null
679 then t="$format delta" delta=1
680 else t="$format patch"
683 *) errexit "$format: invalid format"
691 Unpacking delta shipments requires the new pax command.
694 for tool in "${ship_list[@]}"
695 do if test ! -r $tool
699 tool=${tool%/$format}
700 if test -s "$tool/message"
701 then item=${tool%%/*}
702 eval x='$'_notes_$item
709 1) if cmp -s "$tool/message" "$item/$format/message"
720 elif test -f $HOME/.signature
721 then cat $HOME/.signature
725 "") print 'mail $mail < $tfile'
727 *) print 'print "mail $mail <<!EOF!"'
737 function tosys # machine
739 # construct return mail address
745 *) TOSYS=$i!$TOSYS ;;
754 function genshiplist # machine user mail
756 typeset tool file x n v t need_pax= missing=
761 db_check - $1 $2 pax "*" base || need_pax=1
766 for file in $SHIPFILES
767 do v=$(shipstamp $file)
768 if db_check $machine $user $file $v base
771 ship_list[i]=$file/$v/base
774 *" $file "*) redo=1 ;;
778 for tool in "${tool_list[@]}"
792 if db_check $machine $user $n $t "*"
793 then case $basetoo in
795 "") db_note $machine $user $n $t base $name ;;
798 ?*) if db_check $machine $user $n $v base
800 elif test -f $n/$v/base
801 then ship_list[i]=$n/$v/base
803 else print -u2 "$n/$v/base: missing base archive"
808 elif test -f "$n/$v/base"
809 then if db_check $machine $user $n $v base
811 else ship_list[i]=$n/$v/base
817 elif test -f $n/$t/base
818 then ship_list[i]=$n/$t/base
820 else print -u2 "$n/$t/base: missing base archive"
825 if db_check $machine $user $n $v $t
827 else ship_list[i]=$tool
838 "") print -u2 "$mail is up to date" ;;
839 *) print -u2 "\\n$mail: up to date" ;;
845 ?*) case $user:$noexec in
846 ?*:) for tool in "${ship_list[@]}"
849 db_note $machine $user ${tool%%/*} $x ${tool##*/} $name
858 ?*) print -u2 "\\n$mail:"
860 select i in ${ship_list[*]}
869 function sendcontrol # machine user
871 # $transport the control file to <user> on given <machine>
873 uucp) typeset dest=$1!$uupublic/$2/$FROMSYS/$date.$SHIPPER
875 $date.$SHIPPER/unspool
876 $date.$SHIPPER/manifest" > $TMP.m
877 print uucp -r -C $TMP.u $dest/unspool
879 "") uucp -r -C $TMP.u $dest/unspool ;;
882 ?*) print $date.$SHIPPER/id >> $TMP.m
883 id="$SHIPPER SEAL $(date) $1!$2"
884 print "$1!$SHIPID $id" > $TMP.i
885 print uucp -r -C $TMP.i $dest/id
887 "") uucp -r -C $TMP.i $dest/id ;;
890 "") print "$id\\t$(shipop seal $lclfiles $TMP.u $TMP.m $TMP.i)" >> $SHIPSLOG/seals
895 print uucp -r -C -m -n"$2" $TMP.m $dest/manifest
897 "") uucp -r -C -m -n"$2" $TMP.m $dest/manifest ;;
900 uuto) print uuto -m $TMP.u $1!$2
902 "") uuto -m $TMP.u $1!$2 ;;
923 typeset i j tool file
926 ?*) fixedname=${name%% *}
927 print "$fixedname $address $phone $mail $company $project $transport"
930 user=${mail##*!} machine=${mail%!*}
931 user=${user%%@*} machine=${machine#*@}
932 target=$machine!~/$user/$FROMSYS
937 uuto) uuspool=$uuspoool/receive
939 print -u2 $transport: transport not supported for $user
942 *) print -u2 $transport: unknown transport for $user
946 if genshiplist $machine $user $mail
951 for i in "${ship_list[@]}"
956 do print - "for i in \$INSTALLROOT/ship/${i%/*}/*"
957 print - "do if test -d \$i -a ! -f \$i/BUILT"
958 print - " then rm -f \$i/[BEU]*"
964 buildscript $machine $user
966 for tool in "${ship_list[@]}"
967 do for i in $tool.???
975 else # here for $SHIPFILES
976 i=${tool%%/*}; j=$date.$SHIPPER/$i
982 then lclfiles="$lclfiles $i"
986 *) rmtfiles="$rmtfiles
990 print uucp -r $nocopy $PWD/"$i" "$dfile"
992 "") uucp -r $nocopy $PWD/"$i" "$dfile"
1001 "") db_note $machine $user ${tool%%/*} $i ${tool##*/} $name ;;
1007 sendcontrol $machine $user
1010 function dosend # recipient open
1012 # lookup <recipient> in database and transport software to them
1013 # if <open> is given, the database is re-opened
1017 *%beta.*|*%bin*|*%ftp|*%lib*|*%list|*%pull|*%push|*%src)
1020 transport=${addr##*'%'}
1022 user=${addr%"$machine"}
1024 beta.*) beta=$SHIPPER transport=${transport#beta.} ;;
1030 out=${user:-${transport%%.*}}
1033 bin) arch=${PWD%/ship}
1038 *) a=${HOSTTYPE:-$(hostinfo type)}
1046 bin.*) arch=${transport#bin.}
1054 lib) arch=${PWD%/ship}
1059 *) a=${HOSTTYPE:-$(hostinfo type)}
1063 type="$a binary and library"
1069 lib.*) arch=${transport#lib.}
1072 type="$arch binary and library"
1088 arch=${PWD%/arch/*}/arch/$arch
1089 export INSTALLROOT=$arch
1090 vpath $arch ${PWD%/arch/*} 2>/dev/null
1091 export VPATH=$arch:${PWD%/arch/*}
1092 for f in $arch/lib/probe/C/make/[!p]*bincc $arch/lib/probe/C/make/[!p]*cc $arch/lib/probe/C/make/[!p]*
1094 then ccprobe=CC.PROBE=$f
1102 MAKE=$(whence nmake)
1113 *@*) user=${host%@*}
1118 '~'*) user=${user#~} ;;
1125 *!*) name=${1##*!} transport=uucp
1127 *@*) name=${1%%@*} transport=uucp
1133 uucp) address= phone= mail=$1 project=
1137 db) typeset -l given match
1138 case $shipinfo_test in
1139 "") if test ! -f "$SHIPINFO"
1140 then errexit "$SHIPINFO: cannot find information file"
1146 ?*) exec 3< $SHIPINFO ;;
1149 while IFS=: read -ru3 name address phone mail company project unused transport comments
1160 if genshiplist $machine $user $mail
1165 ftp) ftp_address=$(cs -a addr $FROMSYS 2>/dev/null || print - $FROMSYS) ;;
1170 *) case $transport in
1173 *) print - "umask 02"
1177 ftp) print - 'case $INSTALLROOT in'
1178 print - '?*) if test -d $INSTALLROOT'
1179 print - ' then cd $INSTALLROOT'
1180 print - ' else echo "$0: $INSTALLROOT: invalid INSTALLROOT" >&2'
1185 print - 'if test ! -d ship'
1186 print - 'then mkdir ship || exit 1'
1189 print - 'if test -r "$HOME/.netrc" && grep -c "machine[ ]*'$ftp_address'[ ]*" "$HOME/.netrc"'
1191 print - 'else echo "machine '$ftp_address' login anonymous password '$user'" >> "$HOME/.netrc"'
1192 print - ' chmod 0600 "$HOME/.netrc"'
1196 for i in "${ship_list[@]}"
1202 while test "$s" != file
1203 do if test "" != "$p"
1204 then case $transport in
1209 *) print - "if test ! -d $dir/$p"
1210 print - "then mkdir $dir/$p"
1219 for f in $CRATEFILES
1221 then case $transport in
1223 print - "$dir/$i/$f"
1225 *) print - "echo \"$(cat $i/$f 2>/dev/null)\" > $dir/$i/$f"
1229 then case $transport in
1231 print - "$dir/$i/$f"
1234 *) print - "> $dir/$i/$f"
1241 if test "" = "$www" -a -s $i/owner
1242 then print - "$dir/$i/owner"
1245 *) if test "" != "$www"
1247 else if test "" = "$shipper" -a -s $i/owner
1248 then owner=$(<$i/owner)
1251 case ${TOSYS##*!} in
1252 ${owner%%!*}) owner=${TOSYS%!*}!$owner ;;
1253 *) owner=$TOSYS!$owner ;;
1256 print - "echo \"$owner\" > $dir/$i/owner"
1264 *) print - "rm -f $dir/ship.$date"
1268 ftp) print - '${FTP-ftp} $FTP_ADDRESS <<!!!'
1269 print - 'user anonymous'
1270 print - 'type image'
1271 print - 'cd $FTP_INSTALLROOT/ship'
1275 esac | case $transport:$noexec in
1279 test -d Z || mkdir Z
1282 print - "(cd $arch; pax -w $paxformat) > Z/$out.Z <<!!!"
1285 ftp:*) print - ': get shipment from remote ftp host'
1286 print - 'case $# in'
1288 print - '*) echo "Usage: $0 [ftp-address [remote-INSTALLROOT]]" >&2; exit 1 ;;'
1290 print - 'FTP_ADDRESS=${1-'$ftp_address'}'
1291 print - 'FTP_INSTALLROOT=${2-.}'
1296 pull:*) print - ': pull shipment from remote dk host'
1297 print - 'case $# in'
1299 print - '*) echo "Usage: $0 dk-address [remote-INSTALLROOT]" >&2; exit 1 ;;'
1301 print - 'DK_ADDRESS=$1'
1302 print - 'DK_INSTALLROOT=${2-.}'
1305 push:*) print - ': push shipment to remote dk host'
1306 print - 'case $# in'
1308 print - '*) echo "Usage: $0 dk-address [remote-INSTALLROOT]" >&2; exit 1 ;;'
1310 print - 'push $1 - ${2:+$2/}ship <<"!!!"'
1314 rcp $TMP.r $host:$dir/ship.$date || exit
1317 "") for i in rcmd remsh
1318 do if ($i $host date) >/dev/null 2>&1
1328 $rsh $host sh $dir/ship.$date || exit
1332 print - "' > ship.$date"
1333 print - "rcp ship.$date $host:$dir"
1334 print - "rm ship.$date"
1335 print - "rsh $host sh $dir/ship.$date"
1342 for tool in "${ship_list[@]}"
1343 do if test ! -f $tool
1349 then case $transport in
1360 lib*) cd src/lib/$i ;;
1365 bin) list=$list.$transport ;;
1367 INSTALLROOT=$r $MAKE -o 'accept noexec mismatch reread silent' $list $ccprobe
1388 *) print - cd '$FTP_INSTALLROOT'/ship/${i%/*}
1390 .) print - lcd $t ;;
1391 *) print - lcd ../../$t ;;
1396 print - get ${i##*/}
1397 test -x $i && chmod="$chmod $i"
1406 print - echo pull '$DK_ADDRESS' '$DK_INSTALLROOT'/ship/$i $t
1407 print - pull '$DK_ADDRESS' '$DK_INSTALLROOT'/ship/$i $t
1409 rcp) print rcp "$i" "$dfile"
1411 "") rcp "$i" "$dfile" || exit ;;
1414 src) print - "ship/$i"
1417 *) skip=${tool%%/*} ;;
1424 case $user:$noexec in
1425 ?*:) db_note $machine $user ${tool%%/*} $i ${tool##*/} $name ;;
1436 case $transport:$noexec in
1438 test "" != "$www" && {
1446 print - ".TL - - \"$SHIPORG\" \"$SHIPLOGO\"
1447 Software Shipment Contents
1452 if test -f ship.${out%%.*}.promo
1454 cat ship.${out%%.*}.promo
1457 print - "The shipment contains:
1460 bin) ls -Cd $(ls -d $items 2>/dev/null | grep -v '^lib') 2>/dev/null ;;
1461 *) ls -Cd $items 2>/dev/null ;;
1465 for tool in "${ship_list[@]}"
1471 if test -f $tool/promo
1476 if test -f $tool/release
1478 "") print - ".H 1 ${tool%/*}"
1490 If you have problems send mail to
1491 .I advsoft@attmail.att.com
1494 in the subject field."
1495 } | $SHIPMM2HTML >Z/$out.H
1498 print - "# the following ${beta:+beta }$type shipment"
1499 print - "# of $out has been sent"
1501 ?*) print - "# this beta shipment may only be interface compatible with itself"
1502 print - "# other shipments will be reconciled after beta testing"
1507 bin) ls -Cd $(ls -d $items 2>/dev/null | grep -v '^lib') 2>/dev/null ;;
1508 *) ls -Cd $items 2>/dev/null ;;
1509 esac | sed 's/^/# /'
1511 print - "# to install:"
1513 print - "INSTALLROOT=<installation-root-dir>${beta:+/beta.$beta}"
1514 print - "SHIPMENT=<shipment-.Z-file>"
1515 print - "cd \$INSTALLROOT"
1516 print - "$paxuncompress \$SHIPMENT | $paxunformat"
1518 bin|lib)(cd $arch; ls -ld $(<$TMP.f) 2>/dev/null) > $TMP.s
1519 for f in $(sed -e '/^-..s..s/!d' -e 's/.* //' $TMP.s)
1520 do set x $(cd $arch; ls -ld $f 2>/dev/null)
1523 set x $(cd $arch; ls -ldg $f 2>/dev/null)
1529 print - "chgrp $g $f || echo ship: $f would be more efficient if owned by group $g >&2"
1531 sed -e '/^-..s/!d' -e 's/^-..s..s.* /chmod ug+s /' -e 's/^-..s.* /chmod u+s /' $TMP.s
1534 do test -f $f/binary && cat $f/binary
1537 src) print - "nohup ksh ship/shipin &"
1543 print - "export LD_LIBRARY_PATH=\$INSTALLROOT/lib\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}"
1544 print - "export PATH=\$INSTALLROOT/bin:\$PATH"
1545 print - "export FPATH=\$INSTALLROOT/fun\${FPATH:+:\$FPATH}"
1548 bin) (cd $arch; sort -u $TMP.f | egrep -v '^(include/.*|lib/lib.*\.a)$' | pax -Lw $paxformat; rm $TMP.f) > Z/$out.Z ;;
1549 *) (cd $arch; sort -u $TMP.f | pax -Lw $paxformat; rm $TMP.f) > Z/$out.Z ;;
1552 bin:*|ftp:*|lib:*|push:*|src:*)
1554 ftp) print - 'quit' ;;
1558 ?*) print - "chmod +x$chmod" ;;
1565 print -u2 "$command: address for $1 not found"
1569 function closure # tools
1573 do if test ! -d $tool
1574 then case $original in
1575 *" ${tool%/*} "*|*" $tool "*) warning "${tool%/*}: invalid tool" ;;
1578 */?*) release=${tool#*/}
1581 *) eval items=\"\$items_$item\"
1584 *) eval release=\$release_$tool ;;
1588 eval release_${tool%/*}=$release
1589 tools="$tools $tool"
1594 # now generate the closure of the top level tools and releases
1606 do # we assume items_* not in environment
1607 eval items=\"\$items_$item\"
1609 "") eval release=\$release_$item
1611 "") set -- $item/$SHIPMENT
1614 "$item/$SHIPMENT") continue ;;
1617 eval release_$item=$release
1619 if test ! -f $item/$release/items
1620 then if test ! -f $item/$release/delete
1624 else case $closure in
1626 *) items=$(<$item/$release/items)" $item" ;;
1629 eval items_$item=\"$items\"
1640 do eval seen=\$seen_$item
1642 "") eval seen_$item=1
1651 function undup # tools
1658 do eval seen=\$seen_$item
1660 "") eval seen_$item=1
1661 tools="$tools $item"
1667 integer dtime=0 i=0 nrecipient=0 first_time=1 delay=0
1668 info= mark= list= logfile= message=1 nocopy= noexec= format=$SHIPMENT
1669 shipinfo_test= force= shipper= closure=1 undo= date= basetoo= www=
1670 paxformat= paxunformat= paxcompress= paxuncompress=
1678 +d) format=$SHIPMENT ;;
1679 -i) info=1 delay=0 ;;
1680 -k) mark=1 delay=0 ;;
1681 -l) shift; list=$1 ;;
1685 -n) noexec=1 delay=0 ;;
1689 -p) shift; recipient_list[nrecipient]=$1; nrecipient=nrecipient+1 ;;
1692 -t) total=1 noexec=1 delay=0 ;;
1693 -u) shift; undo=$1 ;;
1695 -v) shift; date=$1 ;;
1707 -C) shift; CRATEFILES="$CRATEFILES $1" ;;
1708 -D) shift; delay=$1 ;;
1712 -L) shift; logfile=$1 ;;
1713 -S) shift; SHIPFILES="$SHIPFILES $1" ;;
1714 *[,:!%@]*)recipient_list[nrecipient]=$1;nrecipient=nrecipient+1 ;;
1716 -*|+*) print -u2 "Usage: $command [-bcdikmnostfF] [-l recipient-list] [-p recipient] [-u [[yy]mm]dd] [-v yymmdd] [-x format] [-C crate-file] [-D delay] [-S support-file] [recipient ...] [tool ...]"; exit 2 ;;
1722 ?*) case $paxformat in
1723 "") paxformat=tar ;;
1725 case $paxcompress in
1726 "") paxcompress=gzip ;;
1730 case $paxcompress in
1732 paxcompress=compress
1733 paxuncompress="zcat <"
1735 gzip) paxuncompress="(gunzip || zcat) <"
1739 "") paxformat=cpio ;;
1742 cpio) paxunformat="cpio -icdvmu" ;;
1743 tar) paxunformat="tar xvf -" ;;
1744 *) paxunformat="pax -rv" ;;
1747 ?*) paxformat="-x $paxformat" ;;
1749 case $paxcompress in
1750 ?*) paxformat="-x $paxcompress $paxformat" ;;
1754 *) date=$(shipstamp) ;;
1756 ($SHIPMM2HTML) >/dev/null 2>&1 || SHIPMM2HTML=cat
1758 "") if test 0 = "$nrecipient" -a ! -f "$list"
1759 then errexit "no recipient(s)"
1761 trap 'cleanup $?' EXIT INT TERM
1763 # generate the tools list
1769 do set -- $tool/$SHIPMENT
1771 "$tool/$SHIPMENT") ;;
1772 *) tools="$tools $tool" ;;
1776 "") errexit "no tools" ;;
1783 "") errexit "no 'items' file(s)" ;;
1787 case $closure:$format:$SHIPFILES in
1788 :*|*:|*:base:*|*:delete:*)
1790 *) set -- pax/$SHIPMENT
1800 undup $tools_pax $tools_usr
1802 for tool in $tools_pax
1803 do eval type_$tool=pax
1805 for tool in $tools_usr
1806 do eval type_$tool=usr
1810 do eval tool=$tool/\$release_$tool
1812 for f in delete "$format" base
1820 "") if test ! -d ${tool%/*}
1821 then case $original in
1822 *" ${tool%/*} "*|*" $tool "*) warning "${tool%/*}: invalid tool" ;;
1827 base) set -- $tool/$SHIPMENT
1829 then eval release_${tool%/*}=${1##*/}
1830 tool=${tool%/*}/${1##*/}
1832 warning "${tool}: latest base not crated"
1833 else warning "${tool}: base not crated"
1846 *) tool=${tool%/*}/$item/base
1848 then errexit "${tool%/*}: $item base not crated"
1852 tool_list[i]=$tool;i=i+1
1855 *) typeset -lL16 fixedname
1856 typeset -L9 address project
1859 typeset -L11 company
1862 if test ! -d $SHIPSLOG
1863 then mkdir $SHIPSLOG || errexit "$SHIPSLOG: cannot create log directory"
1866 SHIPID=$FROMSYS!$SHIPPER
1868 ?*) SHIPFILES="$SHIPFILES $SHIPAUX"
1869 for file in $SHIPFILES
1870 do if test ! -r $file
1871 then print -u2 "$file: cannot read"; exit 1
1878 ""|??????*) break ;;
1885 "") set -s -- "${recipient_list[@]}"
1887 ?*) if test ! -r "$list"
1888 then errexit "$list: cannot read"
1889 else set -s -- "${recipient_list[@]}" $(sed -e '/^#/d' -e 's/[: ].*//' $list)
1897 if dosend "$recipient" $flag
1899 case $noexec$info in
1900 "") print "$name" >> ${tool%/*}/list ;;
1904 if ((delay > dtime))