Guide d'installation et de configuration de Sun Management Center 3.6

ProcedureCréation du script de finition JumpStart

Étapes
  1. Connectez-vous en tant que super-utilisateur sur la machine où vous avez créé le répertoire de profils JumpStart.

  2. Allez au répertoire de profils JumpStart que vous avez créé à l'Étape 2 dans Création du serveur d’installation et du répertoire des profils.

  3. Créez le script de finition JumpStart.

    Consultez les Remarques sur la sécurité concernant les scripts de finition. Ensuite, selon vos exigences en matière de sécurité, utilisez l’un ou l’autre des exemples de scripts de finition suivants pour créer le script de finition dans le répertoire de profils JumpStart.

    Le premier exemple montre un script de finition dans lequel le germe mot de passe de sécurité et la chaîne de communauté ont été intégrés. Le deuxième exemple montre un script de finition qui demandera le germe mot de passe de sécurité et la chaîne de communauté.

    Sauvegardez votre script de finition en utilisant l’extension sh par exemple, base_agent_finish.sh .


Exemple 6–5 Exemple de script de finition : germe mot de passe de sécurité et chaîne de communauté intégrés au code

#!/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


Exemple 6–6 Exemple de script de finition : invite à entrer le germe mot de passe de sécurité et la chaîne de communauté

#!/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