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_BUILD=$([ ! -d "${WS}/usr/closed" ] && echo "#")
 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_IDS=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=$(eval ${CLOSED_BUILD} echo 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=$(eval ${CLOSED_BUILD} echo 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_AGFA_IMPAX} \
232         ${PACKAGES_APACHE} \
233         ${PACKAGES_APACHE_TC} \
234         ${PACKAGES_DHC} \
235         ${PACKAGES_DNS} \
236         ${PACKAGES_EBS} \
237         ${PACKAGES_HADB} \
238         ${PACKAGES_IDS} \
239         ${PACKAGES_KERBEROS} \
240         ${PACKAGES_LIVECACHE} \
241         ${PACKAGES_MQI} \
242         ${PACKAGES_MQS} \
243         ${PACKAGES_MYS} \
244         ${PACKAGES_N1G_SPS} \
245         ${PACKAGES_NFS} \
246         ${PACKAGES_ORACLE} \
247         ${PACKAGES_ORACLE_9IAS} \
248         ${PACKAGES_POSTGRESQL} \
249         ${PACKAGES_S1AS} \
250         ${PACKAGES_S1MQ} \
251         ${PACKAGES_S1WS} \
252         ${PACKAGES_SAA} \
253         ${PACKAGES_SAP} \
254         ${PACKAGES_SAPDB} \
255         ${PACKAGES_SAPWEBAS} \
256         ${PACKAGES_SIEBEL} \
257         ${PACKAGES_SMB} \
258         ${PACKAGES_SOLARIS_ZONES} \
259         ${PACKAGES_SUN_GRID_ENG} \
260         ${PACKAGES_SWIFT_GWAY} \
261         ${PACKAGES_SYBASE} \
262         ${PACKAGES_WLS}"
263 
264 # Support for S11 is unknown at this time, so include all agents
265 sparc_11_AGENTS="\
266         ${PACKAGES_AGFA_IMPAX} \
267         ${PACKAGES_APACHE} \
268         ${PACKAGES_APACHE_TC} \
269         ${PACKAGES_DHC} \
270         ${PACKAGES_DNS} \
271         ${PACKAGES_EBS} \
272         ${PACKAGES_HADB} \
273         ${PACKAGES_IDS} \
274         ${PACKAGES_KERBEROS} \
275         ${PACKAGES_L10N} \
276         ${PACKAGES_LIVECACHE} \
277         ${PACKAGES_MQI} \
278         ${PACKAGES_MQS} \
279         ${PACKAGES_MYS} \
280         ${PACKAGES_N1G_SPS} \
281         ${PACKAGES_NFS} \
282         ${PACKAGES_ORACLE} \
283         ${PACKAGES_ORACLE_9IAS} \
284         ${PACKAGES_POSTGRESQL} \
285         ${PACKAGES_S1AS} \
286         ${PACKAGES_S1MQ} \
287         ${PACKAGES_S1WS} \
288         ${PACKAGES_SAA} \
289         ${PACKAGES_SAP} \
290         ${PACKAGES_SAPDB} \
291         ${PACKAGES_SAPWEBAS} \
292         ${PACKAGES_SIEBEL} \
293         ${PACKAGES_SMB} \
294         ${PACKAGES_SOLARIS_ZONES} \
295         ${PACKAGES_SUN_GRID_ENG} \
296         ${PACKAGES_SWIFT_GWAY} \
297         ${PACKAGES_SYBASE} \
298         ${PACKAGES_WLS}"
299 
300 i386_10_AGENTS="\
301         ${PACKAGES_APACHE} \
302         ${PACKAGES_APACHE_TC} \
303         ${PACKAGES_DHC} \
304         ${PACKAGES_DNS} \
305         ${PACKAGES_HADB} \
306         ${PACKAGES_IDS} \
307         ${PACKAGES_KERBEROS} \
308         ${PACKAGES_LIVECACHE} \
309         ${PACKAGES_MQI} \
310         ${PACKAGES_MQS} \
311         ${PACKAGES_MYS} \
312         ${PACKAGES_N1G_SPS} \
313         ${PACKAGES_NFS} \
314         ${PACKAGES_ORACLE} \
315         ${PACKAGES_ORACLE_9IAS} \
316         ${PACKAGES_POSTGRESQL} \
317         ${PACKAGES_S1AS} \
318         ${PACKAGES_S1MQ} \
319         ${PACKAGES_S1WS} \
320         ${PACKAGES_SAP} \
321         ${PACKAGES_SAPDB} \
322         ${PACKAGES_SAPWEBAS} \
323         ${PACKAGES_SMB} \
324         ${PACKAGES_SOLARIS_ZONES} \
325         ${PACKAGES_SUN_GRID_ENG} \
326         ${PACKAGES_SYBASE} \
327         ${PACKAGES_WLS}"
328 
329 i386_11_AGENTS="\
330         ${sparc_11_AGENTS} \
331         ${PACKAGES_XVM}"
332 
333 AGENTS=$(eval echo \${${MACH}_${OS}_AGENTS})
334 
335 #
336 # Functions
337 #
338 # Builds the external pieces of the image
339 # build_image_external()
340 build_image_external() {
341         # Check if this piece of the image has already been built
342         [ -e "${DVD}/.cdtoc" ] && return
343 
344         echo "Adding the external pieces to the image"
345 
346         # Create directories
347         ${MKDIR} ${DVD} || error "Can't create directory ${DVD}"
348 
349         # Add dvdimage of symlinks to external products
350         (cd ${DVDIMAGE_DIR} && ${FIND} . -print | ${CPIO} -oc) | (cd ${DVD} &&
351 ${CPIO} -icdum)
352 }
353 
354 # Builds the common pieces of the image
355 # build_image_common()
356 build_image_common() {
357         # Check if this piece of the image has already been built
358         [ -f "${AGENTS_DIR}/.producttoc" -a ! -h "${AGENTS_DIR}/.producttoc" ] && return
359 
360         # Build the external pieces of the image
361         build_image_external
362 
363         echo "Adding the common ${MACH} pieces to the image"
364 
365         # Create directories
366         ${MKDIR} ${AGENTS_DIR} || error "Can't create directory ${AGENTS_DIR}"
367 
368         # Add .producttoc to top level directory
369         copy ${PKGDEFS_DIR}/dot.producttoc.sun_cluster_agents.${MACH} ${AGENTS_DIR}/.producttoc
370 }
371 
372 # Builds the solaris pieces of the image
373 # build_image_solaris()
374 build_image_solaris() {
375         # Check if this piece of the image has already been built
376         [ -f "${AGENTS_DIR}/${SOL}/Packages/.clustertoc" -a ! -h "${AGENTS_DIR}/${SOL}/Packages/.clustertoc" ] && return
377 
378         # Build the common pieces of the image
379         build_image_common
380 
381         echo "Adding the ${SOL} ${MACH} pieces to the image"
382 
383         # Create directories
384         ${MKDIR} ${AGENTS_DIR}/${SOL}
385         ${MKDIR} ${AGENTS_DIR}/${SOL}/Packages
386 
387         # Add .clustertoc to agents Packages directory
388         copy ${PKGDEFS_DIR}/dot.clustertoc ${AGENTS_DIR}/${SOL}/Packages/.clustertoc
389 
390         # Add .order to agents Packages directory
391         copy ${PKGDEFS_DIR}/dot.order ${AGENTS_DIR}/${SOL}/Packages/.order
392 
393         # Copy packages from package archive to agents Packages directory
394         [ -d "${PKGARCH}" ] || error "Package archive not found"
395 
396         for pkg in ${AGENTS}
397         do
398                 [ -h "${AGENTS_DIR}/${SOL}/Packages/${pkg}" ] && ${RM} ${AGENTS_DIR}/${SOL}/Packages/${pkg}
399         done
400 
401         ${PKGTRANS} ${PKGARCH} ${AGENTS_DIR}/${SOL}/Packages ${AGENTS} || error "pkgtrans to ${AGENTS_DIR}/${SOL}/Packages failed"
402 }
403 
404 # Builds the sparc solaris 9 pieces of the image
405 # build_image_sparc_9()
406 build_image_sparc_9() {
407         # Build the solaris pieces of the image
408         build_image_solaris
409 }
410 
411 # Builds the sparc solaris 10 pieces of the image
412 # build_image_sparc_10()
413 build_image_sparc_10() {
414         # Build the solaris pieces of the image
415         build_image_solaris
416 }
417 
418 # Builds the x86 solaris 10 pieces of the image
419 # build_image_x86_10()
420 build_image_x86_10() {
421         # Build the solaris pieces of the image
422         build_image_solaris
423 }
424 
425 # Builds the sparc solaris 11 pieces of the image
426 # build_image_sparc_11()
427 build_image_sparc_11() {
428         # Build the solaris pieces of the image
429         build_image_solaris
430 }
431 
432 # Builds the x86 solaris 11 pieces of the image
433 # build_image_x86_11()
434 build_image_x86_11() {
435         # Build the solaris pieces of the image
436         build_image_solaris
437 }