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:
Post a Comment