jumpstart - finish scripts

hi,

where i can find some help on how to write finish scripts for jump-start??
i tried sun-blueprints but i couldnt find it...

I saw a small blurb [here](http://www.blacksheepnetworks.com/security/resources/adminschoice/docs/jumpstart_solaris.htm\#Begin & Finish Scripts):

Also, check out http://www.blacksheepnetworks.com/security/resources/ and search for the phrase "SOLARIS JUMPSTART" - there's gotta be something you can use there. :slight_smile:

Here another resource:

For example:

Look at the following line for your rule file, that is you have a SUN E420R, with between 512 and 1024 RAM size and a hard disk between 8 and 18 GB, use the normal_BE.profile ( in the /jumpstart/Profiles/BE directory) and a Finish script MR_inst_drivers_BE.sh (in /jumpstart/Drivers directory)

model SUNW,Ultra-80 && memsize 512-1024 && disksize c0t0d0 8192-194560 - Profiles/BE/normal_BE.profile Drivers/MR_inst_drivers_BE.sh

The MR_inst_drivers_BE.sh can look like this:

#!/bin/sh
#
# Basic driver for Enterprise Engineering lab hosts.
#
FINISH_DIR="${SI_CONFIG_DIR}/Finish"
SCRIPT_LIST="install_recommended_patches.sh dns_config.sh cust_prof.sh"

for script in ${SCRIPT_LIST}
do
    if [ -f "${FINISH_DIR}/${script}" ]; then
        echo "Starting finish script: ${script}"
        echo ""
        . ${FINISH_DIR}/${script}
    else
        echo "ERROR: File not found: ${script}"
    fi
done

This Finish script look in the /jumpstart/Finish Directory and run
3 scripts:

   install\_recommended_patches.sh 

   dns_config.sh 

    cust_prof.sh

For example install_recommended_patches.sh looks like:

#!/bin/sh
#
#ident "@(#)install-recommended-patches.fin  1.6  00/10/19 SMI"
#
# This script is responsible for installing a Sun Recommended
# and Security Patch Cluster from ${BASEDIR}/${PATCH_DIR}.
set -x

errorCondition=0
mountedProc=0

BASEDIR="/a"
PATCH_SERV_DIR=""
PATCH_DIR="/mnt"
MNTTAB="${BASEDIR}/etc/mnttab"
OE_VER="`ps -ef |grep agregar |grep -v grep |awk '{print $13}'`"

mount -F nfs -o ro 192.168.215.183:/jumpstart/Patches ${BASEDIR}${PATCH_DIR}
case ${OE_VER} in

   5.8)
      PATCH_SERV_DIR=8_Recommended
      ;;

   5.7)
      PATCH_SERV_DIR=7_Recommended
      ;;

   5.6)
      PATCH_SERV_DIR=2.6_Recommended
      ;;

   5.5.1)
      PATCH_SERV_DIR=2.5.1_Recommended
      ;;

   *)
      errorCondition=1
      ;;

esac


if [ ${errorCondition} = 0 ]; then
   if [ ! -d ${BASEDIR}${PATCH_DIR} ]; then
      echo  "The directory, ${PATCH_DIR}, does not exist."
   else

      # Some patches require a loopback filesystem be used when 
      # installing using chroot.

      if [ -d /proc ]; then
         if [ "`df -n /proc | awk '{ print $3 }'`" = "proc" ]; then
            if [ -d ${BASEDIR}/proc ]; then
               if [ "`df -n ${BASEDIR}/proc | \
                  awk '{ print $3 }'`" != "proc" ]; then
                  mount -F lofs /proc ${BASEDIR}/proc
                  mountedProc=1
               fi
            fi
         fi
      fi

      if [ ! -s ${MNTTAB} ]; then
         if [ -s /etc/mnttab ]; then

            # First create ${MNTTAB} so patches can read it:

            echo "Copying /etc/mnttab from miniroot to ${MNTTAB}"
            echo ""

            rm -f ${MNTTAB}

            if [ "${OE_VER}" = "5.5.1" ]; then

               # This is necessary for "install_cluster" to get the mount
               # point for /var/sadm/patch from the "real" root filesystem.

               cat /etc/mnttab | sed 's/\/a/\//g' > ${MNTTAB}

               # This is necessary for "df" to execute which is needed by
               # "install_cluster" to determine if enough free disk 
               # space exists on the target system.

               touch           ${BASEDIR}/etc/.mnttab.lock
               chown root:root ${BASEDIR}/etc/.mnttab.lock
               chmod 644       ${BASEDIR}/etc/.mnttab.lock
            else
               cp /etc/mnttab ${MNTTAB}
            fi
         else
            echo  "Could not find a valid /etc/mnttab"
            errorCondition=1
         fi
      fi

      if [ ${errorCondition} = 0 ]; then

         SHOWCOMMAND=""

         if [ -x ${BASEDIR}/usr/sbin/patchadd ]; then
            SHOWCOMMAND="/usr/sbin/patchadd"
         elif [ -x ${BASEDIR}/usr/bin/showrev ]; then
            SHOWCOMMAND="/usr/bin/showrev"
         fi

