Print this page
4108 remove ON_CRYPTO_BINS from tools


 319                 if (modmatch($3))
 320                         print
 321         }
 322         $1 == "CONF" {
 323                 if (modmatch($6))
 324                         print
 325         }
 326         $1 == "SYMLINK" {
 327                 if (modmatch($7))
 328                         print
 329         }
 330         $1 == "LINK" {
 331                 if (modmatch($4))
 332                         print
 333         }
 334         ' $1 > $1.new
 335         mv $1.new $1
 336 }
 337 
 338 #
 339 # Unpack the crypto tarball into the given tree, then massage the
 340 # tree so that the binaries are all in objNN or debugNN directories.
 341 #
 342 function unpack_crypto {
 343         typeset tarfile=$1
 344         typeset ctop=$2
 345         [ -d "$ctop" ] || fail "Can't create tree for crypto modules."
 346 
 347         [ "$VERBOSE" = "V" ] && echo "unpacking crypto tarball into $ctop..."
 348         bzcat "$tarfile" | (cd "$ctop"; tar xf -)
 349 
 350         typeset root="$ctop/proto/root_$MACH"
 351         [ $OBJD = obj ] && root="$ctop/proto/root_$MACH-nd"
 352         [ -d "$root" ] || fail "Can't unpack crypto tarball."
 353 
 354         (cd "$root"; for d in platform kernel usr/kernel; do
 355                 [ ! -d $d ] && continue
 356                 find $d -type f -print
 357         done) | while read file; do
 358                 typeset dir=$(dirname "$file")
 359                 typeset base=$(basename "$file")
 360                 typeset type=$(basename "$dir")
 361                 if [ "$type" = amd64 ]; then
 362                         newdir="$dir/${OBJD}64"
 363                 elif [ "$type" = sparcv9 ]; then
 364                         newdir="$dir/${OBJD}64"
 365                 else
 366                         newdir="$dir/${OBJD}32"
 367                 fi
 368                 mkdir -p "$root/$newdir"
 369                 [ "$VERBOSE" = "V" ] && echo "mv $file $newdir"
 370                 mv "$root/$file" "$root/$newdir"
 371         done
 372 }
 373 
 374 #
 375 # usage: fixcrypto listfile ctop
 376 # Massage entries in listfile for crypto modules, so that they point
 377 # into ctop.
 378 #
 379 function fixcrypto {
 380         typeset listfile=$1
 381         typeset ctop=$2
 382 
 383         typeset ccontents=/tmp/crypto-toc$$
 384         find "$ctop" -type f -print > $ccontents
 385         typeset root=root_$MACH
 386         [ "$OBJD" = obj ] && root=root_$MACH-nd
 387 
 388         grep -v ^MOD $listfile > $listfile.no-mod
 389         grep ^MOD $listfile | while read tag srcdir module targdir size impl; do
 390                 #
 391                 # We don't just grep for ${OBJD}$size/$module because
 392                 # there can be generic and platform-dependent versions
 393                 # of a module.
 394                 #
 395                 newsrcfile=$(grep -w $root/$targdir/${OBJD}$size/$module $ccontents)
 396                 if [ -n "$newsrcfile" ]; then
 397                         # srcdir doesn't include final objNN or debugNN
 398                         echo $tag $module $targdir $size $impl \
 399                             $(dirname $(dirname "$newsrcfile"))
 400                 else
 401                         echo $tag $module $targdir $size $impl $srcdir
 402                 fi
 403         done > $listfile.mod
 404         cat $listfile.mod $listfile.no-mod > $listfile
 405 
 406         rm -f $listfile.mod
 407         rm -f $listfile.no-mod
 408         rm -f $ccontents
 409 }
 410 
 411 #
 412 # Copy a module, or create a link, as needed.
 413 #
 414 
 415 function copymod {
 416         case $1 in
 417         MOD)
 418                 targdir=$INSTALL_FILES/$4
 419                 tstmkdir $targdir
 420                 target=$targdir/$3
 421                 verbose "$INSTALL_CP $2/${OBJD}$5/$3 $target"
 422                 $INSTALL_CP $2/${OBJD}$5/$3 $target || \
 423                     fail "can't create $target"
 424                 ;;
 425         SYMLINK)
 426                 targdir=$INSTALL_FILES/$4
 427                 tstmkdir $targdir
 428                 target=$targdir/$5
 429                 rm -f $target
 430                 verbose "ln -s $3 $target"
 431                 ln -s $3 $target || fail "can't create $target"


 525                                         break;
 526                                 fi
 527                         fi
 528                 done
 529                 if [ -z $make ]; then
 530                         make=/usr/ccs/bin/make
 531                         echo "Warning: dmake 7.3 doesn't work with Install;" \
 532                                 "using $make"
 533                 fi
 534         fi
 535 
 536         #
 537         # Get a list of all modules, configuration files, and links
 538         # that we might want to install.
 539         #
 540         verbose "Building module list..."
 541         (cd $KARCH; MAKEFLAGS=e $make -K $MODSTATE modlist.karch) | \
 542             egrep "^MOD|^CONF|^LINK|^SYMLINK" > $modlist
 543         [ "$VERBOSE" = "V" ] && cat $modlist
 544         check_modlist $modlist
 545         if [ -n "$ON_CRYPTO_BINS" ]; then
 546                 cryptotar="$ON_CRYPTO_BINS"
 547                 if [ "$OBJD" = obj ]; then
 548                         isa=$(uname -p)
 549                         cryptotar=$(echo "$ON_CRYPTO_BINS" |
 550                             sed -e s/.$isa.tar.bz2/-nd.$isa.tar.bz2/)
 551                 fi
 552                 [ -f "$cryptotar" ] || fail "crypto ($cryptotar) doesn't exist"
 553                 cryptotree=$(mktemp -d /tmp/crypto.XXXXXX)
 554                 [ -n "$cryptotree" ] || fail "can't create tree for crypto"
 555                 unpack_crypto "$cryptotar" "$cryptotree"
 556                 #
 557                 # fixcrypto must come before fixglom, because
 558                 # fixcrypto uses the unglommed path to find things in
 559                 # the unpacked crypto.
 560                 #
 561                 fixcrypto $modlist "$cryptotree"
 562         fi
 563         if [ "$GLOM" = "yes" ]; then
 564                 fixglom $modlist $GLOMNAME
 565                 filtimpl $modlist $IMPL
 566         fi
 567         if [[ -n "$files" && "$files" != All ]]; then
 568                 filtmod $modlist "$files"
 569         fi
 570 
 571         #
 572         # Copy modules and create links.  For architectures with both
 573         # 32- and 64-bit modules, we'll likely have duplicate
 574         # configuration files, so do those after filtering out the
 575         # duplicates.
 576         #
 577         verbose "Copying files to ${INSTALL_FILES}..."
 578 
 579         #
 580         # The IFS is reset to the newline character so we can buffer the
 581         # output of grep without piping it directly to copymod, otherwise
 582         # if fail() is called, then it will deadlock in fail()'s wait call


 717                 b64srcdir="v9"
 718                 b64tgtdir="sparcv9"
 719                 b32srcdir="v7"
 720                 b32tgtdir="."
 721         fi
 722 
 723         typeset foundkmdb=no
 724         typeset kmdbpath=
 725         typeset destdir=
 726 
 727         platdir=$INSTALL_FILES/platform/$KARCH/$GLOMNAME
 728         if [[ $GLOM = "yes" ]] ; then
 729                 machdir=$platdir
 730         else
 731                 machdir=$INSTALL_FILES/kernel
 732         fi
 733 
 734         srctrees=$SRC
 735         if [[ -d $SRC/../closed && "$CLOSED_IS_PRESENT" != no ]]; then
 736                 srctrees="$srctrees $SRC/../closed"
 737         else
 738                 if [ -z "$ON_CRYPTO_BINS" ]; then
 739                         echo "Warning: ON_CRYPTO_BINS not set; pre-signed" \
 740                             "crypto not provided."
 741                 fi
 742         fi
 743         if [[ $WANT64 = "yes" ]] ; then
 744                 # kmdbmod for sparc and x86 are built and installed
 745                 # in different places
 746                 if [[ $(mach) = "i386" ]] ; then
 747                         kmdbpath=$SRC/cmd/mdb/$isadir/$b64srcdir/kmdb/kmdbmod
 748                         destdir=$machdir/misc/$b64tgtdir
 749                 else
 750                         kmdbpath=$SRC/cmd/mdb/$KARCH/$b64srcdir/kmdb/kmdbmod
 751                         destdir=$platdir/misc/$b64tgtdir
 752                 fi
 753 
 754                 if kmdb_copy_kmdbmod $kmdbpath $destdir ; then
 755                         foundkmdb="yes"
 756 
 757                         for tree in $srctrees; do
 758                                 kmdb_copy_machkmods \
 759                                     $tree/cmd/mdb/$isadir/$b64srcdir \
 760                                     $machdir/kmdb/$b64tgtdir
 761                                 kmdb_copy_karchkmods $tree/cmd/mdb/$KARCH \
 762                                     $platdir/kmdb/$b64tgtdir $b64srcdir


 855                 echo "Fatal errors from rsh:"
 856                 cat fatal
 857                 remote_fail "Can't install on $TARGET_MACHINE"
 858         fi
 859         if [ -s nonfatal -a "$VERBOSE" != "q" ]; then
 860                 echo "Non-fatal errors from rsh:"
 861                 cat nonfatal
 862         fi
 863         rm -f fatal nonfatal errors
 864         test "$IMODE" = "T" && echo "Files can be extracted on \
 865 $TARGET_MACHINE using 'tar xvf $TARGET_DIR/Install.tar'"
 866         STATE=4
 867 }
 868 
 869 function okexit {
 870         cd /tmp
 871         test "$CLEANUP" = c && remove_dir $INSTALL_DIR
 872         save_state
 873         rm -rf $modstatedir
 874         rm -f $modlist
 875         [ -n "$cryptotree" ] && rm -rf "$cryptotree"
 876         verbose "Install complete"
 877         exit 0
 878 }
 879 
 880 #
 881 # Process options
 882 #
 883 
 884 RCOPTS=""
 885 LIBCREATE="no"
 886 LIBSRC=""
 887 ENV_PATH=$CODEMGR_WS
 888 OBJD="debug"
 889 KMDB="yes"
 890 
 891 test -s $INSTALL_RC && RCOPTS=`cat $INSTALL_RC`
 892 set $INSTALL $DEFAULT_OPTIONS $RCOPTS $*
 893 shift
 894 
 895 while getopts acd:D:G:hi:k:Kl:Lmno:pPqRs:t:T:uvVw:xX36 opt




 319                 if (modmatch($3))
 320                         print
 321         }
 322         $1 == "CONF" {
 323                 if (modmatch($6))
 324                         print
 325         }
 326         $1 == "SYMLINK" {
 327                 if (modmatch($7))
 328                         print
 329         }
 330         $1 == "LINK" {
 331                 if (modmatch($4))
 332                         print
 333         }
 334         ' $1 > $1.new
 335         mv $1.new $1
 336 }
 337 
 338 #









































































 339 # Copy a module, or create a link, as needed.
 340 #
 341 
 342 function copymod {
 343         case $1 in
 344         MOD)
 345                 targdir=$INSTALL_FILES/$4
 346                 tstmkdir $targdir
 347                 target=$targdir/$3
 348                 verbose "$INSTALL_CP $2/${OBJD}$5/$3 $target"
 349                 $INSTALL_CP $2/${OBJD}$5/$3 $target || \
 350                     fail "can't create $target"
 351                 ;;
 352         SYMLINK)
 353                 targdir=$INSTALL_FILES/$4
 354                 tstmkdir $targdir
 355                 target=$targdir/$5
 356                 rm -f $target
 357                 verbose "ln -s $3 $target"
 358                 ln -s $3 $target || fail "can't create $target"


 452                                         break;
 453                                 fi
 454                         fi
 455                 done
 456                 if [ -z $make ]; then
 457                         make=/usr/ccs/bin/make
 458                         echo "Warning: dmake 7.3 doesn't work with Install;" \
 459                                 "using $make"
 460                 fi
 461         fi
 462 
 463         #
 464         # Get a list of all modules, configuration files, and links
 465         # that we might want to install.
 466         #
 467         verbose "Building module list..."
 468         (cd $KARCH; MAKEFLAGS=e $make -K $MODSTATE modlist.karch) | \
 469             egrep "^MOD|^CONF|^LINK|^SYMLINK" > $modlist
 470         [ "$VERBOSE" = "V" ] && cat $modlist
 471         check_modlist $modlist


















 472         if [ "$GLOM" = "yes" ]; then
 473                 fixglom $modlist $GLOMNAME
 474                 filtimpl $modlist $IMPL
 475         fi
 476         if [[ -n "$files" && "$files" != All ]]; then
 477                 filtmod $modlist "$files"
 478         fi
 479 
 480         #
 481         # Copy modules and create links.  For architectures with both
 482         # 32- and 64-bit modules, we'll likely have duplicate
 483         # configuration files, so do those after filtering out the
 484         # duplicates.
 485         #
 486         verbose "Copying files to ${INSTALL_FILES}..."
 487 
 488         #
 489         # The IFS is reset to the newline character so we can buffer the
 490         # output of grep without piping it directly to copymod, otherwise
 491         # if fail() is called, then it will deadlock in fail()'s wait call


 626                 b64srcdir="v9"
 627                 b64tgtdir="sparcv9"
 628                 b32srcdir="v7"
 629                 b32tgtdir="."
 630         fi
 631 
 632         typeset foundkmdb=no
 633         typeset kmdbpath=
 634         typeset destdir=
 635 
 636         platdir=$INSTALL_FILES/platform/$KARCH/$GLOMNAME
 637         if [[ $GLOM = "yes" ]] ; then
 638                 machdir=$platdir
 639         else
 640                 machdir=$INSTALL_FILES/kernel
 641         fi
 642 
 643         srctrees=$SRC
 644         if [[ -d $SRC/../closed && "$CLOSED_IS_PRESENT" != no ]]; then
 645                 srctrees="$srctrees $SRC/../closed"




 646         fi

 647         if [[ $WANT64 = "yes" ]] ; then
 648                 # kmdbmod for sparc and x86 are built and installed
 649                 # in different places
 650                 if [[ $(mach) = "i386" ]] ; then
 651                         kmdbpath=$SRC/cmd/mdb/$isadir/$b64srcdir/kmdb/kmdbmod
 652                         destdir=$machdir/misc/$b64tgtdir
 653                 else
 654                         kmdbpath=$SRC/cmd/mdb/$KARCH/$b64srcdir/kmdb/kmdbmod
 655                         destdir=$platdir/misc/$b64tgtdir
 656                 fi
 657 
 658                 if kmdb_copy_kmdbmod $kmdbpath $destdir ; then
 659                         foundkmdb="yes"
 660 
 661                         for tree in $srctrees; do
 662                                 kmdb_copy_machkmods \
 663                                     $tree/cmd/mdb/$isadir/$b64srcdir \
 664                                     $machdir/kmdb/$b64tgtdir
 665                                 kmdb_copy_karchkmods $tree/cmd/mdb/$KARCH \
 666                                     $platdir/kmdb/$b64tgtdir $b64srcdir


 759                 echo "Fatal errors from rsh:"
 760                 cat fatal
 761                 remote_fail "Can't install on $TARGET_MACHINE"
 762         fi
 763         if [ -s nonfatal -a "$VERBOSE" != "q" ]; then
 764                 echo "Non-fatal errors from rsh:"
 765                 cat nonfatal
 766         fi
 767         rm -f fatal nonfatal errors
 768         test "$IMODE" = "T" && echo "Files can be extracted on \
 769 $TARGET_MACHINE using 'tar xvf $TARGET_DIR/Install.tar'"
 770         STATE=4
 771 }
 772 
 773 function okexit {
 774         cd /tmp
 775         test "$CLEANUP" = c && remove_dir $INSTALL_DIR
 776         save_state
 777         rm -rf $modstatedir
 778         rm -f $modlist

 779         verbose "Install complete"
 780         exit 0
 781 }
 782 
 783 #
 784 # Process options
 785 #
 786 
 787 RCOPTS=""
 788 LIBCREATE="no"
 789 LIBSRC=""
 790 ENV_PATH=$CODEMGR_WS
 791 OBJD="debug"
 792 KMDB="yes"
 793 
 794 test -s $INSTALL_RC && RCOPTS=`cat $INSTALL_RC`
 795 set $INSTALL $DEFAULT_OPTIONS $RCOPTS $*
 796 shift
 797 
 798 while getopts acd:D:G:hi:k:Kl:Lmno:pPqRs:t:T:uvVw:xX36 opt