1 #!/bin/ksh -p 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License (the "License"). 7 # You may not use this file except in compliance with the License. 8 # 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 # or http://www.opensolaris.org/os/licensing. 11 # See the License for the specific language governing permissions 12 # and limitations under the License. 13 # 14 # When distributing Covered Code, include this CDDL HEADER in each 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 # If applicable, add the following below this CDDL HEADER, with the 17 # fields enclosed by brackets "[]" replaced with your own identifying 18 # information: Portions Copyright [yyyy] [name of copyright owner] 19 # 20 # CDDL HEADER END 21 # 22 23 # 24 # Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25 # Use is subject to license terms. 26 # 27 # ident "%Z%%M% %I% %E% SMI" 28 # 29 30 # Builds bfu archives. If no arguments, uses the environment variables 31 # already set (by bldenv). One argument specifies an environment file 32 # like nightly or bldenv uses. 33 34 USAGE='Usage: $0 [ <env_file> ]' 35 36 if [ $# -gt 1 ]; then 37 echo $USAGE >&2 38 exit 1 39 fi 40 41 if [ $# -eq 1 ]; then 42 if [ -z "$OPTHOME" ]; then 43 OPTHOME=/opt 44 export OPTHOME 45 fi 46 # 47 # Setup environmental variables 48 # 49 if [ -f $1 ]; then 50 if [[ $1 = */* ]]; then 51 . $1 52 else 53 . ./$1 54 fi 55 else 56 if [ -f $OPTHOME/onbld/env/$1 ]; then 57 . $OPTHOME/onbld/env/$1 58 else 59 echo "Cannot find env file as either $1 \c" >&2 60 echo "or $OPTHOME/onbld/env/$1" >&2 61 exit 1 62 fi 63 fi 64 fi 65 66 if [ -z "$ROOT" -o ! -d "$ROOT" ]; then 67 echo '$ROOT must be set to a valid proto directory.' >&2 68 exit 1 69 fi 70 71 if [ "$o_FLAG" != "y" ] && [ -z "$SRC" -o ! -d "$SRC" -o -z "$MACH" ]; then 72 echo '$SRC and $MACH should be set to get archive permissions right.' \ 73 >&2 74 fi 75 76 if [ -z "$CPIODIR" ]; then 77 # $CPIODIR may not exist though, so no test for it 78 echo '$CPIODIR must be set to a valid proto directory.' >&2 79 exit 1 80 fi 81 82 zflag="" 83 archivetype="" 84 if [ -n "${NIGHTLY_OPTIONS}" ]; then 85 zflag=`echo ${NIGHTLY_OPTIONS} | grep z` 86 if [ -n "$zflag" ]; then 87 zflag="-z" 88 archivetype="compressed " 89 fi 90 fi 91 92 export I_REALLY_WANT_TO_RUN_MKBFU=YES 93 94 echo "Making ${archivetype}archives from $ROOT in $CPIODIR." 95 if [ "$o_FLAG" != "y" -a -n "$MACH" -a -n "$SRC" -a -d "$SRC/pkgdefs" ]; then 96 pkg=$SRC/pkgdefs 97 if [[ -d $SRC/../closed/pkgdefs && \ 98 "$CLOSED_IS_PRESENT" != no ]]; then 99 cpkg=$SRC/../closed/pkgdefs 100 else 101 cpkg="" 102 fi 103 exc=etc/exception_list_$MACH 104 if [ "$X_FLAG" = "y" ]; then 105 ipkg=$IA32_IHV_WS/usr/src/pkgdefs 106 bpkgargs="-e $ipkg/$exc $ipkg" 107 else 108 bpkgargs="" 109 fi 110 mkbfu -f "cpiotranslate -e $pkg/$exc $bpkgargs $pkg $cpkg" \ 111 $zflag $ROOT $CPIODIR 112 else 113 mkbfu $zflag $ROOT $CPIODIR 114 fi 115 116 if [ -n "$MACH" -a -n "$SRC" -a -d "$SRC/pkgdefs" ]; then 117 mkacr $SRC $MACH $CPIODIR 118 else 119 cat >&2 <<'EOF' 120 $SRC and $MACH need to be set to create a conflict resolution archive. 121 EOF 122 fi 123 124