###############################################################################
# Dell Inc. PROPRIETARY INFORMATION
# This software is supplied under the terms of a license agreement or
# nondisclosure agreement with Dell Inc. and may not
# be copied or disclosed except in accordance with the terms of that
# Copyright (c) 2000-2009 Dell Inc. All Rights Reserved.
# This script uninstalls all the installed Systems Management
# rpm packages from the system
###############################################################################
DELL_OPENMANAGE_PREFIX="srvadmin"
DEFAULT_PREFIX="/opt/dell/srvadmin"
BACKUP_LOCATION_PREFIX="/opt/dell/backup/openmanage"
##function to export OMSA configuration.
if [ -d $BACKUP_LOCATION_PREFIX ]; then
rm -rf $BACKUP_LOCATION_PREFIX
mkdir -p $BACKUP_LOCATION_PREFIX
mkdir -p $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF
mkdir -p $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/lib
mkdir -p $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/conf
mkdir -p $BACKUP_LOCATION_PREFIX/etc/openmanage/oma/ini
mkdir -p $BACKUP_LOCATION_PREFIX/etc/srvadmin-isvc/ini
mkdir -p $BACKUP_LOCATION_PREFIX/etc/openmanage/wwwroot/oem/data/ini/dell
mkdir -p $BACKUP_LOCATION_PREFIX/share/applications
if [ -e $DEFAULT_PREFIX/etc/openmanage/oma/ini/omprv.ini ]; then
key_signing_algorithm_value=`sed -n '/key_signing_algorithm=/p' $DEFAULT_PREFIX/etc/openmanage/oma/ini/omprv.ini`
echo $key_signing_algorithm_value > $BACKUP_LOCATION_PREFIX/key_signing_algorithm.bak
dws_value=`sed -n '/enableDWS=/p' $DEFAULT_PREFIX/etc/openmanage/oma/ini/omprv.ini`
echo $dws_value > $BACKUP_LOCATION_PREFIX/dws_value.bak
if [ -e $DEFAULT_PREFIX/share/applications/srvadmin.desktop ]; then
cp -pf $DEFAULT_PREFIX/share/applications/srvadmin.desktop $BACKUP_LOCATION_PREFIX/share/applications/
if [ -e $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/web.xml ]; then
cp -pf $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/web.xml $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/
echo "web.xml settings has been exported successfully" > $DEFAULT_PREFIX/var/log/openmanage/backup.log
if [ -e $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/lib/OMSA.jar ] && [ -e $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/lib/OMPREF.jar ]; then
cp -pf $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/lib/OMSA.jar $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/lib/OMSA.jar.bak
cp -pf $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/lib/OMPREF.jar $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/lib/OMPREF.jar.bak
if [ -e $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/conf/server.xml ]; then
cp -pf $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/conf/server.xml $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/conf/
echo "server.xml settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
if [ -e $DEFAULT_PREFIX/etc/openmanage/oma/ini/oma.properties ]; then
cp -pf $DEFAULT_PREFIX/etc/openmanage/oma/ini/oma.properties $BACKUP_LOCATION_PREFIX/etc/openmanage/oma/ini/
echo "oma.properties settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
if [ -e $DEFAULT_PREFIX/etc/srvadmin-isvc/ini/dcisdy64.ini ]; then
cp -pf $DEFAULT_PREFIX/etc/srvadmin-isvc/ini/dcisdy64.ini $BACKUP_LOCATION_PREFIX/etc/srvadmin-isvc/ini/
echo "dcisdy64.ini settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
if [ -e $DEFAULT_PREFIX/etc/openmanage/wwwroot/oem/data/ini/dell/omsaoem.ini ]; then
cp -pf $DEFAULT_PREFIX/etc/openmanage/wwwroot/oem/data/ini/dell/omsaoem.ini $BACKUP_LOCATION_PREFIX/etc/openmanage/wwwroot/oem/data/ini/dell/
echo "omsaoem settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
if [ -e $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/conf/keystore.db ]; then
cp -pf $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/conf/keystore.db $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/conf/
echo "keystore settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
if [ -e $DEFAULT_PREFIX/etc/openmanage/oma/ini/produsefeedback.ini ]; then
cp -pf $DEFAULT_PREFIX/etc/openmanage/oma/ini/produsefeedback.ini $BACKUP_LOCATION_PREFIX/etc/openmanage/oma/ini/
echo "produsefeedback.ini settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
echo "Usage: ${0} [OPTION]"
echo "Server Administrator Custom Uninstall Utility."
echo "This Utility will run in the interactive mode if no option"
echo "is given and runs silently if a valid option is given."
echo " [-f, --force] do not prompt before uninstall"
echo " [-h, --help] Displays this help text."
###############################################################################
# Script execution begins here with the invocation
###############################################################################
# check for root privileges
echo "Uninstall requires root privileges"
if [ "${1}" == "-f" -o "${1}" == "--force" ]; then
elif [ "${1}" == "-h" -o "${1}" == "--help" ]; then
echo "Invalid option '${1}', please see the usage below"
if [ -x /usr/bin/vmware ]; then
/usr/bin/vmware -v | grep "VMware ESX 4.0.*" >/dev/null 2>&1
WSMAN_PKGS=`rpm -qa | grep wsman`
/usr/bin/vmware -v | grep "VMware ESX 4.1.*" >/dev/null 2>&1
WSMAN_PKGS=`rpm -qa | grep wsman`
# check for forced uninstall
if [ ${INTERACTIVE} == 1 ];
echo "Uninstall will remove the following RPMs:"
rpm -qa | egrep "^$DELL_OPENMANAGE_PREFIX|^instsvc"
[ -n "$WSMAN_PKGS" ] && echo "$WSMAN_PKGS"
echo "Are you sure you want to uninstall?"
read -p " Press ('y' for yes | 'Enter' to exit): " RESP
if ! echo "${RESP}" | grep -iq "^\s*y\s*$" ; then
echo "Aborting uninstall on user input."
##export OMSA configuration.
# remove srvadmin-omilcore last, as other rpms use scripts from it
# not required on newer RPM versions, as Requires(postun) takes care of this. RHEL4
# is the only RPM version that needs it.
OM_RPMS=$(rpm -qa | egrep "^$DELL_OPENMANAGE_PREFIX|^instsvc")
if [ -n "$OM_RPMS" ]; then
[ -x /opt/dell/srvadmin/sbin/srvadmin-services.sh ] &&
/opt/dell/srvadmin/sbin/srvadmin-services.sh stop
# exclude omilcore and hapi here; they are uninstalled later.
OM_RPMS=$(rpm -qa | egrep "^$DELL_OPENMANAGE_PREFIX|^instsvc" | grep -v omilcore | grep -v hapi | grep -v srvadmin-storelib-libpci | grep -v srvadmin-storelib-sysfs | grep -v srvadmin-sysfsutils | grep -v srvadmin-racadm4 | grep -v srvadmin-racsvc | grep -v srvadmin-omcommon | grep -v srvadmin-omacs | grep -v srvadmin-omaksmig | grep -v srvadmin-marvellib )
if [ -n "$OM_RPMS" ]; then
rpm -e --allmatches --noscripts $OM_RPMS
OM_RPMS=$(rpm -qa | grep 'srvadmin-omaksmig')
if [ -n "$OM_RPMS" ]; then
rpm -e srvadmin-omaksmig >/dev/null 2>&1
rpm -e --allmatches --noscripts srvadmin-omaksmig >/dev/null 2>&1
for PKG_NAME in srvadmin-omcommon srvadmin-omacs srvadmin-storelib-libpci srvadmin-storelib-sysfs srvadmin-hapi srvadmin-sysfsutils srvadmin-racsvc srvadmin-racadm4 srvadmin-omilcore srvadmin-marvellib
OM_RPMS=$(rpm -qa | grep $PKG_NAME)
if [ -n "$OM_RPMS" ]; then
rpm -e --allmatches --noscripts $OM_RPMS
for WSMAN_PKG in $WSMAN_PKGS
FILE_LIST=$(rpm -ql $WSMAN_PKG)
echo $FILE_LIST | grep "opt/dell/srvadmin" >/dev/null 2>&1
CLEANED_WSMAN_LIST="${CLEANED_WSMAN_LIST} ${WSMAN_PKG}"
WSMAN_PKGS=$CLEANED_WSMAN_LIST
if [ -n "$WSMAN_PKGS" ]; then
rpm -e $WSMAN_PKGS --test >/dev/null 2>&1
OM_RPMS=$(rpm -qa | egrep "^$DELL_OPENMANAGE_PREFIX")
if [ -z "$OM_RPMS" ]; then
rm -f /etc/init.d/dsm_sa_ipmi >/dev/null 2>&1
find /opt/dell/srvadmin -type d -depth -exec rmdir {} \; >/dev/null 2>&1 ||:
#delete the install log file
rm -f /opt/dell/srvadmin/var/log/omsa_install_ver_*.log