Sun Management Center 4.0 Installation and Configuration Guide

ProcedureTo Create the JumpStart Finish Script

  1. Log in as root on the machine where you created the JumpStart profile directory.

  2. Go to the JumpStart profile directory that you created in Step 2, in To Create the JumpStart Install Server and Profile Directory.

  3. Create the JumpStart finish script.

    Review Security Considerations for Finish Scripts. Then, depending on your security requirements, use either of the following sample finish scripts as a guideline to create the finish script in the JumpStart profile directory.

    The first example shows a finish script in which the password seed and community string are hard coded. The second example shows a finish script that will prompt for the password seed and community string.

    Save your finish script with the sh extension, for example, base_agent_finish.sh.


Example 6–5 Sample Finish Script: Security Password Seed and Community String Hard Coded

#!/bin/sh
#
# Program type      : Unix bourne shell script
# Description       : Standard finish script for installing and 
#                     setting up Sun Management Center core agent
#
#
#
ROOTDIR=${ROOTDIR:-/a}               # Root directory for new OS
MNTDIR=${ROOTDIR}/mnt
LOGDIR=${ROOTDIR}/var/tmp/sunmcfinish
SI_CONFIG_DIR=${SI_CONFIG_DIR:-/export/home/JumpStart/jumpstart}
INSTALL_RESP=${SI_CONFIG_DIR}/install.cfg
SETUP_RESP=${SI_CONFIG_DIR}/setup.cfg
#
#
# Begin Main Program
#
#
umask 022
mkdir -p $LOGDIR
#
# Copy the install and setup response file to target system
#
cp ${INSTALL_RESP} $LOGDIR
cp ${SETUP_RESP} $LOGDIR
#
# mount Sun Management Center image
#
mount -F nfs bootserver01:/export/home/JumpStart/AgentImage $MNTDIR
[ $? -ne 0 ] && exit 1
# 
# run es-inst with -a -R -T and -A options
# skip the next line for Flash Archive based deployment
# Do not use the -T option if you have specified the TARGET_DIRECTORY 
# tag in install.cfg
#
${MNTDIR}/disk1/sbin/es-inst -a -R /a -T /a/opt -A ${LOGDIR}/install.cfg
#
# Clean up any rc script with the same name if present
#
test -f ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart && \
rm -f ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart
rm -f /etc/init.d/SunMCJumpStart
#
# Place rc script in rc3.d and init.d to do setup
# Remember to access es-setup based on the target directory location
#
echo "Creating rc script..."
cat > ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart << EOF
#!/sbin/sh
#
rm /etc/rc3.d/S80SunMCJumpStart /etc/init.d/SunMCJumpStart
SECURITY_SEED=abc123
SNMPV1_STRING=private
export SECURITY_SEED SNMPV1_STRING
/opt/SUNWsymon/sbin/es-setup -e -A /var/tmp/sunmcfinish/setup.cfg
EOF
cp ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart \
     ${ROOTDIR}/etc/init.d/SunMCJumpStart
exit 0


Example 6–6 Sample Finish Script: Prompt for Security Password Seed and Community

#!/bin/sh
#
# Program type      : Unix bourne shell script
# Description       : Standard finish script for installing and 
#                     setting up Sun Management Center core agent
#
#
#
ROOTDIR=${ROOTDIR:-/a}               # Root directory for new OS
MNTDIR=${ROOTDIR}/mnt
LOGDIR=${ROOTDIR}/var/tmp/sunmcfinish
SI_CONFIG_DIR=${SI_CONFIG_DIR:-/export/home/JumpStart/jumpstart}
INSTALL_RESP=${SI_CONFIG_DIR}/install.cfg
SETUP_RESP=${SI_CONFIG_DIR}/setup.cfg
#
#
# Begin Main Program
#
#
umask 022
mkdir -p $LOGDIR
#
# Copy the install and setup response file to target system
#
cp ${INSTALL_RESP} $LOGDIR
cp ${SETUP_RESP} $LOGDIR
#
# mount Sun Management Center image
#
mount -F nfs bootserver01:/export/home/JumpStart/AgentImage $MNTDIR
[ $? -ne 0 ] && exit 1
#
# Read secure inputs from user who invoked boot net - install
#
echo "Enter Security seed:"
read SECURITY_SEED
echo "Enter SNMP string:"
read SNMPV1_STRING
#
# run es-inst with -a -R -T and -A options
# skip the next line for Flash Archive based deployment
# Do not use the -T option if you have specified the TARGET_DIRECTORY 
# tag in install.cfg
#
${MNTDIR}/disk1/sbin/es-inst -a -R /a -T /a/opt -A ${LOGDIR}/install.cfg
#
# create a temporary es-setup script to use the secure information 
# read earlier
# Remember to access es-setup based on the target directory location 
#
FILE2=/a/opt/SUNWsymon/sbin/es-setup
FILE=/a/opt/SUNWsymon/sbin/es-setup.jumpstart
mv $FILE2 $FILE
count=`wc -l $FILE`
count=`echo $count | cut -d' ' -f1`
ncount=$count
count_enter=`expr $ncount - 3`
while [ $ncount -gt 0 ] ; do
   k=`tail -$ncount $FILE | head -1`
   if [ $ncount -eq $count_enter ]
   then
       echo $k >> $FILE2
       echo "SECURITY_SEED=$SECURITY_SEED" >> $FILE2
       echo "SNMPV1_STRING=$SNMPV1_STRING" >> $FILE2
   else
       echo $k >> $FILE2
   fi
   ncount=`expr $ncount - 1`
done
chmod +x $FILE2
#
# Clean up any rc script with the same name if present
#
test -f ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart && \
rm  -f ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart \
rm -f /etc/init.d/SunMCJumpStart
#
# Place rc script in rc3.d and init.d to do setup and cleanup 
# Remember to access es-setup based on the target directory location
# 
echo "Creating rc script..."
cat > ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart << EOF
#!/sbin/sh
#
rm /etc/rc3.d/S80SunMCJumpStart /etc/init.d/SunMCJumpStart
/opt/SUNWsymon/sbin/es-setup -e -A /var/tmp/sunmcfinish/setup.cfg
mv /opt/SUNWsymon/sbin/es-setup.jumpstart /opt/SUNWsymon/sbin/es-setup
EOF
cp ${ROOTDIR}/etc/rc3.d/S80SunMCJumpStart \
   ${ROOTDIR}/etc/init.d/SunMCJumpStart
exit 0