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