#!/bin/sh ############################################################################### # The preremove script cleans up any leftover links and files after removal ############################################################################### # Copyright (c) 2022 Veritas Technologies LLC. All rights reserved ############################################################################### INSTALL_PATH="/usr/openv/pdde" LOGDIR="/var/log/puredisk" OSTPLUGINS_PATH="/usr/openv/lib/ost-plugins" PKG_NAME="VRTSpddea" TIMESTAMP=`date +%F_%H:%M` # The rpm package manager on Linux has a limitation where if a postinstall # scriptlet fails, rpm still indicates the package is successfully installed. # To get around this there is a touch file to record postinstall scriptlet # failures. If the previous_rpm_pkg_install_failed touch file exists and # contains this package's name, remove the touch file since we are now removing # the package that had the postinstall failure and created the touch file. # remove_previous_rpm_pkg_install_failed_file () { if [ -f /tmp/previous_rpm_pkg_install_failed ] ; then failed_pkg_name=`sed -n '1p' /tmp/previous_rpm_pkg_install_failed` if [ "${failed_pkg_name}" = "${PKG_NAME}" ] ; then rm -f /tmp/previous_rpm_pkg_install_failed fi fi } #------------------------------------MAIN-------------------------------------------------------- if [ ! -d "${LOGDIR}" ] ; then mkdir -p ${LOGDIR} fi LOGFILE=${LOGDIR}/${TIMESTAMP}-pdde-preremove.log echo | tee -a ${LOGFILE} echo "Starting VRTSpddea preremove script." | tee -a ${LOGFILE} echo| tee -a ${LOGFILE} if [ -f /tmp/PDDE_SKIP_PACKAGE_SCRIPTS ] ; then echo "Skipping..."| tee -a ${LOGFILE} else # Remove group and world writable permissions umask 0022 remove_previous_rpm_pkg_install_failed_file # Determine the platforms os=`uname -s` case "${os}" in Linux*) PLATFORM="RedHat" if [ -f /etc/SuSE-release -o -f /sbin/SuSEconfig ]; then PLATFORM="SuSE" elif [ -f /etc/os-release ] ; then # Both Red Hat 7 and SUSE 12 have an os-release file. grep -i SUSE /etc/os-release > /dev/null 2>&1 if [ $? = 0 ] ; then PLATFORM="SuSE" fi elif [ -f /etc/debian_version ]; then PLATFORM="Debian" fi ;; SunOS) PLATFORM="Solaris" ;; AIX) PLATFORM="AIX" ;; HP-UX) PLATFORM="HPUX" ;; esac fi echo | tee -a ${LOGFILE} echo "VRTSpddea preremove script done!" | tee -a ${LOGFILE} echo | tee -a ${LOGFILE}