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_KERBEROS=SUNWsckrb5
  77 
  78 PACKAGES_L10N="\
  79         SUNWcscapc \
  80         SUNWcscdns \
  81         SUNWcschadb \
  82         SUNWcschtt \
  83         SUNWcsclc \
  84         SUNWcscnfs \
  85         SUNWcscor \
  86         SUNWcscs1as \
  87         SUNWcscs1mq \
  88         SUNWcscsap \
  89         SUNWcscsapdb \
  90         SUNWcscsapenq \
  91         SUNWcscsaprepl \
  92         SUNWcscsapscs \
  93         SUNWcscsapwebas \
  94         SUNWcscsbl \
  95         SUNWcscsyb \
  96         SUNWcscwls \
  97         SUNWdschadb \
  98         SUNWdschtt \
  99         SUNWdscs1as \
 100         SUNWdscs1mq \
 101         SUNWeschadb \
 102         SUNWeschtt \
 103         SUNWescs1as \
 104         SUNWescs1mq \
 105         SUNWfscapc \
 106         SUNWfscdns \
 107         SUNWfschadb \
 108         SUNWfschtt \
 109         SUNWfsclc \
 110         SUNWfscnfs \
 111         SUNWfscs1as \
 112         SUNWfscs1mq \
 113         SUNWfscsap \
 114         SUNWfscsapdb \
 115         SUNWfscsbl \
 116         SUNWfscwls \
 117         SUNWhschadb \
 118         SUNWhschtt \
 119         SUNWhscs1as \
 120         SUNWhscs1mq \
 121         SUNWjscapc \
 122         SUNWjscdns \
 123         SUNWjschadb \
 124         SUNWjschtt \
 125         SUNWjsclc \
 126         SUNWjscnfs \
 127         SUNWjscor \
 128         SUNWjscs1as \
 129         SUNWjscs1mq \
 130         SUNWjscsap \
 131         SUNWjscsapdb \
 132         SUNWjscsapenq \
 133         SUNWjscsaprepl \
 134         SUNWjscsapscs \
 135         SUNWjscsapwebas \
 136         SUNWjscsbl \
 137         SUNWjscsyb \
 138         SUNWjscwls \
 139         SUNWkschadb \
 140         SUNWkschtt \
 141         SUNWkscs1as \
 142         SUNWkscs1mq"
 143 
 144 PACKAGES_LIVECACHE=SUNWsclc
 145 
 146 PACKAGES_MQI=SUNWscmqi
 147 
 148 PACKAGES_MQS=SUNWscmqs
 149 
 150 PACKAGES_MYS=SUNWscmys
 151 
 152 PACKAGES_N1G_SPS=SUNWscsps
 153 
 154 PACKAGES_NFS=SUNWscnfs
 155 
 156 PACKAGES_ORACLE=SUNWscor
 157 
 158 PACKAGES_ORACLE_9IAS=SUNWsc9ias
 159 
 160 PACKAGES_POSTGRESQL=SUNWscPostgreSQL
 161 
 162 PACKAGES_S1AS=SUNWscs1as
 163 
 164 PACKAGES_S1MQ=SUNWscs1mq
 165 
 166 PACKAGES_S1WS=SUNWschtt
 167 
 168 PACKAGES_SAA=SUNWscsaa
 169 
 170 PACKAGES_SAP=SUNWscsap
 171 
 172 PACKAGES_SAPDB=SUNWscsapdb
 173 
 174 PACKAGES_SAPWEBAS="\
 175         SUNWscsapenq \
 176         SUNWscsaprepl \
 177         SUNWscsapscs \
 178         SUNWscsapwebas"
 179 
 180 PACKAGES_SIEBEL=SUNWscsbl
 181 
 182 PACKAGES_SMB=SUNWscsmb
 183 
 184 PACKAGES_SOLARIS_ZONES=SUNWsczone
 185 
 186 PACKAGES_SUN_GRID_ENG=SUNWscsge
 187 
 188 PACKAGES_SWIFT_GWAY=SUNWscsag
 189 
 190 PACKAGES_SYBASE=SUNWscsyb
 191 
 192 PACKAGES_WLS=SUNWscwls
 193 
 194 # Specify which agents are supported on which platforms
 195 sparc_9_AGENTS="\
 196         ${PACKAGES_AGFA_IMPAX} \
 197         ${PACKAGES_APACHE} \
 198         ${PACKAGES_APACHE_TC} \
 199         ${PACKAGES_DHC} \
 200         ${PACKAGES_DNS} \
 201         ${PACKAGES_EBS} \
 202         ${PACKAGES_HADB} \
 203         ${PACKAGES_LIVECACHE} \
 204         ${PACKAGES_MQI} \
 205         ${PACKAGES_MQS} \
 206         ${PACKAGES_MYS} \
 207         ${PACKAGES_N1G_SPS} \
 208         ${PACKAGES_NFS} \
 209         ${PACKAGES_ORACLE} \
 210         ${PACKAGES_ORACLE_9IAS} \
 211         ${PACKAGES_POSTGRESQL} \
 212         ${PACKAGES_S1AS} \
 213         ${PACKAGES_S1MQ} \
 214         ${PACKAGES_S1WS} \
 215         ${PACKAGES_SAA} \
 216         ${PACKAGES_SAP} \
 217         ${PACKAGES_SAPDB} \
 218         ${PACKAGES_SAPWEBAS} \
 219         ${PACKAGES_SIEBEL} \
 220         ${PACKAGES_SMB} \
 221         ${PACKAGES_SUN_GRID_ENG} \
 222         ${PACKAGES_SWIFT_GWAY} \
 223         ${PACKAGES_SYBASE} \
 224         ${PACKAGES_WLS}"
 225 
 226 sparc_10_AGENTS="\
 227         ${PACKAGES_APACHE} \
 228         ${PACKAGES_APACHE_TC} \
 229         ${PACKAGES_DHC} \
 230         ${PACKAGES_DNS} \
 231         ${PACKAGES_EBS} \
 232         ${PACKAGES_HADB} \
 233         ${PACKAGES_KERBEROS} \
 234         ${PACKAGES_LIVECACHE} \
 235         ${PACKAGES_MQI} \
 236         ${PACKAGES_MQS} \
 237         ${PACKAGES_MYS} \
 238         ${PACKAGES_N1G_SPS} \
 239         ${PACKAGES_NFS} \
 240         ${PACKAGES_ORACLE} \
 241         ${PACKAGES_ORACLE_9IAS} \
 242         ${PACKAGES_POSTGRESQL} \
 243         ${PACKAGES_S1AS} \
 244         ${PACKAGES_S1MQ} \
 245         ${PACKAGES_S1WS} \
 246         ${PACKAGES_SAA} \
 247         ${PACKAGES_SAP} \
 248         ${PACKAGES_SAPDB} \
 249         ${PACKAGES_SAPWEBAS} \
 250         ${PACKAGES_SIEBEL} \
 251         ${PACKAGES_SMB} \
 252         ${PACKAGES_SOLARIS_ZONES} \
 253         ${PACKAGES_SUN_GRID_ENG} \
 254         ${PACKAGES_SWIFT_GWAY} \
 255         ${PACKAGES_SYBASE} \
 256         ${PACKAGES_WLS}"
 257 
 258 # Support for S11 is unknown at this time, so include all agents
 259 sparc_11_AGENTS="\
 260         ${PACKAGES_AGFA_IMPAX} \
 261         ${PACKAGES_APACHE} \
 262         ${PACKAGES_APACHE_TC} \
 263         ${PACKAGES_DHC} \
 264         ${PACKAGES_DNS} \
 265         ${PACKAGES_EBS} \
 266         ${PACKAGES_HADB} \
 267         ${PACKAGES_KERBEROS} \
 268         ${PACKAGES_L10N} \
 269         ${PACKAGES_LIVECACHE} \
 270         ${PACKAGES_MQI} \
 271         ${PACKAGES_MQS} \
 272         ${PACKAGES_MYS} \
 273         ${PACKAGES_N1G_SPS} \
 274         ${PACKAGES_NFS} \
 275         ${PACKAGES_ORACLE} \
 276         ${PACKAGES_ORACLE_9IAS} \
 277         ${PACKAGES_POSTGRESQL} \
 278         ${PACKAGES_S1AS} \
 279         ${PACKAGES_S1MQ} \
 280         ${PACKAGES_S1WS} \
 281         ${PACKAGES_SAA} \
 282         ${PACKAGES_SAP} \
 283         ${PACKAGES_SAPDB} \
 284         ${PACKAGES_SAPWEBAS} \
 285         ${PACKAGES_SIEBEL} \
 286         ${PACKAGES_SMB} \
 287         ${PACKAGES_SOLARIS_ZONES} \
 288         ${PACKAGES_SUN_GRID_ENG} \
 289         ${PACKAGES_SWIFT_GWAY} \
 290         ${PACKAGES_SYBASE} \
 291         ${PACKAGES_WLS}"
 292 
 293 i386_10_AGENTS="\
 294         ${PACKAGES_APACHE} \
 295         ${PACKAGES_APACHE_TC} \
 296         ${PACKAGES_DHC} \
 297         ${PACKAGES_DNS} \
 298         ${PACKAGES_HADB} \
 299         ${PACKAGES_KERBEROS} \
 300         ${PACKAGES_LIVECACHE} \
 301         ${PACKAGES_MQI} \
 302         ${PACKAGES_MQS} \
 303         ${PACKAGES_MYS} \
 304         ${PACKAGES_N1G_SPS} \
 305         ${PACKAGES_NFS} \
 306         ${PACKAGES_ORACLE} \
 307         ${PACKAGES_ORACLE_9IAS} \
 308         ${PACKAGES_POSTGRESQL} \
 309         ${PACKAGES_S1AS} \
 310         ${PACKAGES_S1MQ} \
 311         ${PACKAGES_S1WS} \
 312         ${PACKAGES_SAP} \
 313         ${PACKAGES_SAPDB} \
 314         ${PACKAGES_SAPWEBAS} \
 315         ${PACKAGES_SMB} \
 316         ${PACKAGES_SOLARIS_ZONES} \
 317         ${PACKAGES_SUN_GRID_ENG} \
 318         ${PACKAGES_SYBASE} \
 319         ${PACKAGES_WLS}"
 320 
 321 i386_11_AGENTS=${sparc_11_AGENTS}
 322 
 323 AGENTS=$(eval echo \${${MACH}_${OS}_AGENTS})
 324 
 325 #
 326 # Functions
 327 #
 328 # Builds the external pieces of the image
 329 # build_image_external()
 330 build_image_external() {
 331         # Check if this piece of the image has already been built
 332         [ -h "${DVD}/Copyright" ] && return
 333 
 334         echo "Adding the external pieces to the image"
 335 
 336         # Create directories
 337         ${MKDIR} ${DVD} || error "Can't create directory ${DVD}"
 338 
 339         # Add dvdimage of symlinks to external products
 340         (cd ${DVDIMAGE_DIR} && ${FIND} . -print | ${CPIO} -oc) | (cd ${DVD} &&
 341 ${CPIO} -icdum)
 342 }
 343 
 344 # Builds the common pieces of the image
 345 # build_image_common()
 346 build_image_common() {
 347         # Check if this piece of the image has already been built
 348         [ -f "${AGENTS_DIR}/.producttoc" -a ! -h "${AGENTS_DIR}/.producttoc" ] && return
 349 
 350         # Build the external pieces of the image
 351         build_image_external
 352 
 353         echo "Adding the common ${MACH} pieces to the image"
 354 
 355         # Create directories
 356         ${MKDIR} ${AGENTS_DIR} || error "Can't create directory ${AGENTS_DIR}"
 357         [ -h "${AGENTS_DIR}/LICENSEREADME" ] && ${RM} ${AGENTS_DIR}/LICENSEREADME
 358         ${MKDIR} ${AGENTS_DIR}/LICENSEREADME
 359 
 360         # Add .producttoc to top level directory
 361         copy ${PKGDEFS_DIR}/dot.producttoc.sun_cluster_agents.${MACH} ${AGENTS_DIR}/.producttoc
 362 
 363         # Add Copyright to top level directory
 364         copy ${CLOSED_PKGDEFS_DIR}/Copyright ${AGENTS_DIR}
 365 
 366         # Add LICENSE file to LICENSEREADME directory
 367         copy ${CLOSED_PKGDEFS_DIR}/Solaris_Cluster_Express_Entitlement.txt ${AGENTS_DIR}/LICENSEREADME
 368 }
 369 
 370 # Builds the solaris pieces of the image
 371 # build_image_solaris()
 372 build_image_solaris() {
 373         # Check if this piece of the image has already been built
 374         [ -f "${AGENTS_DIR}/${SOL}/Packages/.clustertoc" -a ! -h "${AGENTS_DIR}/${SOL}/Packages/.clustertoc" ] && return
 375 
 376         # Build the common pieces of the image
 377         build_image_common
 378 
 379         echo "Adding the ${SOL} ${MACH} pieces to the image"
 380 
 381         # Create directories
 382         ${MKDIR} ${AGENTS_DIR}/${SOL}
 383         ${MKDIR} ${AGENTS_DIR}/${SOL}/Packages
 384 
 385         # Add .clustertoc to agents Packages directory
 386         copy ${PKGDEFS_DIR}/dot.clustertoc ${AGENTS_DIR}/${SOL}/Packages/.clustertoc
 387 
 388         # Add .order to agents Packages directory
 389         copy ${PKGDEFS_DIR}/dot.order ${AGENTS_DIR}/${SOL}/Packages/.order
 390 
 391         # Copy packages from package archive to agents Packages directory
 392         [ -d "${PKGARCH}" ] || error "Package archive not found"
 393 
 394         for pkg in ${AGENTS}
 395         do
 396                 [ -h "${AGENTS_DIR}/${SOL}/Packages/${pkg}" ] && ${RM} -r ${AGENTS_DIR}/${SOL}/Packages/${pkg}
 397         done
 398 
 399         ${PKGTRANS} ${PKGARCH} ${AGENTS_DIR}/${SOL}/Packages ${AGENTS} || error "pkgtrans to ${AGENTS_DIR}/${SOL}/Packages failed"
 400 }
 401 
 402 # Builds the sparc solaris 9 pieces of the image
 403 # build_image_sparc_9()
 404 build_image_sparc_9() {
 405         # Build the solaris pieces of the image
 406         build_image_solaris
 407 }
 408 
 409 # Builds the sparc solaris 10 pieces of the image
 410 # build_image_sparc_10()
 411 build_image_sparc_10() {
 412         # Build the solaris pieces of the image
 413         build_image_solaris
 414 }
 415 
 416 # Builds the x86 solaris 10 pieces of the image
 417 # build_image_x86_10()
 418 build_image_x86_10() {
 419         # Build the solaris pieces of the image
 420         build_image_solaris
 421 }
 422 
 423 # Builds the sparc solaris 11 pieces of the image
 424 # build_image_sparc_11()
 425 build_image_sparc_11() {
 426         # Build the solaris pieces of the image
 427         build_image_solaris
 428 }
 429 
 430 # Builds the x86 solaris 11 pieces of the image
 431 # build_image_x86_11()
 432 build_image_x86_11() {
 433         # Build the solaris pieces of the image
 434         build_image_solaris
 435 }