bindrop.sh revision b83ec4ed825d984ca8f038544e15b4ca0eac82c7
#
# 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
#
#
#
# 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] basename"
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 1 ]]; then
exit 1
fi
tarfile="$CODEMGR_WS/$1.$isa.tar"
suffix=""
if [[ "$nondebug" = y ]]; then
suffix="-nd"
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 closed root parallel 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
"
done
#
# Remove any header files. If they're in the closed tree, they're
# probably not freely redistributable.
#
-a \! -name localedef.h \
-exec rm -f {} \;)
#
# Remove empty directories that the open tree doesn't need.
#
# Step 1: walk the redistributable manifests to find out which directories
# 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
#
#
# Exclude signed crypto binaries; they are delivered in their
# own tarball.
#
#
# Add binary license files.
#
cp -p "$SRC/tools/opensolaris/BINARYLICENSE.txt" "$tmpdir/closed" || \
fail "can't add BINARYLICENSE.txt"
if [ -f "$CODEMGR_WS/THIRDPARTYLICENSE.ON-BINARIES" ]; then
cp -p "$CODEMGR_WS/THIRDPARTYLICENSE.ON-BINARIES" "$tmpdir/closed"
fi
exit 0