New jas.dvdimage.ksh
1 #!/bin/ksh
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/CDDL.txt
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/CDDL.txt.
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 2008 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27 # ident "%Z%%M% %I% %E% SMI"
28 #
29 # This script is used by the build_dvds script to build the pieces
30 # of the DVD image that this workspace contributes to it. The name of
31 # the DVD image is obtained from the prefix of this script's name:
32 # <dvd image name>.dvdimage.ksh
33 #
34 # This script should contain a function named build_image_<ARCH>_<OS>
35 # for every ARCH/OS combination supported by the build, so for sparc
36 # Solaris 9 the function would be named build_image_sparc_9. These ARCH/OS
37 # specific functions typically call other functions to handle the areas of
38 # the DVD that are common to multiple OSes, like the installer and
39 # external shared components. These individual functions should be made
40 # robust enough to handle the situation where they are called more than once,
41 # which is highly likely if each OS function calls a common function.
42 #
43 # See build_dvds for the list of predefined variables and functions
44 # available to this script.
45 #
46
47 #
48 # Variables
49 #
50 AGENTS_DIR=${DVD}/Solaris_${ARCH}/Product/sun_cluster_agents
51 CLOSED_PKGDEFS_DIR=${WS}/usr/closed/pkgdefs
52 MACH=$([ "${ARCH}" = "sparc" ] && { echo ${ARCH}; } || { echo "i386"; })
53 ND=$([ "${DEBUG}" -eq 0 ] && echo "-nd")
54 PKGARCH=${WS}/packages/${MACH}/Sol_${OS}${ND}
55 PKGDEFS_DIR=${WS}/usr/src/pkgdefs
56 SOL=Solaris_${OS}
57
58 # DVD image of external products
59 DVDIMAGE_DIR=${PKGDEFS_DIR}/dvdimages/$(${BASENAME} ${DVD})
60
61 # Agent packages
62 PACKAGES_AGFA_IMPAX=SUNWscpax
63
64 PACKAGES_APACHE=SUNWscapc
65
66 PACKAGES_APACHE_TC=SUNWsctomcat
67
68 PACKAGES_DHC=SUNWscdhc
69
70 PACKAGES_DNS=SUNWscdns
71
72 PACKAGES_EBS=SUNWscebs
73
74 PACKAGES_HADB=SUNWschadb
75
76 PACKAGES_HADB=SUNWscids
77
78 PACKAGES_KERBEROS=SUNWsckrb5
79
80 PACKAGES_L10N="\
81 SUNWcscapc \
82 SUNWcscdns \
83 SUNWcschadb \
84 SUNWcschtt \
85 SUNWcsclc \
86 SUNWcscnfs \
87 SUNWcscor \
88 SUNWcscs1as \
89 SUNWcscs1mq \
90 SUNWcscsap \
91 SUNWcscsapdb \
92 SUNWcscsapenq \
93 SUNWcscsaprepl \
94 SUNWcscsapscs \
95 SUNWcscsapwebas \
96 SUNWcscsbl \
97 SUNWcscsyb \
98 SUNWcscwls \
99 SUNWdschadb \
100 SUNWdschtt \
101 SUNWdscs1as \
102 SUNWdscs1mq \
103 SUNWeschadb \
104 SUNWeschtt \
105 SUNWescs1as \
106 SUNWescs1mq \
107 SUNWfscapc \
108 SUNWfscdns \
109 SUNWfschadb \
110 SUNWfschtt \
111 SUNWfsclc \
112 SUNWfscnfs \
113 SUNWfscs1as \
114 SUNWfscs1mq \
115 SUNWfscsap \
116 SUNWfscsapdb \
117 SUNWfscsbl \
118 SUNWfscwls \
119 SUNWhschadb \
120 SUNWhschtt \
121 SUNWhscs1as \
122 SUNWhscs1mq \
123 SUNWjscapc \
124 SUNWjscdns \
125 SUNWjschadb \
126 SUNWjschtt \
127 SUNWjsclc \
128 SUNWjscnfs \
129 SUNWjscor \
130 SUNWjscs1as \
131 SUNWjscs1mq \
132 SUNWjscsap \
133 SUNWjscsapdb \
134 SUNWjscsapenq \
135 SUNWjscsaprepl \
136 SUNWjscsapscs \
137 SUNWjscsapwebas \
138 SUNWjscsbl \
139 SUNWjscsyb \
140 SUNWjscwls \
141 SUNWkschadb \
142 SUNWkschtt \
143 SUNWkscs1as \
144 SUNWkscs1mq"
145
146 PACKAGES_LIVECACHE=SUNWsclc
147
148 PACKAGES_MQI=SUNWscmqi
149
150 PACKAGES_MQS=SUNWscmqs
151
152 PACKAGES_MYS=SUNWscmys
153
154 PACKAGES_N1G_SPS=SUNWscsps
155
156 PACKAGES_NFS=SUNWscnfs
157
158 PACKAGES_ORACLE=SUNWscor
159
160 PACKAGES_ORACLE_9IAS=SUNWsc9ias
161
162 PACKAGES_POSTGRESQL=SUNWscPostgreSQL
163
164 PACKAGES_S1AS=SUNWscs1as
165
166 PACKAGES_S1MQ=SUNWscs1mq
167
168 PACKAGES_S1WS=SUNWschtt
169
170 PACKAGES_SAA=SUNWscsaa
171
172 PACKAGES_SAP=SUNWscsap
173
174 PACKAGES_SAPDB=SUNWscsapdb
175
176 PACKAGES_SAPWEBAS="\
177 SUNWscsapenq \
178 SUNWscsaprepl \
179 SUNWscsapscs \
180 SUNWscsapwebas"
181
182 PACKAGES_SIEBEL=SUNWscsbl
183
184 PACKAGES_SMB=SUNWscsmb
185
186 PACKAGES_SOLARIS_ZONES=SUNWsczone
187
188 PACKAGES_SUN_GRID_ENG=SUNWscsge
189
190 PACKAGES_SWIFT_GWAY=SUNWscsag
191
192 PACKAGES_SYBASE=SUNWscsyb
193
194 PACKAGES_WLS=SUNWscwls
195
196 PACKAGES_XVM=SUNWscxvm
197
198 # Specify which agents are supported on which platforms
199 sparc_9_AGENTS="\
200 ${PACKAGES_AGFA_IMPAX} \
201 ${PACKAGES_APACHE} \
202 ${PACKAGES_APACHE_TC} \
203 ${PACKAGES_DHC} \
204 ${PACKAGES_DNS} \
205 ${PACKAGES_EBS} \
206 ${PACKAGES_HADB} \
207 ${PACKAGES_LIVECACHE} \
208 ${PACKAGES_MQI} \
209 ${PACKAGES_MQS} \
210 ${PACKAGES_MYS} \
211 ${PACKAGES_N1G_SPS} \
212 ${PACKAGES_NFS} \
213 ${PACKAGES_ORACLE} \
214 ${PACKAGES_ORACLE_9IAS} \
215 ${PACKAGES_POSTGRESQL} \
216 ${PACKAGES_S1AS} \
217 ${PACKAGES_S1MQ} \
218 ${PACKAGES_S1WS} \
219 ${PACKAGES_SAA} \
220 ${PACKAGES_SAP} \
221 ${PACKAGES_SAPDB} \
222 ${PACKAGES_SAPWEBAS} \
223 ${PACKAGES_SIEBEL} \
224 ${PACKAGES_SMB} \
225 ${PACKAGES_SUN_GRID_ENG} \
226 ${PACKAGES_SWIFT_GWAY} \
227 ${PACKAGES_SYBASE} \
228 ${PACKAGES_WLS}"
229
230 sparc_10_AGENTS="\
231 ${PACKAGES_APACHE} \
232 ${PACKAGES_APACHE_TC} \
233 ${PACKAGES_DHC} \
234 ${PACKAGES_DNS} \
235 ${PACKAGES_EBS} \
236 ${PACKAGES_HADB} \
237 ${PACKAGES_KERBEROS} \
238 ${PACKAGES_LIVECACHE} \
239 ${PACKAGES_MQI} \
240 ${PACKAGES_MQS} \
241 ${PACKAGES_MYS} \
242 ${PACKAGES_N1G_SPS} \
243 ${PACKAGES_NFS} \
244 ${PACKAGES_ORACLE} \
245 ${PACKAGES_ORACLE_9IAS} \
246 ${PACKAGES_POSTGRESQL} \
247 ${PACKAGES_S1AS} \
248 ${PACKAGES_S1MQ} \
249 ${PACKAGES_S1WS} \
250 ${PACKAGES_SAA} \
251 ${PACKAGES_SAP} \
252 ${PACKAGES_SAPDB} \
253 ${PACKAGES_SAPWEBAS} \
254 ${PACKAGES_SIEBEL} \
255 ${PACKAGES_SMB} \
256 ${PACKAGES_SOLARIS_ZONES} \
257 ${PACKAGES_SUN_GRID_ENG} \
258 ${PACKAGES_SWIFT_GWAY} \
259 ${PACKAGES_SYBASE} \
260 ${PACKAGES_WLS}"
261
262 # Support for S11 is unknown at this time, so include all agents
263 sparc_11_AGENTS="\
264 ${PACKAGES_AGFA_IMPAX} \
265 ${PACKAGES_APACHE} \
266 ${PACKAGES_APACHE_TC} \
267 ${PACKAGES_DHC} \
268 ${PACKAGES_DNS} \
269 ${PACKAGES_EBS} \
270 ${PACKAGES_HADB} \
271 ${PACKAGES_IDS} \
272 ${PACKAGES_KERBEROS} \
273 ${PACKAGES_L10N} \
274 ${PACKAGES_LIVECACHE} \
275 ${PACKAGES_MQI} \
276 ${PACKAGES_MQS} \
277 ${PACKAGES_MYS} \
278 ${PACKAGES_N1G_SPS} \
279 ${PACKAGES_NFS} \
280 ${PACKAGES_ORACLE} \
281 ${PACKAGES_ORACLE_9IAS} \
282 ${PACKAGES_POSTGRESQL} \
283 ${PACKAGES_S1AS} \
284 ${PACKAGES_S1MQ} \
285 ${PACKAGES_S1WS} \
286 ${PACKAGES_SAA} \
287 ${PACKAGES_SAP} \
288 ${PACKAGES_SAPDB} \
289 ${PACKAGES_SAPWEBAS} \
290 ${PACKAGES_SIEBEL} \
291 ${PACKAGES_SMB} \
292 ${PACKAGES_SOLARIS_ZONES} \
293 ${PACKAGES_SUN_GRID_ENG} \
294 ${PACKAGES_SWIFT_GWAY} \
295 ${PACKAGES_SYBASE} \
296 ${PACKAGES_WLS}"
297
298 i386_10_AGENTS="\
299 ${PACKAGES_APACHE} \
300 ${PACKAGES_APACHE_TC} \
301 ${PACKAGES_DHC} \
302 ${PACKAGES_DNS} \
303 ${PACKAGES_HADB} \
304 ${PACKAGES_KERBEROS} \
305 ${PACKAGES_LIVECACHE} \
306 ${PACKAGES_MQI} \
307 ${PACKAGES_MQS} \
308 ${PACKAGES_MYS} \
309 ${PACKAGES_N1G_SPS} \
310 ${PACKAGES_NFS} \
311 ${PACKAGES_ORACLE} \
312 ${PACKAGES_ORACLE_9IAS} \
313 ${PACKAGES_POSTGRESQL} \
314 ${PACKAGES_S1AS} \
315 ${PACKAGES_S1MQ} \
316 ${PACKAGES_S1WS} \
317 ${PACKAGES_SAP} \
318 ${PACKAGES_SAPDB} \
319 ${PACKAGES_SAPWEBAS} \
320 ${PACKAGES_SMB} \
321 ${PACKAGES_SOLARIS_ZONES} \
322 ${PACKAGES_SUN_GRID_ENG} \
323 ${PACKAGES_SYBASE} \
324 ${PACKAGES_WLS} \
325 ${PACKAGES_XVM}"
326
327 i386_11_AGENTS=${sparc_11_AGENTS}
328
329 AGENTS=$(eval echo \${${MACH}_${OS}_AGENTS})
330
331 #
332 # Functions
333 #
334 # Builds the external pieces of the image
335 # build_image_external()
336 build_image_external() {
337 # Check if this piece of the image has already been built
338 [ -h "${DVD}/Copyright" ] && return
339
340 echo "Adding the external pieces to the image"
341
342 # Create directories
343 ${MKDIR} ${DVD} || error "Can't create directory ${DVD}"
344
345 # Add dvdimage of symlinks to external products
346 (cd ${DVDIMAGE_DIR} && ${FIND} . -print | ${CPIO} -oc) | (cd ${DVD} &&
347 ${CPIO} -icdum)
348 }
349
350 # Builds the common pieces of the image
351 # build_image_common()
352 build_image_common() {
353 # Check if this piece of the image has already been built
354 [ -f "${AGENTS_DIR}/.producttoc" -a ! -h "${AGENTS_DIR}/.producttoc" ] && return
355
356 # Build the external pieces of the image
357 build_image_external
358
359 echo "Adding the common ${MACH} pieces to the image"
360
361 # Create directories
362 ${MKDIR} ${AGENTS_DIR} || error "Can't create directory ${AGENTS_DIR}"
363
364 # Add .producttoc to top level directory
365 copy ${PKGDEFS_DIR}/dot.producttoc.sun_cluster_agents.${MACH} ${AGENTS_DIR}/.producttoc
366 }
367
368 # Builds the solaris pieces of the image
369 # build_image_solaris()
370 build_image_solaris() {
371 # Check if this piece of the image has already been built
372 [ -f "${AGENTS_DIR}/${SOL}/Packages/.clustertoc" -a ! -h "${AGENTS_DIR}/${SOL}/Packages/.clustertoc" ] && return
373
374 # Build the common pieces of the image
375 build_image_common
376
377 echo "Adding the ${SOL} ${MACH} pieces to the image"
378
379 # Create directories
380 ${MKDIR} ${AGENTS_DIR}/${SOL}
381 ${MKDIR} ${AGENTS_DIR}/${SOL}/Packages
382
383 # Add .clustertoc to agents Packages directory
384 copy ${PKGDEFS_DIR}/dot.clustertoc ${AGENTS_DIR}/${SOL}/Packages/.clustertoc
385
386 # Add .order to agents Packages directory
387 copy ${PKGDEFS_DIR}/dot.order ${AGENTS_DIR}/${SOL}/Packages/.order
388
389 # Copy packages from package archive to agents Packages directory
390 [ -d "${PKGARCH}" ] || error "Package archive not found"
391
392 for pkg in ${AGENTS}
393 do
394 [ -h "${AGENTS_DIR}/${SOL}/Packages/${pkg}" ] && ${RM} -r ${AGENTS_DIR}/${SOL}/Packages/${pkg}
395 done
396
397 ${PKGTRANS} ${PKGARCH} ${AGENTS_DIR}/${SOL}/Packages ${AGENTS} || error "pkgtrans to ${AGENTS_DIR}/${SOL}/Packages failed"
398 }
399
400 # Builds the sparc solaris 9 pieces of the image
401 # build_image_sparc_9()
402 build_image_sparc_9() {
403 # Build the solaris pieces of the image
404 build_image_solaris
405 }
406
407 # Builds the sparc solaris 10 pieces of the image
408 # build_image_sparc_10()
409 build_image_sparc_10() {
410 # Build the solaris pieces of the image
411 build_image_solaris
412 }
413
414 # Builds the x86 solaris 10 pieces of the image
415 # build_image_x86_10()
416 build_image_x86_10() {
417 # Build the solaris pieces of the image
418 build_image_solaris
419 }
420
421 # Builds the sparc solaris 11 pieces of the image
422 # build_image_sparc_11()
423 build_image_sparc_11() {
424 # Build the solaris pieces of the image
425 build_image_solaris
426 }
427
428 # Builds the x86 solaris 11 pieces of the image
429 # build_image_x86_11()
430 build_image_x86_11() {
431 # Build the solaris pieces of the image
432 build_image_solaris
433 }