Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/dell/srvadmin/sbin
File: srvadmin-uninstall.sh
#!/bin/sh
[0] Fix | Delete
###############################################################################
[1] Fix | Delete
#
[2] Fix | Delete
# Dell Inc. PROPRIETARY INFORMATION
[3] Fix | Delete
# This software is supplied under the terms of a license agreement or
[4] Fix | Delete
# nondisclosure agreement with Dell Inc. and may not
[5] Fix | Delete
# be copied or disclosed except in accordance with the terms of that
[6] Fix | Delete
# agreement.
[7] Fix | Delete
#
[8] Fix | Delete
# Copyright (c) 2000-2009 Dell Inc. All Rights Reserved.
[9] Fix | Delete
#
[10] Fix | Delete
# This script uninstalls all the installed Systems Management
[11] Fix | Delete
# rpm packages from the system
[12] Fix | Delete
#
[13] Fix | Delete
###############################################################################
[14] Fix | Delete
[15] Fix | Delete
# global variables
[16] Fix | Delete
DELL_OPENMANAGE_PREFIX="srvadmin"
[17] Fix | Delete
WSMAN_PKGS=""
[18] Fix | Delete
DEFAULT_PREFIX="/opt/dell/srvadmin"
[19] Fix | Delete
BACKUP_LOCATION_PREFIX="/opt/dell/backup/openmanage"
[20] Fix | Delete
[21] Fix | Delete
##function to export OMSA configuration.
[22] Fix | Delete
function ExportOMSAPref
[23] Fix | Delete
{
[24] Fix | Delete
if [ -d $BACKUP_LOCATION_PREFIX ]; then
[25] Fix | Delete
rm -rf $BACKUP_LOCATION_PREFIX
[26] Fix | Delete
fi
[27] Fix | Delete
mkdir -p $BACKUP_LOCATION_PREFIX
[28] Fix | Delete
mkdir -p $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF
[29] Fix | Delete
mkdir -p $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/lib
[30] Fix | Delete
mkdir -p $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/conf
[31] Fix | Delete
mkdir -p $BACKUP_LOCATION_PREFIX/etc/openmanage/oma/ini
[32] Fix | Delete
mkdir -p $BACKUP_LOCATION_PREFIX/etc/srvadmin-isvc/ini
[33] Fix | Delete
mkdir -p $BACKUP_LOCATION_PREFIX/etc/openmanage/wwwroot/oem/data/ini/dell
[34] Fix | Delete
mkdir -p $BACKUP_LOCATION_PREFIX/share/applications
[35] Fix | Delete
[36] Fix | Delete
if [ -e $DEFAULT_PREFIX/etc/openmanage/oma/ini/omprv.ini ]; then
[37] Fix | Delete
key_signing_algorithm_value=`sed -n '/key_signing_algorithm=/p' $DEFAULT_PREFIX/etc/openmanage/oma/ini/omprv.ini`
[38] Fix | Delete
echo $key_signing_algorithm_value > $BACKUP_LOCATION_PREFIX/key_signing_algorithm.bak
[39] Fix | Delete
dws_value=`sed -n '/enableDWS=/p' $DEFAULT_PREFIX/etc/openmanage/oma/ini/omprv.ini`
[40] Fix | Delete
echo $dws_value > $BACKUP_LOCATION_PREFIX/dws_value.bak
[41] Fix | Delete
fi
[42] Fix | Delete
if [ -e $DEFAULT_PREFIX/share/applications/srvadmin.desktop ]; then
[43] Fix | Delete
cp -pf $DEFAULT_PREFIX/share/applications/srvadmin.desktop $BACKUP_LOCATION_PREFIX/share/applications/
[44] Fix | Delete
fi
[45] Fix | Delete
if [ -e $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/webapps/omsa/WEB-INF/web.xml ]; then
[46] Fix | Delete
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/
[47] Fix | Delete
echo "web.xml settings has been exported successfully" > $DEFAULT_PREFIX/var/log/openmanage/backup.log
[48] Fix | Delete
fi
[49] Fix | Delete
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
[50] Fix | Delete
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
[51] Fix | Delete
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
[52] Fix | Delete
fi
[53] Fix | Delete
if [ -e $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/conf/server.xml ]; then
[54] Fix | Delete
cp -pf $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/conf/server.xml $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/conf/
[55] Fix | Delete
echo "server.xml settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
[56] Fix | Delete
fi
[57] Fix | Delete
if [ -e $DEFAULT_PREFIX/etc/openmanage/oma/ini/oma.properties ]; then
[58] Fix | Delete
cp -pf $DEFAULT_PREFIX/etc/openmanage/oma/ini/oma.properties $BACKUP_LOCATION_PREFIX/etc/openmanage/oma/ini/
[59] Fix | Delete
echo "oma.properties settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
[60] Fix | Delete
fi
[61] Fix | Delete
if [ -e $DEFAULT_PREFIX/etc/srvadmin-isvc/ini/dcisdy64.ini ]; then
[62] Fix | Delete
cp -pf $DEFAULT_PREFIX/etc/srvadmin-isvc/ini/dcisdy64.ini $BACKUP_LOCATION_PREFIX/etc/srvadmin-isvc/ini/
[63] Fix | Delete
echo "dcisdy64.ini settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
[64] Fix | Delete
fi
[65] Fix | Delete
if [ -e $DEFAULT_PREFIX/etc/openmanage/wwwroot/oem/data/ini/dell/omsaoem.ini ]; then
[66] Fix | Delete
cp -pf $DEFAULT_PREFIX/etc/openmanage/wwwroot/oem/data/ini/dell/omsaoem.ini $BACKUP_LOCATION_PREFIX/etc/openmanage/wwwroot/oem/data/ini/dell/
[67] Fix | Delete
echo "omsaoem settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
[68] Fix | Delete
fi
[69] Fix | Delete
if [ -e $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/conf/keystore.db ]; then
[70] Fix | Delete
cp -pf $DEFAULT_PREFIX/lib64/openmanage/apache-tomcat/conf/keystore.db $BACKUP_LOCATION_PREFIX/lib64/openmanage/apache-tomcat/conf/
[71] Fix | Delete
echo "keystore settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
[72] Fix | Delete
fi
[73] Fix | Delete
if [ -e $DEFAULT_PREFIX/etc/openmanage/oma/ini/produsefeedback.ini ]; then
[74] Fix | Delete
cp -pf $DEFAULT_PREFIX/etc/openmanage/oma/ini/produsefeedback.ini $BACKUP_LOCATION_PREFIX/etc/openmanage/oma/ini/
[75] Fix | Delete
echo "produsefeedback.ini settings has been exported successfully" >> $DEFAULT_PREFIX/var/log/openmanage/backup.log
[76] Fix | Delete
fi
[77] Fix | Delete
}
[78] Fix | Delete
function Usage
[79] Fix | Delete
{
[80] Fix | Delete
echo "Usage: ${0} [OPTION]"
[81] Fix | Delete
echo "Server Administrator Custom Uninstall Utility."
[82] Fix | Delete
echo "This Utility will run in the interactive mode if no option"
[83] Fix | Delete
echo "is given and runs silently if a valid option is given."
[84] Fix | Delete
echo " "
[85] Fix | Delete
echo "Option: "
[86] Fix | Delete
echo " [-f, --force] do not prompt before uninstall"
[87] Fix | Delete
echo " [-h, --help] Displays this help text."
[88] Fix | Delete
echo " "
[89] Fix | Delete
exit 1
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
###############################################################################
[93] Fix | Delete
#
[94] Fix | Delete
# Script execution begins here with the invocation
[95] Fix | Delete
# of Main function
[96] Fix | Delete
#
[97] Fix | Delete
###############################################################################
[98] Fix | Delete
# check for root privileges
[99] Fix | Delete
if [ ${UID} != 0 ]; then
[100] Fix | Delete
echo "Uninstall requires root privileges"
[101] Fix | Delete
exit 1
[102] Fix | Delete
fi
[103] Fix | Delete
[104] Fix | Delete
INTERACTIVE=1
[105] Fix | Delete
if [ $# -gt 0 ]; then
[106] Fix | Delete
if [ "${1}" == "-f" -o "${1}" == "--force" ]; then
[107] Fix | Delete
INTERACTIVE=0
[108] Fix | Delete
elif [ "${1}" == "-h" -o "${1}" == "--help" ]; then
[109] Fix | Delete
Usage
[110] Fix | Delete
else
[111] Fix | Delete
echo "Invalid option '${1}', please see the usage below"
[112] Fix | Delete
echo " "
[113] Fix | Delete
Usage
[114] Fix | Delete
fi
[115] Fix | Delete
fi
[116] Fix | Delete
[117] Fix | Delete
if [ -x /usr/bin/vmware ]; then
[118] Fix | Delete
/usr/bin/vmware -v | grep "VMware ESX 4.0.*" >/dev/null 2>&1
[119] Fix | Delete
if [ $? == 0 ]; then
[120] Fix | Delete
WSMAN_PKGS=`rpm -qa | grep wsman`
[121] Fix | Delete
else
[122] Fix | Delete
/usr/bin/vmware -v | grep "VMware ESX 4.1.*" >/dev/null 2>&1
[123] Fix | Delete
if [ $? == 0 ]; then
[124] Fix | Delete
WSMAN_PKGS=`rpm -qa | grep wsman`
[125] Fix | Delete
fi
[126] Fix | Delete
fi
[127] Fix | Delete
fi
[128] Fix | Delete
[129] Fix | Delete
# check for forced uninstall
[130] Fix | Delete
if [ ${INTERACTIVE} == 1 ];
[131] Fix | Delete
then
[132] Fix | Delete
echo "Uninstall will remove the following RPMs:"
[133] Fix | Delete
rpm -qa | egrep "^$DELL_OPENMANAGE_PREFIX|^instsvc"
[134] Fix | Delete
[ -n "$WSMAN_PKGS" ] && echo "$WSMAN_PKGS"
[135] Fix | Delete
echo "Are you sure you want to uninstall?"
[136] Fix | Delete
read -p " Press ('y' for yes | 'Enter' to exit): " RESP
[137] Fix | Delete
if ! echo "${RESP}" | grep -iq "^\s*y\s*$" ; then
[138] Fix | Delete
echo "Aborting uninstall on user input."
[139] Fix | Delete
exit 1
[140] Fix | Delete
fi
[141] Fix | Delete
fi
[142] Fix | Delete
[143] Fix | Delete
##export OMSA configuration.
[144] Fix | Delete
ExportOMSAPref
[145] Fix | Delete
[146] Fix | Delete
# remove srvadmin-omilcore last, as other rpms use scripts from it
[147] Fix | Delete
# not required on newer RPM versions, as Requires(postun) takes care of this. RHEL4
[148] Fix | Delete
# is the only RPM version that needs it.
[149] Fix | Delete
OM_RPMS=$(rpm -qa | egrep "^$DELL_OPENMANAGE_PREFIX|^instsvc")
[150] Fix | Delete
if [ -n "$OM_RPMS" ]; then
[151] Fix | Delete
[ -x /opt/dell/srvadmin/sbin/srvadmin-services.sh ] &&
[152] Fix | Delete
/opt/dell/srvadmin/sbin/srvadmin-services.sh stop
[153] Fix | Delete
# exclude omilcore and hapi here; they are uninstalled later.
[154] Fix | Delete
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 )
[155] Fix | Delete
if [ -n "$OM_RPMS" ]; then
[156] Fix | Delete
rpm -e $OM_RPMS
[157] Fix | Delete
if [ $? -ne 0 ]; then
[158] Fix | Delete
rpm -e --allmatches --noscripts $OM_RPMS
[159] Fix | Delete
fi
[160] Fix | Delete
fi
[161] Fix | Delete
[162] Fix | Delete
OM_RPMS=$(rpm -qa | grep 'srvadmin-omaksmig')
[163] Fix | Delete
if [ -n "$OM_RPMS" ]; then
[164] Fix | Delete
rpm -e srvadmin-omaksmig >/dev/null 2>&1
[165] Fix | Delete
if [ $? -ne 0 ]; then
[166] Fix | Delete
rpm -e --allmatches --noscripts srvadmin-omaksmig >/dev/null 2>&1
[167] Fix | Delete
fi
[168] Fix | Delete
fi
[169] Fix | Delete
[170] Fix | Delete
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
[171] Fix | Delete
do
[172] Fix | Delete
OM_RPMS=$(rpm -qa | grep $PKG_NAME)
[173] Fix | Delete
if [ -n "$OM_RPMS" ]; then
[174] Fix | Delete
rpm -e $OM_RPMS
[175] Fix | Delete
if [ $? -ne 0 ]; then
[176] Fix | Delete
rpm -e --allmatches --noscripts $OM_RPMS
[177] Fix | Delete
fi
[178] Fix | Delete
fi
[179] Fix | Delete
done
[180] Fix | Delete
fi
[181] Fix | Delete
[182] Fix | Delete
CLEANED_WSMAN_LIST=""
[183] Fix | Delete
for WSMAN_PKG in $WSMAN_PKGS
[184] Fix | Delete
do
[185] Fix | Delete
FILE_LIST=$(rpm -ql $WSMAN_PKG)
[186] Fix | Delete
echo $FILE_LIST | grep "opt/dell/srvadmin" >/dev/null 2>&1
[187] Fix | Delete
[188] Fix | Delete
if [ $? == 0 ]
[189] Fix | Delete
then
[190] Fix | Delete
CLEANED_WSMAN_LIST="${CLEANED_WSMAN_LIST} ${WSMAN_PKG}"
[191] Fix | Delete
fi
[192] Fix | Delete
done
[193] Fix | Delete
[194] Fix | Delete
WSMAN_PKGS=$CLEANED_WSMAN_LIST
[195] Fix | Delete
[196] Fix | Delete
if [ -n "$WSMAN_PKGS" ]; then
[197] Fix | Delete
rpm -e $WSMAN_PKGS --test >/dev/null 2>&1
[198] Fix | Delete
if [ $? == 0 ] ; then
[199] Fix | Delete
rpm -e $WSMAN_PKGS
[200] Fix | Delete
fi
[201] Fix | Delete
fi
[202] Fix | Delete
[203] Fix | Delete
OM_RPMS=$(rpm -qa | egrep "^$DELL_OPENMANAGE_PREFIX")
[204] Fix | Delete
if [ -z "$OM_RPMS" ]; then
[205] Fix | Delete
rm -f /etc/omreg.cfg
[206] Fix | Delete
rm -f /etc/delloma.d
[207] Fix | Delete
rm -f /etc/init.d/dsm_sa_ipmi >/dev/null 2>&1
[208] Fix | Delete
find /opt/dell/srvadmin -type d -depth -exec rmdir {} \; >/dev/null 2>&1 ||:
[209] Fix | Delete
fi
[210] Fix | Delete
#delete the install log file
[211] Fix | Delete
rm -f /opt/dell/srvadmin/var/log/omsa_install_ver_*.log
[212] Fix | Delete
[213] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function