Sun Management Center 4.0 安裝與配置指南

Procedure建立 JumpStart 結束程序檔

  1. 以超級使用者身份登入您建立 JumpStart 設定檔目錄的機器。

  2. 移至您在建立 JumpStart 安裝伺服器和設定檔目錄步驟 2 中建立的 JumpStart 設定檔目錄。

  3. 建立 JumpStart 結束程序檔。

    檢閱結束程序檔的安全性注意事項。接著,視您的安全性需求而定,使用以下任一結束程序檔範例做為在 JumpStart 設定檔目錄中建立結束程序檔的準則。

    第一個範例顯示的結束程序檔中,其密碼種子和社群字串已硬編碼。第二個範例顯示的結束程序檔會提示輸入密碼種子和社群字串。

    sh 副檔名儲存您的結束程序檔,例如 base_agent_finish.sh


範例 6–5 結束程序檔範例:已硬編碼的安全性密碼種子和社群字串

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


範例 6–6 結束程序檔範例:提示輸入安全性密碼種子和社群字串

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