bindrop.sh revision 52a52aeb5a7fdcd4b40e137fa7498612f87d95f3
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
#
# Create an encumbered binaries tarball from a full build proto area,
# less the contents of an OpenSolaris proto area. Special handling
# for crypto binaries that need to be signed by Sun Release
# Engineering.
#
usage="bindrop [-n] full-root open-root basename"
else
fi
#
# Netinstall server and path to RE-signed packages (for crypto).
# It might be better to mechanically derive the "Solaris_11" part of
# the path from RELEASE. But it's not clear that such a derivation
# would be reliable.
#
# URL to Encryption Kit binaries.
function fail {
print -u2 "bindrop: $@"
exit 1
}
function warn {
print -u2 "bindrop: warning: $@"
}
#
# Create the README from boilerplate and the contents of the closed
# binary tree.
#
# usage: mkreadme targetdir
#
function mkreadme {
typeset targetdir="$1"
}
nondebug=n
while getopts n flag; do
n)
nondebug=y
;;
?)
exit 1
;;
esac
done
if [[ $# -ne 3 ]]; then
exit 1
fi
full="$1"
open="$2"
tarfile="$CODEMGR_WS/$3.$isa.tar"
if [[ "$nondebug" = y ]]; then
fi
tmpdir=$(mktemp -dt bindropXXXXX)
#
# This will hold a temp list of directories that must be kept, even if
# empty.
#
needdirs=$(mktemp -t needdirsXXXXX)
#
# Copy the full tree into a temp directory.
#
#
# Remove internal ON crypto signing certs
#
delete="
"
#
# Remove miscellaneous files that we don't want to ship.
#
# SUNWsvvs (SVVS test drivers).
"
# encumbered binaries and associated files
"
# memory fault injector test framework
"
# pci test tool
"
done
#
# Remove files that the open tree already has.
#
#
# Remove any header files. If they're in the closed tree, they're
# probably not freely redistributable.
#
#
# Remove empty directories that the open tree doesn't need.
#
# are specified in the open packages; save that list to a temporary
# file $needdirs.
#
#
# Step 2: go to our closed directory, and find all the subdirectories,
# filtering out the ones needed by the open packages (saved in that
# temporary file). Sort in reverse order, so that parent directories
# come after any subdirectories, and pipe that to rmdir. If there are
# still any lingering files, rmdir will complain. That's fine--we
# only want to delete empty directories--so redirect the complaints to
#
#
# Up above we removed the files that were already in the open tree.
# But that blew away the minimal closed binaries that are needed to do
# an open build, so restore them here.
#
fail "can't restore minimal binaries."
#
# Replace the crypto binaries with ones that have been signed by RE.
# Get these from a local netinstall server.
#
# List of files to copy, in the form "pkgname file [file ...]"
# common files
cfiles="
SUNWcsl
"
# sparc-only
csfiles="
SUNWckr
SUNWcsl
SUNWdcar
"
# x86-only
cxfiles="
SUNWckr
SUNWcsl
SUNWdcar
"
"
else
fi
# Extract $pkgfiles from $pkg (no-op if they're empty).
function pkgextract
{
# Doesn't look like we can rely on $? here.
done
fi
}
pkg=""
pkgfiles=""
pkgfiles=""
continue
else
fi
done
pkgextract # last package in $cfiles
# Patch up the crypto hard links.
for f in $linkedfiles; do
done
#
# Copy over the EK (Encryption Kit) binaries. This is a slightly different
# procedure than the above code for handling the other crypto binaries, as
# SUNWcry & SUNWcryr aren't accessible by NFS.
# We might want to add an option to let the user pick a different
# (e.g., older) Encryption Kit.
#
'/HREF=\"crypt.nv.crypt_[^m]+\"/ { name = $2 }
END {print name}')
if [[ -z "$latest_RE_signed_EK" ]]; then
print -u2 "bindrop: can't find RE-signed Encryption Kit binaries."
print -u2 "wget errors:"
exit 1
fi
print "latest RE signed EK cpio archive: $latest_RE_signed_EK"
cfiles="
SUNWcry
"
cxfiles="
SUNWcry
SUNWcryr
"
csfiles="
SUNWcry
SUNWcryr
"
else
fi
nipath="$tmpdir/EK/Encryption_11/$isa/Packages"
pkg=""
pkgfiles=""
pkgfiles=""
continue
else
fi
done
pkgextract # last package in $cfiles
#
# Add binary license files.
#
cp -p "$SRC/tools/opensolaris/BINARYLICENSE.txt" "$tmpdir/closed" || \
fail "can't add BINARYLICENSE.txt"
cp -p "$CODEMGR_WS/THIRDPARTYLICENSE.ON-BINARIES" "$tmpdir/closed" || \
fail "can't add THIRDPARTYLICENSE.ON-BINARIES."
exit 0