#ident "%W%"
getInstallType()
{
RESP=""
while [ -z "${RESP}" ]
do
echo -e "
The package has nine different install types.
They are:
1 - stable1 integration installation
2 - stable2 integration installation
3 - stable3 integration installation
4 - stable4 integration installation
5 - uat1 installation
6 - uat2 installation
7 - uat3 installation
8 - cob installation
9 - production installation
Installation type (default: 9 - production): \c"
read RESP
case "${RESP:=production}" in
"1" |"stable1")
INSTALL_TYPE="oprstable1"
RPM_INSTALL_APPS_DIR_PREFIX=/apps/oprisk
RPM_INSTALL_APPS_DIR=/apps/oprisk/oprstable1 ;;
"2" |"stable2")
INSTALL_TYPE="oprstable2"
RPM_INSTALL_APPS_DIR_PREFIX=/apps/oprisk
RPM_INSTALL_APPS_DIR=/apps/oprisk/oprstable2 ;;
"3" |"stable3")
INSTALL_TYPE="oprstable3"
RPM_INSTALL_APPS_DIR_PREFIX=/apps/oprisk
RPM_INSTALL_APPS_DIR=/apps/oprisk/oprstable3 ;;
"4" |"stable4")
INSTALL_TYPE="oprstable4"
RPM_INSTALL_APPS_DIR_PREFIX=/apps/oprisk
RPM_INSTALL_APPS_DIR=/apps/oprisk/oprstable4 ;;
"5" |"uat1")
INSTALL_TYPE="oprqa"
RPM_INSTALL_APPS_DIR_PREFIX=/wsste/WAS_AppFiles
RPM_INSTALL_APPS_DIR=/wsste/WAS_AppFiles/oprwsutg/uat ;;
"6" |"uat2")
INSTALL_TYPE="oprqa2"
RPM_INSTALL_APPS_DIR_PREFIX=/wsste/WAS_AppFiles
RPM_INSTALL_APPS_DIR=/wsste/WAS_AppFiles/oprwsutg/uat2 ;;
"7" |"uat3")
INSTALL_TYPE="oprqa3"
RPM_INSTALL_APPS_DIR_PREFIX=/wsste/WAS_AppFiles
RPM_INSTALL_APPS_DIR=/wsste/WAS_AppFiles/oprwsutg/uat3 ;;
"8" |"cob")
INSTALL_TYPE="oprcob"
RPM_INSTALL_APPS_DIR_PREFIX=/wsste/WAS_AppFiles
RPM_INSTALL_APPS_DIR=/wsste/WAS_AppFiles/oprwsprg ;;
"9" |"production")
INSTALL_TYPE="opr"
RPM_INSTALL_APPS_DIR_PREFIX=/wsste/WAS_AppFiles
RPM_INSTALL_APPS_DIR=/wsste/WAS_AppFiles/oprwsprg ;;
*)
echo "
$RESP: invalid response, please try again!
Use the option letter or action keyword."
RESP=""
;;
esac
echo "Setting install type to: ${INSTALL_TYPE}"
export INSTALL_TYPE
PKG=${INSTALL_TYPE}
export PKG
done
}
if [ -z $1 ]
then
echo "Please specify the rpm file path!"
exit 1
fi
RPM_FILE_NAME=`basename $1`
RPM_PKG_NAME=${RPM_FILE_NAME%%-*}
echo "rpm file name : $RPM_FILE_NAME"
echo "pakcage name: ${RPM_PKG_NAME}"
getInstallType
echo "********* Start to uninstall existing package: ${RPM_PKG_NAME} ********"
rpm -e ${RPM_PKG_NAME}
echo "*********Start to install new package: ${RPM_PKG_NAME} *********"
rpm -ivh --relocate /tmp=$RPM_INSTALL_APPS_DIR_PREFIX --relocate /apps/oprisk/oprstable1=$RPM_INSTALL_APPS_DIR $1