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
Programmatic check
As the internet didn't seem to know how to programatically lookup the installed iFixes and Fixpacks for a PortalServer, I'm going to share my solution, it the hope that someone can point me to a better way.
What I was able to work out from trawling the net and poking around at the WebSphere portal installation is that the install history for iFixes and Fixpacks for Portal are stored in the directory %PORTAL_HOME%/version/history. This makes the process of finding the fix level a case of:
1. Lookup the Portal home.
2. List the files in the version history directory.
Lookup the Portal Home
To lookup the portal home, use the fact that there is a WPS_HOME environment variable set in the WebSphere environment. Unfortunately looking up values in the WebSphere environment is non-trivial. The WebSphere environment is not made directly available, to access it you need to go through the WebSphere Admin service, and the WebSphere management mbeans.
The code to do this is:
com.ibm.websphere.management.AdminService as =
com.ibm.websphere.management.AdminServiceFactory.getAdminService();
String server = as.getProcessName();
javax.management.ObjectName serverName =
new javax.management.ObjectName("*:*,type=AdminOperations,process=" + server);
Set objectNames = as.queryNames(servName, null);
javax.management.ObjectName objectName =
(javax.management.ObjectName) objectNames.iterator().next();
Object[] args = new Object[] {"${WPS_HOME}"};
String[] signature = new String[] {"java.lang.String"};
String wpsHome = as.invoke(objectName,"expandVariable",args, signature);
The wpsHome variable will contain the string path to the websphere portal home directory.
List the Files in the Version History Directory
After retrieving the portal home, it is possible to lookup the fixpacks in the ${WPS_HOME}/version/history directory.
The following code does this:
File f = new File(wpsHome + File.separatorChar +
"version" + File.separatorChar + "history");
String[] children = f.list();
for (int i=0;i
}
In summary the full code snippet for this is:
com.ibm.websphere.management.AdminService as =
com.ibm.websphere.management.AdminServiceFactory.getAdminService();
String server = as.getProcessName();
javax.management.ObjectName serverName =
new javax.management.ObjectName("*:*,type=AdminOperations,process=" + server);
Set objectNames = as.queryNames(servName, null);
javax.management.ObjectName objectName =
(javax.management.ObjectName) objectNames.iterator().next();
Object[] args = new Object[] {"${WPS_HOME}"};
String[] signature = new String[] {"java.lang.String"};
String wpsHome = as.invoke(objectName,"expandVariable",args, signature);
File f = new File(wpsHome + File.separatorChar +
"version" + File.separatorChar + "history");
String[] children = f.list();
for (int i=0;i
}
The work of mapping file names to the installed fix packs/iFixes is left as an exercise for the reader.
Does anyone know if there is a better way of dong this?