Wednesday, July 2, 2008

Script to find prerequisite ifixes for WebSphere Portal

Eventhough IBM fix central http://www-933.ibm.com/eserver/support/fixes/fixcentral provides a way of identifying ifix prequisites and downloading them, it's not efficient as some of the problems still prevail like , it's not upto date that you might not be able to find certain latest prequisites for recent ifix releases, which might lead you to go through manually of each of the ifixes one by one and find the prequisites list, which is really a pain and sometimes buggy when list is large in case of WCM related ifixes. So in order to ease the pain i wrote a shell script that will provide a prerequisite ifixes jar files. please copy the below script into a ifixPrerequisiteFinder.sh script file and run it with the required parameters. Note that you also need to have the all ifix zip files for the version you needed for which can be usually requested to send those to you through FTP from IBM Support by opening a PMR .

To find the prequisite for an ifix:
./ifixPrerequisiteFinder.sh --ifix PK66778 --ifixesDir /home/allifixes
--ifix - name of the ifix that it's prerequisites needs to be found
--ifixesDir - directory where all the ifixes for particular version are copied

When you run the command all the prerequisite jars are copied to the ./prerequisites directory.

Sample Output: 
bash-2.05b# ./ifixPrerequisiteFinder.sh --ifix PK66778 --ifixesDir ../
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
PK66778 prerequisites are available at ./prerequisites


ifixPrerequisiteFinder.sh

#!/bin/bash
export WAS_HOME=/usr/IBM/WebSphere/AppServer
export JAVA_HOME=$WAS_HOME/java/
export PATH=$JAVA_HOME:$PATH


function usage() {
echo "usage: $0 --ifix name --ifixesDir directory"
echo "e.g ifixprerequisitefinder.sh --ifix PK66778 --ifixesDir /home/portal/ifixes"
}

function findPrereqs() {
cp $ifixDir/*$1.zip .
if [ $? -eq 0 ]; then
jar=$(${JAVA_HOME}/bin/jar -xvf *$1.zip | grep .jar | awk '{print$2}')
efixFile=$(${JAVA_HOME}/bin/jar -tvf $jar | grep efixDriver | awk '{print$8}' | xargs -i ${JAVA_HOME}/bin/jar -xvf $jar {}| awk '{p
rint$2}')
echo -n "......................"
cat $efixFile | grep -i efix-id | sed 's/\[[[:digit:]]*]/:/' | sed 's/\s//g' | cut -c10-16 | xargs -i ./ifixPrerequisiteFinder.sh --
ifix {} --ifixesDir $ifixDir
else
echo "Warning !: ifix $1 is missing which is a prerequisite , please copy the ifix.zip file to ifixesDir to have a complete prereau
isites"
fi
}

while [ -n "$1" ]; do
case "$1" in
--ifix)
shift
currentJar=$1
if [ -z $currentJar ]; then
echo "Missing ifix Name " >&2
usage
exit 1
fi
;;
--ifixesDir)
shift
ifixDir=$1
if [ -z "$ifixDir" ]; then
echo "Missing ifixDir" >&2
usage
exit 1
fi
;;
esac
shift
done
if [ -z "currentJar" ]; then
echo "Missing ifix name to run" >&2
usage
exit 1
fi
if [ -z "$ifixDir" ]; then
echo "Missing ifixes directory to run" >&2
usage
exit 1
fi
if [ ! -e ./prerequisites ]; then
mkdir ./prerequisites
fi
findPrereqs $currentJar
pc=$(ps -ef | grep -c ifixPrerequisiteFinder.sh)
if [ $pc -lt 4 ]; then
c=$(ps -ef | grep -c ifixPrerequisiteFinder.sh)
if [ $pc -lt 4 ]; then
mv ./*.jar ./prerequisites
mv ./*.txt ./prerequisites
echo ""
echo $currentJar prerequisites are available at ./prerequisites
fi
exit 0

No comments:

There was an error in this gadget