# This class action script copies the files being replaced # into a package being constructed in $BUILD_DIR. This class # action script is only appropriate for regular files that # are installed by simply copying them into place. # # For special package objects such as edittable files, the patch # producer must supply appropriate class action scripts. # # directory format options. # # @(#)i.script 1.7 97/06/26 SMI # # Copyright (c) 1995 by Sun Microsystems, Inc. # All rights reserved # PATH=/usr/sadm/bin:$PATH PATH="/usr/bin:/usr/sbin:${PATH}" ECHO="/usr/bin/echo" SED="/usr/bin/sed" PKGPROTO="/usr/bin/pkgproto" EXPR="/usr/bin/expr" # used by dirname MKDIR="/usr/bin/mkdir" CP="/usr/bin/cp" RM="/usr/bin/rm" MV="/usr/bin/mv" recovery="no" Pn=$$ procIdCtr=0 CMDS_USED="$ECHO $SED $PKGPROTO $EXPR $MKDIR $CP $RM $MV" LIBS_USED="" if [ "$PKG_INSTALL_ROOT" = "/" ]; then PKG_INSTALL_ROOT="" fi # Check to see if this is a patch installation retry. if [ "$INTERRUPTION" = "yes" ]; then if [ -d "$PKG_INSTALL_ROOT/var/tmp/$SUNW_PATCHID.$PKGINST" ] || [ -d "$PATCH_BUILD_DIR/$SUNW_PATCHID.$PKGINST" ]; then recovery="yes" fi fi if [ -n "$PATCH_BUILD_DIR" -a -d "$PATCH_BUILD_DIR" ]; then BUILD_DIR="$PATCH_BUILD_DIR/$SUNW_PATCHID.$PKGINST" else BUILD_DIR="$PKG_INSTALL_ROOT/var/tmp/$SUNW_PATCHID.$PKGINST" fi FILE_DIR=$BUILD_DIR/files RELOC_DIR=$FILE_DIR/reloc ROOT_DIR=$FILE_DIR/root BO_Deletes=$FILE_DIR/deletes PROGNAME=`basename $0` if [ "$PATCH_PROGRESSIVE" = "true" ]; then PATCH_NO_UNDO="true" fi # Since this is generic, figure out the class. Class=`echo $PROGNAME | nawk ' { print substr($0, 3) }'` # Since this is an update, $BASEDIR is guaranteed to be correct BD=${BASEDIR:-/} cd $BD # # First, figure out the dynamic libraries that can trip us up. # if [ -z "$PKG_INSTALL_ROOT" ]; then if [ -x /usr/bin/ldd ]; then LIB_LIST=`/usr/bin/ldd $CMDS_USED | sort -u | nawk ' $1 ~ /\// { continue; } { printf "%s ", $3 } '` else LIB_LIST="/usr/lib/libc.so.1 /usr/lib/libdl.so.1 /usr/lib/libw.so.1 /usr/lib/libintl.so.1 /usr/lib/libadm.so.1 /usr/lib/libelf.so.1" fi fi # # Now read the list of files in this class to be replaced. If the file # is already in place, then this is a change and we need to copy it # over to the build directory if undo is allowed. If it's a new entry # (No $dst), then it goes in the deletes file for the backout package. # procIdCtr=0 while read src dst; do if [ "$PATCH_PROGRESSIVE" = "true" ]; then # If this is being used in an old-style patch, insert # the old-style script commands here. #XXXOld_CommandsXXX# echo >/dev/null # dummy fi if [ "${PATCH_NO_UNDO}" != "true" ]; then # # Here we construct the path to the appropriate source # tree for the build. First we try to strip BASEDIR. If # there's no BASEDIR in the path, we presume that it is # absolute and construct the target as an absolute path # by stripping PKG_INSTALL_ROOT. FS_Path is the path to # the file on the file system (for deletion purposes). # Build_Path is the path to the object in the build # environment. # if [ "$BD" = "/" ]; then FS_Path=`$ECHO $dst | $SED s@"$BD"@@` else FS_Path=`$ECHO $dst | $SED s@"$BD/"@@` fi # If it's an absolute path the attempt to strip the # BASEDIR will have failed. if [ $dst = $FS_Path ]; then if [ -z "$PKG_INSTALL_ROOT" ]; then FS_Path=$dst Build_Path="$ROOT_DIR$dst" else Build_Path="$ROOT_DIR`echo $dst | \ sed s@"$PKG_INSTALL_ROOT"@@`" FS_Path=`echo $dst | \ sed s@"$PKG_INSTALL_ROOT"@@` fi else Build_Path="$RELOC_DIR/$FS_Path" fi if [ -f $dst ]; then # If this is replacing something cd $FILE_DIR # # Construct the prototype file entry. We replace # the pointer to the filesystem object with the # build directory object. # echo "e drvalias $FS_Path=$Build_Path ? ? ?" >> \ $BUILD_DIR/prototype # Now copy over the file if [ "$recovery" = "no" ]; then DirName=`dirname $Build_Path` $MKDIR -p $DirName $CP -p $dst $Build_Path else # If this file is already in the build area skip it if [ -f "$Build_Path" ]; then cd $BD continue else DirName=`dirname $Build_Path` if [ ! -d "$DirName" ]; then $MKDIR -p $DirName fi $CP -p $dst $Build_Path fi fi cd $BD else # It's brand new $ECHO $FS_Path >> $BO_Deletes fi fi # If special processing is required for each src/dst pair, # add that here. # #XXXSpecial_CommandsXXX# # if [ ! -f "$dst" ] ; then cp $src $dst else sed -e '/^cpu modi4v0m[ ]*$/d' \ -e '/^cpu TI,TMS390Z50[ ]*$/d' \ -e '/^obio bootbus[ ]*$/d' \ -e '/^sw drum[ ]*$/d' \ -e '/^ie sie[ ]*$/d' \ -e '/^sbus sbi[ ]*$/d' $dst > /tmp/tmp.$$ cp /tmp/tmp.$$ $dst rm -f /tmp/tmp.$$ grep '^xbox ' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'xbox SUNW,xbox' >> $dst fi grep '^sx ' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'sx SUNW,sx' >> $dst fi grep '^isp QLGC,isp' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'isp QLGC,isp' >> $dst fi grep '^isp SUNW,isp' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'isp SUNW,isp' >> $dst fi grep '^isp SUNW,isptwo' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'isp SUNW,isptwo' >> $dst fi grep '^stc SUNW,spif' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'stc SUNW,spif' >> $dst fi grep '^audiocs SUNW,CS4231' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'audiocs SUNW,CS4231' >> $dst fi grep '^pci SUNW,pci' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pci SUNW,pci' >> $dst fi grep '^soc SUNW,soc' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'soc SUNW,soc' >> $dst fi grep '^pln SUNW,pln' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pln SUNW,pln' >> $dst fi grep '^ssd SUNW,ssd' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'ssd SUNW,ssd' >> $dst fi grep '^fas SUNW,fas' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'fas SUNW,fas' >> $dst fi grep '^hme SUNW,hme' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'hme SUNW,hme' >> $dst fi grep '^environ environment' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'environ environment' >> $dst fi grep '^simmstat simm-status' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'simmstat simm-status' >> $dst fi grep '^sysctrl clock-board' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'sysctrl clock-board' >> $dst fi grep '^ebus SUNW,ebus' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'ebus SUNW,ebus' >> $dst fi grep '^fd fdthree' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'fd fdthree' >> $dst fi grep '^glm pci1000,f' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'glm pci1000,f' >> $dst fi grep '"pci1011,1"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pci_pci "pci1011,1"' >> $dst fi grep '"pci1011,21"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pci_pci "pci1011,21"' >> $dst fi grep '"pci1014,22"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pci_pci "pci1014,22"' >> $dst fi grep '^pci "pci108e,8000"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pci "pci108e,8000"' >> $dst fi grep '^pci "pciclass,060000"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pci "pciclass,060000"' >> $dst fi grep '^pci_pci "pciclass,060400"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pci_pci "pciclass,060400"' >> $dst fi grep '"pci1011,24"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'pci_pci "pci1011,24"' >> $dst fi grep '^socal SUNW,socal' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'socal SUNW,socal' >> $dst fi grep '^simba "pci108e,5000"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'simba "pci108e,5000"' >> $dst fi grep '"pci1095,646"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'uata "pci1095,646"' >> $dst fi grep '"ide-disk"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'dad "ide-disk"' >> $dst fi grep '"ide-cdrom"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'atapicd "ide-cdrom"' >> $dst fi grep 'glm "pci1000,1"' $dst > /dev/null 2>&1 if [ $? != 0 ] ; then echo 'glm "pci1000,1"' >> $dst fi fi done # If additional operations are required for this package, place # those package-specific commands here. #XXXSpecial_CommandsXXX# exit 0