手動インストール用のパッチセット作成方法Juergen Fleischer、2006 年 12 月 Sun Update Connection - Enterprise の主な目的は、解析、依存関係解決、ステージング、および最終インストールなど、すべてのパッチ管理作業を完全自動化することです。 しかし、自動化を最終目的とはしていますが、Sun Update Connection - Enterprise では最後のインストールまで実行できないこともあります。 たとえば、標準パッチセットの提供を担当するのはシステム管理グループで、従来の方法を使用してインストール自体を担当するのは IT 運用グループの場合です。 また、現在稼働しているルート環境でなく、代替ブート環境にパッチをインストールする場合も、完全自動化できない可能性があります。 このような作業はどうすれば行えるのでしょうか? Sun Update Connection - Enterprise を使用すると、ジョブをシミュレーションモードで実行できます。 すべての依存関係は解決され、必要なパッチがクライアントにダウンロードされます。パッチは、ジョブを配備モードで再実行すると使用可能になります。 シミュレーションジョブが終了すると、パッチは ローカルの前処理スクリプト 最後に、スクリプト パッチセット作成スクリプト
!/bin/bash
#
# create_patchset
#
# create a standalone patch set for manual installation at
# /var/tmp/patchset
#
# The script uses the output of a patch job run in simulation
# mode. It must be run in the very next job as pre-action
# script in deploy mode.
# Author: Juergen.Fleischer@Sun.COM
#
# v1.1: 12-Nov-2006
#
PATCHSET=/var/tmp/patchset
FWDIR=/var/tmp/patchset/firmware+flashprom
BASEDIR=/var/lib/uce/agent
RESOLVE=/logs/resolve.log
BLOBS=/blobs
# to ensure that we don't have to fight with locales
LC_ALL=C
export LC_ALL
#
# We have to find the last line of the last simulation job
# in resolve.log. It contains the No. of patches ...
#
SIMULATE_RESULTS=$(cat -n $RESOLVE | \
grep 'Total number of sorted operations :'|tail -2|head -1)
NO_PATCHES=$( echo $SIMULATE_RESULTS | nawk '{print $8}' )
if [ -z "$NO_PATCHES" ]
then
echo Could not determine needed patches from $RESOLVE
echo Aborting ...
exit 1
fi
#
# LAST_LINE is the line with the last patchid in the resolve.log
# file
#
LAST_LINE=$(( $(echo $SIMULATE_RESULTS|nawk '{print $1}') -1 ))
rm -rf $PATCHSET
mkdir $PATCHSET
cd $PATCHSET
cp /dev/null patch_order
#
# we will loop now over the NO_PATCHES lines in resolve.log
# until we reach the last patchid
#
echo
echo Starting to create standalone patch set for manual installation
echo or installation into an Alternate Boot Environment \(ABE\).
echo
head -$LAST_LINE $RESOLVE | tail -$NO_PATCHES | while read line
do
PATCHID=$(echo "$line" |cut -c16-24)
BLOB=/$(echo "$line"|cut -c6-13).blob
echo Copying patchid $PATCHID
if [ -z "$( file | grep -w ZIP )" ]
then
gzcat | tar xf -
else
unzip -q
fi
rm -rf META-INF
if [ -f "/.diPatch" ]
then
echo $PATCHID >> patch_order
else
# this is not a direct instance patch, assuming FW patch
[ -d "$FWDIR" ] || mkdir $FWDIR
mv $PATCHID $FWDIR
echo Moving patch $PATCHID to firmware subdirectory
fi done
echo
echo 'Copying install script "install_all_patches"'
cat >install_all_patches <<EOF
#!/usr/bin/sh
# Usage: ./install_all_patches [ -R /ABE ]
# to ensure that the filesystem /opt is available
mount /opt 2>/dev/null && echo Filesystem /opt mounted ...
# install patches, forward additional args like "-R /ABE"
patchadd "$@" -M $PWD patch_order EOF
chmod a+x install_all_patches
echo
echo Patch set successfully created in directory $PATCHSET
echo
echo 'Use "./install_all_patches" to install the patch set'
echo
Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License. |
BigAdmin SubscriptionsBigAdmin Areas
BigAdmin Sun Center
BigAdmin Topics |