Home | History | Annotate | Download | only in pkgdefs
      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	"@(#)jas.dvdimage.ksh	1.26	08/06/09 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 GEO_DIR=${DVD}/Solaris_${ARCH}/Product/sun_cluster_geo
     51 MACH=$([ "${ARCH}" = "sparc" ] && { echo ${ARCH}; } || { echo "i386"; })
     52 ND=$([ "${DEBUG}" -eq 0 ] && echo "-nd")
     53 PKGARCH=${WS}/packages/${MACH}/Sol_${OS}${ND}
     54 PKGDEFS_DIR=${WS}/usr/src/pkgdefs
     55 SOL=Solaris_${OS}
     56 VROOT=${WS}/proto/Sol_${OS}${ND}/root_${MACH}
     57 
     58 # DVD image of external products
     59 DVDIMAGE_DIR=${PKGDEFS_DIR}/dvdimages/$(${BASENAME} ${DVD})
     60 
     61 # Geo packages
     62 PACKAGES_FRAMEWORK="\
     63 	SUNWscgctl \
     64 	SUNWscgctlr \
     65 	SUNWscghb \
     66 	SUNWscghbr \
     67 	SUNWscgman \
     68 	SUNWscgrepavs \
     69 	SUNWscgrepavsu \
     70 	SUNWscgrepodg \
     71 	SUNWscgrepodgu \
     72 	SUNWscgrepsrdf \
     73 	SUNWscgrepsrdfu \
     74 	SUNWscgreptc \
     75 	SUNWscgreptcu \
     76 	SUNWscgspm"
     77 
     78 PACKAGES_L10N="\
     79 	SUNWcscgctl \
     80 	SUNWcscgrepavsu \
     81 	SUNWcscgrepsrdfu \
     82 	SUNWcscgreptcu \
     83 	SUNWcscgspm \
     84 	SUNWjscgctl \
     85 	SUNWjscgman \
     86 	SUNWjscgrepavsu \
     87 	SUNWjscgrepsrdfu \
     88 	SUNWjscgreptcu \
     89 	SUNWjscgspm \
     90 	SUNWkscgctl \
     91 	SUNWkscgrepavsu \
     92 	SUNWkscgrepsrdfu \
     93 	SUNWkscgreptcu \
     94 	SUNWkscgspm"
     95 
     96 # Specify which components are supported on which platforms
     97 GEO="\
     98 	${PACKAGES_FRAMEWORK} \
     99 	${PACKAGES_L10N}"
    100 
    101 #
    102 # Functions
    103 #
    104 # Builds the external pieces of the image
    105 # build_image_external()
    106 build_image_external() {
    107 	# Check if this piece of the image has already been built
    108 	[ -e "${DVD}/.cdtoc" ] && return
    109 
    110 	echo "Adding the external pieces to the image"
    111 
    112 	# Create directories
    113 	${MKDIR} ${DVD} || error "Can't create directory ${DVD}"
    114 
    115 	# Add dvdimage of symlinks to external products
    116 	(cd ${DVDIMAGE_DIR} && ${FIND} . -print | ${CPIO} -oc) | (cd ${DVD} &&
    117 ${CPIO} -icdum)
    118 }
    119 
    120 # Builds the common pieces of the image
    121 # build_image_common()
    122 build_image_common() {
    123 	# Check if this piece of the image has already been built
    124 	[ -f "${GEO_DIR}/.producttoc" -a ! -h "${GEO_DIR}/.producttoc" ] && return
    125 
    126 	# Build the external pieces of the image
    127 	build_image_external
    128 
    129 	echo "Adding the common ${MACH} pieces to the image"
    130 
    131 	# Create directories
    132 	${MKDIR} ${GEO_DIR} || error "Can't create directory ${GEO_DIR}"
    133 
    134 	# Add .producttoc to top level directory
    135 	copy ${PKGDEFS_DIR}/dot.producttoc.sun_cluster_geo.${MACH} ${GEO_DIR}/.producttoc
    136 }
    137 
    138 # Builds the solaris pieces of the image
    139 # build_image_solaris()
    140 build_image_solaris() {
    141 	# Check if this piece of the image has already been built
    142 	[ -f "${GEO_DIR}/${SOL}/Packages/.clustertoc" -a ! -h "${GEO_DIR}/${SOL}/Packages/.clustertoc" ] && return
    143 
    144 	# Build the common pieces of the image
    145 	build_image_common
    146 
    147 	echo "Adding the ${SOL} ${MACH} pieces to the image"
    148 
    149 	# Create directories
    150 	${MKDIR} ${GEO_DIR}/${SOL}
    151 	${MKDIR} ${GEO_DIR}/${SOL}/Packages
    152 
    153 	# Add .clustertoc to geo Packages directory
    154 	copy ${PKGDEFS_DIR}/dot.clustertoc.sun_cluster_geo ${GEO_DIR}/${SOL}/Packages/.clustertoc
    155 
    156 	# Add .order to geo Packages directory
    157 	copy ${PKGDEFS_DIR}/dot.order.sun_cluster_geo ${GEO_DIR}/${SOL}/Packages/.order
    158 
    159 	# Copy packages from package archive to geo Packages directory
    160 	[ -d "${PKGARCH}" ] || error "Package archive not found"
    161 
    162 	for pkg in ${GEO}
    163 	do
    164 		[ -h "${GEO_DIR}/${SOL}/Packages/${pkg}" ] && ${RM} -r ${GEO_DIR}/${SOL}/Packages/${pkg}
    165 	done
    166 
    167 	${PKGTRANS} ${PKGARCH} ${GEO_DIR}/${SOL}/Packages ${GEO} || error "pkgtrans to ${GEO_DIR}/${SOL}/Packages failed"
    168 }
    169 
    170 # Builds the sparc solaris 9 pieces of the image
    171 # build_image_sparc_9()
    172 build_image_sparc_9() {
    173 	# Build the solaris pieces of the image
    174 	build_image_solaris
    175 }
    176 
    177 # Builds the sparc solaris 10 pieces of the image
    178 # build_image_sparc_10()
    179 build_image_sparc_10() {
    180 	# Build the solaris pieces of the image
    181 	build_image_solaris
    182 }
    183 
    184 # Builds the x86 solaris 10 pieces of the image
    185 # build_image_x86_10()
    186 build_image_x86_10() {
    187 	# Build the solaris pieces of the image
    188 	build_image_solaris
    189 }
    190 
    191 # Builds the sparc solaris 11 pieces of the image
    192 # build_image_sparc_11()
    193 build_image_sparc_11() {
    194 	# Build the solaris pieces of the image
    195 	build_image_solaris
    196 }
    197 
    198 # Builds the x86 solaris 11 pieces of the image
    199 # build_image_x86_11()
    200 build_image_x86_11() {
    201 	# Build the solaris pieces of the image
    202 	build_image_solaris
    203 }
    204