#         if [ "${SHOWCOMMAND}" != "" ]; then
#            echo "The following patches are currently installed:"
#            echo ""
#            chroot ${BASEDIR} ${SHOWCOMMAND} -p
#            echo ""
#         fi
   
         cd ${BASEDIR}${PATCH_DIR}
   
         if [ -d ${PATCH_SERV_DIR} ]; then
            echo "Installing the ${PATCH_SERV_DIR} patch cluster."
            echo ""
   
            if [ "${SHOWCOMMAND}" = "/usr/sbin/patchadd" ]; then
               chroot ${BASEDIR} /usr/sbin/patchadd -d -u \
                  -M ${PATCH_DIR}/${PATCH_SERV_DIR} patch_order
            elif [ -x ${PATCH_DIR}/${PATCH_SERV_DIR}/install_cluster ]; then
               chroot ${BASEDIR} \
                  ${PATCH_DIR}/${PATCH_SERV_DIR}/install_cluster -q \
                  ${PATCH_DIR}/${PATCH_SERV_DIR}
            else
                  echo  "Cannot find /usr/sbin/patchadd or install_cluster"
            fi
         else 
            echo  "Could not find the ${PATCH_SERV_DIR} patch cluster"
         fi
      fi
cp -p ${BASEDIR}${PATCH_DIR}/nsswitch.conf /a/etc/nsswitch.conf

      umount ${BASEDIR}${PATCH_DIR}
      if [ ${mountedProc} = 1 ]; then
         umount ${BASEDIR}/proc
      fi
   fi
fi

For example dns_config.sh looks like:

#!/bin/sh
#
#ident "@(#)install-recommended-patches.fin  1.6  00/10/19 SMI"
#
# This script is responsible for installing a Sun Recommended
# and Security Patch Cluster from ${BASEDIR}/${PATCH_DIR}.
set -x

errorCondition=0
mountedProc=0

BASEDIR="/a"
PATCH_SERV_DIR=""
PATCH_DIR="/mnt"
MNTTAB="${BASEDIR}/etc/mnttab"
OE_VER="`uname -r`"
echo "domain labo.mr.com.ar" >> /a/etc/resolv.conf
echo "nameserver 200.149.64.166" >> /a/etc/resolv.conf
echo "nameserver 200.149.64.167" >> /a/etc/resolv.conf

and cust_prof.sh looks like:

#!/bin/sh
#
#ident "@(#)install-recommended-patches.fin  1.6  00/10/19 SMI"
#
# This script is responsible for installing a Sun Recommended
# and Security Patch Cluster from ${BASEDIR}/${PATCH_DIR}.
set -x

errorCondition=0
mountedProc=0

BASEDIR="/a"
PATCH_SERV_DIR=""
PATCH_DIR="/mnt"
MNTTAB="${BASEDIR}/etc/mnttab"
OE_VER="`uname -r`"
echo "PATH=$PATH:/usr/local/bin:/usr/dt/bin:/usr/openwin/bin" >> /a/etc/profile
echo "export PATH" >> /a/etc/profile

This help you ?

Regards. Hugo.

added code tags for readability --oombera