Print this page
XXX Remove nawk(1)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/scripts/bindrop.sh
+++ new/usr/src/tools/scripts/bindrop.sh
1 1 #! /usr/bin/ksh -p
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22
23 23 #
24 24 # Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
25 25 #
26 26 # Create an encumbered binaries tarball from a full build proto area,
27 27 # less the contents of an OpenSolaris proto area. Special handling
28 28 # for crypto binaries that need to be signed by Sun Release
29 29 # Engineering.
30 30 #
31 31
32 32 usage="bindrop [-n] basename"
33 33
34 34 isa=`uname -p`
35 35
36 36 PATH="$PATH:/usr/bin:/usr/sfw/bin"
37 37
38 38 function fail {
39 39 print -u2 "bindrop: $@"
40 40 exit 1
41 41 }
42 42
43 43 function warn {
44 44 print -u2 "bindrop: warning: $@"
45 45 }
46 46
47 47 [[ -n "$SRC" ]] || fail "SRC must be set."
48 48 [[ -n "$CODEMGR_WS" ]] || fail "CODEMGR_WS must be set."
49 49
50 50 #
51 51 # Create the README from boilerplate and the contents of the closed
52 52 # binary tree.
53 53 #
54 54 # usage: mkreadme targetdir
55 55 #
56 56 function mkreadme {
57 57 typeset targetdir="$1"
58 58 typeset readme="README.ON-BINARIES.$isa"
59 59
60 60 sed -e s/@ISA@/$isa/ -e s/@DELIVERY@/ON-BINARIES/ \
61 61 "$SRC/tools/opensolaris/README.binaries.tmpl" > "$targetdir/$readme"
62 62 (cd "$targetdir"; find "$rootdir" -type f -print | \
63 63 sort >> "$targetdir/$readme")
64 64 }
65 65
66 66 nondebug=n
67 67 while getopts n flag; do
68 68 case $flag in
69 69 n)
70 70 nondebug=y
71 71 ;;
72 72 ?)
73 73 print -u2 "usage: $usage"
74 74 exit 1
75 75 ;;
76 76 esac
77 77 done
78 78 shift $(($OPTIND - 1))
79 79
80 80 if [[ $# -ne 1 ]]; then
81 81 print -u2 "usage: $usage"
82 82 exit 1
83 83 fi
84 84
85 85 tarfile="$CODEMGR_WS/$1.$isa.tar"
86 86
87 87 rootdir="root_$isa"
88 88 suffix=""
89 89 if [[ "$nondebug" = y ]]; then
90 90 rootdir="root_$isa-nd"
91 91 suffix="-nd"
92 92 fi
93 93
94 94 [[ -d "${ROOT}${suffix}-closed" ]] || fail "can't find closed root proto area."
95 95
96 96 tmpdir=$(mktemp -dt bindropXXXXX)
97 97 [[ -n "$tmpdir" ]] || fail "can't create temporary directory."
98 98 mkdir -p "$tmpdir/closed/$rootdir" || exit 1
99 99
100 100 #
101 101 # This will hold a temp list of directories that must be kept, even if
102 102 # empty.
103 103 #
104 104 needdirs=$(mktemp -t needdirsXXXXX)
105 105 [[ -n "$needdirs" ]] || fail "can't create temporary directory list file."
106 106
107 107 #
108 108 # Copy the closed root parallel tree into a temp directory.
109 109 #
110 110 (cd "${ROOT}${suffix}-closed"; tar cf - .) | (cd "$tmpdir/closed/$rootdir"; tar xpf -)
111 111
112 112 #
113 113 # Remove internal ON crypto signing certs
114 114 #
115 115 delete="
116 116 etc/certs/SUNWosnetSE
117 117 etc/certs/SUNWosnetSolaris
118 118 etc/crypto/certs/SUNWosnet
119 119 etc/crypto/certs/SUNWosnetLimited
120 120 etc/crypto/certs/SUNWosnetCF
121 121 etc/crypto/certs/SUNWosnetCFLimited
122 122 "
123 123
124 124 #
125 125 # Remove miscellaneous files that we don't want to ship.
126 126 #
127 127
128 128 # SUNWsvvs (SVVS test drivers).
129 129 delete="$delete
130 130 usr/include/sys/svvslo.h
131 131 usr/include/sys/tidg.h
132 132 usr/include/sys/tivc.h
133 133 usr/include/sys/tmux.h
134 134 usr/kernel/drv/amd64/svvslo
135 135 usr/kernel/drv/amd64/tidg
136 136 usr/kernel/drv/amd64/tivc
137 137 usr/kernel/drv/amd64/tmux
138 138 usr/kernel/drv/sparcv9/svvslo
139 139 usr/kernel/drv/sparcv9/tidg
140 140 usr/kernel/drv/sparcv9/tivc
141 141 usr/kernel/drv/sparcv9/tmux
142 142 usr/kernel/drv/svvslo
143 143 usr/kernel/drv/svvslo.conf
144 144 usr/kernel/drv/tidg
145 145 usr/kernel/drv/tidg.conf
146 146 usr/kernel/drv/tivc
147 147 usr/kernel/drv/tivc.conf
148 148 usr/kernel/drv/tmux
149 149 usr/kernel/drv/tmux.conf
150 150 usr/kernel/strmod/amd64/lmodb
151 151 usr/kernel/strmod/amd64/lmode
152 152 usr/kernel/strmod/amd64/lmodr
153 153 usr/kernel/strmod/amd64/lmodt
154 154 usr/kernel/strmod/lmodb
155 155 usr/kernel/strmod/lmode
156 156 usr/kernel/strmod/lmodr
157 157 usr/kernel/strmod/lmodt
158 158 usr/kernel/strmod/sparcv9/lmodb
159 159 usr/kernel/strmod/sparcv9/lmode
160 160 usr/kernel/strmod/sparcv9/lmodr
161 161 usr/kernel/strmod/sparcv9/lmodt
162 162 "
163 163 # encumbered binaries and associated files
164 164 delete="$delete
165 165 kernel/drv/amd64/bmc
166 166 kernel/drv/bmc
167 167 kernel/drv/bmc.conf
168 168 kernel/drv/ifp.conf
169 169 kernel/drv/sparcv9/ifp
170 170 kernel/drv/sparcv9/isp
171 171 kernel/drv/sparcv9/qus
172 172 kernel/drv/spwr
173 173 kernel/kmdb/sparcv9/isp
174 174 usr/has/bin/ksh
175 175 usr/has/bin/pfksh
176 176 usr/has/bin/rksh
177 177 usr/include/sys/scsi/adapters/ifpcmd.h
178 178 usr/include/sys/scsi/adapters/ifpio.h
179 179 usr/include/sys/scsi/adapters/ifpmail.h
180 180 usr/include/sys/scsi/adapters/ifpreg.h
181 181 usr/include/sys/scsi/adapters/ifpvar.h
182 182 usr/include/sys/scsi/adapters/ispcmd.h
183 183 usr/include/sys/scsi/adapters/ispmail.h
184 184 usr/include/sys/scsi/adapters/ispreg.h
185 185 usr/include/sys/scsi/adapters/ispvar.h
186 186 usr/lib/mdb/kvm/sparcv9/isp.so
187 187 usr/platform/sun4u/include/sys/memtestio.h
188 188 usr/platform/sun4u/include/sys/memtestio_ch.h
189 189 usr/platform/sun4u/include/sys/memtestio_chp.h
190 190 usr/platform/sun4u/include/sys/memtestio_ja.h
191 191 usr/platform/sun4u/include/sys/memtestio_jg.h
192 192 usr/platform/sun4u/include/sys/memtestio_sf.h
193 193 usr/platform/sun4u/include/sys/memtestio_sr.h
194 194 usr/platform/sun4u/include/sys/memtestio_u.h
195 195 usr/platform/sun4u/include/sys/memtestio_pn.h
196 196 usr/platform/sun4v/include/sys/memtestio.h
197 197 usr/platform/sun4v/include/sys/memtestio_ni.h
198 198 usr/platform/sun4v/include/sys/memtestio_v.h
199 199 "
200 200 # memory fault injector test framework
201 201 delete="$delete
202 202 usr/bin/mtst
203 203 platform/sun4u/kernel/drv/sparcv9/memtest
204 204 platform/sun4u/kernel/drv/memtest.conf
205 205 platform/sun4v/kernel/drv/sparcv9/memtest
206 206 platform/sun4v/kernel/drv/memtest.conf
207 207 kernel/drv/memtest.conf
208 208 kernel/drv/memtest
209 209 kernel/drv/amd64/memtest
210 210 usr/platform/i86pc/lib/mtst/mtst_AuthenticAMD_15.so
211 211 usr/platform/i86pc/lib/mtst/mtst_AuthenticAMD.so
212 212 usr/platform/i86pc/lib/mtst/mtst_generic.so
213 213 usr/platform/i86pc/lib/mtst/mtst_GenuineIntel.so
214 214 "
215 215 for f in $delete; do
216 216 rm -rf "$tmpdir/closed/$rootdir/$f"
217 217 done
218 218
219 219 #
220 220 # Remove any header files. If they're in the closed tree, they're
221 221 # probably not freely redistributable.
222 222 #
223 223 (cd "$tmpdir/closed/$rootdir"; find . -name \*.h \
224 224 -a \! -name lc_core.h \
225 225 -a \! -name localedef.h \
226 226 -exec rm -f {} \;)
↓ open down ↓ |
226 lines elided |
↑ open up ↑ |
227 227
228 228 #
229 229 # Remove empty directories that the open tree doesn't need.
230 230 #
231 231 # Step 1: walk the redistributable manifests to find out which directories
232 232 # are specified in the open packages; save that list to a temporary
233 233 # file $needdirs.
234 234 #
235 235 MACH=$(uname -p)
236 236 (cd "$SRC/pkg/packages.$MACH"; \
237 - nawk '/^dir/ {sub(/.+ path=/, ""); print $1;}' *.metadata.*.redist | \
237 + /usr/xpg4/bin/awk '/^dir/ {sub(/.+ path=/, ""); print $1;}' *.metadata.*.redist | \
238 238 sort -u > "$needdirs")
239 239
240 240 #
241 241 # Step 2: go to our closed directory, and find all the subdirectories,
242 242 # filtering out the ones needed by the open packages (saved in that
243 243 # temporary file). Sort in reverse order, so that parent directories
244 244 # come after any subdirectories, and pipe that to rmdir. If there are
245 245 # still any lingering files, rmdir will complain. That's fine--we
246 246 # only want to delete empty directories--so redirect the complaints to
247 247 # /dev/null.
248 248 #
249 249 (cd "$tmpdir/closed/$rootdir"; \
250 250 find * -type d -print | /usr/xpg4/bin/grep -xv -f $needdirs | \
251 251 sort -r | xargs -l rmdir 2>/dev/null )
252 252
253 253 rm "$needdirs"
254 254
255 255 #
256 256 # Exclude signed crypto binaries; they are delivered in their
257 257 # own tarball.
258 258 #
259 259 ROOT="$tmpdir/closed/$rootdir" findcrypto "$SRC/tools/codesign/creds" |
260 260 awk '{ print $2 }' | (cd "$tmpdir/closed/$rootdir"; xargs rm -f)
261 261
262 262 #
263 263 # Add binary license files.
264 264 #
265 265
266 266 cp -p "$SRC/tools/opensolaris/BINARYLICENSE.txt" "$tmpdir/closed" || \
267 267 fail "can't add BINARYLICENSE.txt"
268 268 mkreadme "$tmpdir/closed"
269 269 if [ -f "$CODEMGR_WS/THIRDPARTYLICENSE.ON-BINARIES" ]; then
270 270 cp -p "$CODEMGR_WS/THIRDPARTYLICENSE.ON-BINARIES" "$tmpdir/closed"
271 271 fi
272 272
273 273 (cd "$tmpdir"; tar cf "$tarfile" closed) || fail "can't create $tarfile."
274 274 bzip2 -f "$tarfile" || fail "can't compress $tarfile".
275 275
276 276 rm -rf "$tmpdir"
277 277
278 278 exit 0
↓ open down ↓ |
31 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX