HEX
Server: Apache
System: Linux a16-asgard6.hospedagemuolhost.com.br 5.14.0-570.52.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 15 06:39:08 EDT 2025 x86_64
User: maoristu4c3dbd03 (1436)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //proc/self/root/proc/thread-self/root/opt/pdde/pddeuninstall.sh
#!/bin/sh
###########################################################
# This script removes the PDDE server and agent packages
###########################################################
# $Copyright: Copyright (c) 2023 Veritas Technologies LLC. All rights reserved $
#
# The copyright notice above does not evidence any actual or intendent
# publication of such source code.
#
#########################################################################

PDE_FULL_NAME="Veritas NetBackup PureDisk Deduplication Engine"
OS=`uname -s`

# Remove group and world writable permissions
umask 0022

TIMESTAMP=`date +%F_%H:%M`
LOGDIR="/var/log/puredisk"
if [ ! -d "${LOGDIR}" ] ; then
    mkdir -p ${LOGDIR}
fi
LOGFILE=${LOGDIR}/${TIMESTAMP}-pdde-uninstall.log

INSTALL_PATH="/usr/openv/pdde"
OSTPLUGINS_PATH="/usr/openv/lib/ost-plugins"
forceclean=0
noscripts=0
verbose=0
TIMESTAMP=`date +%F_%H:%M`

mkdir -p `dirname ${LOGFILE}`
cd `dirname $0`

helptext () {
    echo "Usage: $0 [-forceclean]"
    echo
    echo " -forceclean       : Clean everything.  Do not save config files for upgrades"
    exit 1
}

################################################################################
# die - Print error message and exit immediately.  Second optional parameter is
#       a custom return code.
################################################################################
die () {
    echo
    if [ "${1}" != "" ]; then
        echo "ERROR: ${1}" | tee -a ${LOGFILE}
        echo
    fi
    echo "!! PDDE-uninstallation aborted ... " | tee -a ${LOGFILE}
    echo "Full PDDE uninstallation log saved to: ${LOGFILE}" | tee -a ${LOGFILE}
    echo
    exit 1
}

################################################################################
# queryPackage - Check if the native package is already installed on the system
################################################################################
queryPackage () {
    package_name=$1
    if [ "X${package_name}" = "X" ] ; then
        echo "ERROR: Missing package name in queryPackage function!" | tee -a ${LOGFILE}
        return 1
    fi

    # Build the command for the right platform
    case "${OS}" in
        Linux*) query_cmd="rpm -q ${package_name}" ;;
        AIX)    query_cmd="lslpp -l ${package_name}" ;;
        SunOS)  query_cmd="pkginfo ${package_name}" ;;
    esac

    # Query for the package!
    echo >> ${LOGFILE}
    echo "Checking for ${package_name} package..." | tee -a ${LOGFILE}
    echo ${query_cmd} >> ${LOGFILE}
    ${query_cmd} >> ${LOGFILE} 2>&1
    if [ $? -eq 0 ] ; then
        echo "   Package ${package_name} found." | tee -a ${LOGFILE}
        return 0
    fi
    return 1
}

################################################################################
# removePackage - Uninstall the native package from the system
################################################################################
removePackage () {
    package_name=$1
    if [ "X${package_name}" = "X" ] ; then
        echo "ERROR: Missing package name in removePackage function!" | tee -a ${LOGFILE}
        return 1
    fi

    # Use existing or create an admin file for removal
    if [ "${OS}" = "SunOS" ] ; then
        if [ -f ${INSTALL_PATH}/pdag/scripts/admin ] ; then
            admin_file=${INSTALL_PATH}/pdag/scripts/admin
        else
            cat > /tmp/pdde_$$_admin << __EOF__
nstance=overwrite
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=nocheck
setuid=nocheck
conflict=nocheck
action=nocheck
basedir=default
__EOF__
        admin_file=/tmp/pdde_$$_admin
        fi
    fi

    # Build the command for the right platform
    case "${OS}" in
        Linux*) rm_cmd="rpm -vv -e --nodeps ${package_name}" ;;
        AIX)    rm_cmd="installp -u ${package_name}" ;;
        SunOS)  rm_cmd="pkgrm -n -a ${admin_file} ${package_name}" ;;
    esac

    # Remove the package!
    echo >> ${LOGFILE}
    echo "Removing ${package_name} package..." | tee -a ${LOGFILE}
    echo ${rm_cmd} >> ${LOGFILE}
    ${rm_cmd} >> ${LOGFILE} 2>&1
    if [ $? -eq 0 ] ; then
        echo "   Package ${package_name} removed." | tee -a ${LOGFILE}
    else
        echo "ERROR: Removal of package ${package_name} was unsuccessful!" | tee -a ${LOGFILE}
        return 1
    fi

    # Clean up created admin file
    if [ "${OS}" = "SunOS" -a -f /tmp/pdde_$$_admin ] ; then
        rm -f /tmp/pdde_$$_admin
    fi

    return 0
}


################################################################################
# main - Time to start uninstalling!
################################################################################
main () {
    if [ -f /etc/debian_version ]; then
        exit 0
    fi

    echo "Uninstalling PDDE..." >> ${LOGFILE}
    echo "   Force clean:      ${forceclean}" >> ${LOGFILE}
    echo "   Install path:     ${INSTALL_PATH}" >> ${LOGFILE}
    echo "   OST-Plugins path: ${OSTPLUGINS_PATH}" >> ${LOGFILE}
    echo "   NoScripts:        ${noscripts}" >> ${LOGFILE}

    if [ -f ${INSTALL_PATH}/pdag/version.txt ] ; then
        OLD_VERSION=`cat ${INSTALL_PATH}/pdag/version.txt`
    fi

    rm -rf /tmp/PDDE_SKIP_PACKAGE_SCRIPTS
    if [ ${noscripts} -eq 1 ] ; then
        echo "Disabling native package scripts" | tee -a ${LOGFILE}
        touch /tmp/PDDE_SKIP_PACKAGE_SCRIPTS
    fi

    queryPackage SYMCpddes
    if [ $? -eq 0 ] ; then
        removePackage SYMCpddes
        if [ $? -ne 0 ] ; then
            rm -rf /tmp/PDDE_SKIP_PACKAGE_SCRIPTS
            die "Failed to remove SYMCpddes!"
        fi
    fi

    queryPackage VRTSpddes
    if [ $? -eq 0 ] ; then
        removePackage VRTSpddes
        if [ $? -ne 0 ] ; then
            rm -rf /tmp/PDDE_SKIP_PACKAGE_SCRIPTS
            die "Failed to remove VRTSpddes!"
        fi
    fi

    queryPackage VRTSpddeu
    if [ $? -eq 0 ] ; then
        removePackage VRTSpddeu
        if [ $? -ne 0 ] ; then
            rm -rf /tmp/PDDE_SKIP_PACKAGE_SCRIPTS
            die "Failed to remove VRTSpddeu!"
        fi
    fi

    queryPackage SYMCpddea
    if [ $? -eq 0 ] ; then
        removePackage SYMCpddea
        if [ $? -ne 0 ] ; then
            rm -rf /tmp/PDDE_SKIP_PACKAGE_SCRIPTS
            die "Failed to remove SYMCpddea!"
        fi
    fi

    queryPackage VRTSpddea
    if [ $? -eq 0 ] ; then
        removePackage VRTSpddea
        if [ $? -ne 0 ] ; then
            rm -rf /tmp/PDDE_SKIP_PACKAGE_SCRIPTS
            die "Failed to remove VRTSpddea!"
        fi
    fi

    rm -rf /tmp/PDDE_SKIP_PACKAGE_SCRIPTS

    if [ ${forceclean} -eq 0 ] ; then
        if [ -f /etc/pdregistry.cfg ]; then
            echo "Moving /etc/pdregistry.cfg to /etc/pdregistry.cfg.${TIMESTAMP}" | tee -a ${LOGFILE}
            mv -f /etc/pdregistry.cfg /etc/pdregistry.cfg.${TIMESTAMP}
        fi
    else
        if [ -f /etc/pdregistry.cfg ]; then
            echo "Removing /etc/pdregistry.cfg" | tee -a ${LOGFILE}
            rm -f /etc/pdregistry.cfg
        fi
        if [ -f ${OSTPLUGINS_PATH}/pd.conf ]; then
            echo "Removing ${OSTPLUGINS_PATH}/pd.conf." | tee -a ${LOGFILE}
            rm -f ${OSTPLUGINS_PATH}/pd.conf
        fi
    fi


    echo "PDDE uninstall finished successfully." | tee -a ${LOGFILE}
    echo "Full PDDE uninstallation log saved to: ${LOGFILE}" | tee -a ${LOGFILE}
    echo
}

while [ $# -gt 0 ]; do
    case ${1} in
        -forceclean) forceclean=1; shift ;;
        -noscripts) noscripts=1; shift ;;
        -verbose) verbose=1; shift ;;

        -basedir) echo "basedir no longer needed. Ignoring..." ; shift ; shift ;;
        -ostdir) echo "ostdir no longer needed. Ignoring..." ; shift ; shift ;;
        *) helptext;
    esac
done

main