#!/sbin/sh
# @(#) postremove.sd - SQL/R A.04.00
# SD postremove script, HP-UX 11.x
# (C) Copyright 2010-2022 Marxmeier Software AG. All rights reserved.
#
# The postremove product script is executed after all
# filesets for that product have been removed.
#

#################################################
#             Startup                           #
#################################################

# source standard SD control script utilities

UTILS=/usr/lbin/sw/control_utils
if [ ! -f $UTILS ]
then
   echo "ERROR:    Cannot find $UTILS"
   exit 1
fi
. $UTILS

# set retval and exitval

exitval=$SUCCESS
set_status()
{
   retval=${1:-$?}
   [[ $retval -eq  $FAILURE ]] && exitval=$retval
}


# Remove empty directories that this fileset owned exclusively.

SQLR=/opt/sqlr/4.0

if [ -d ${SQLR} ]; then
   find ${SQLR} -type d -depth|xargs rmdir -f 2>/dev/null
fi

if [ -d /var/${SQLR} ]; then
   find /var/${SQLR} -type d -depth|xargs rmdir -f 2>/dev/null
fi

if [ -d /etc/${SQLR} ]; then
   find /etc/${SQLR} -type d -depth|xargs rmdir -f 2>/dev/null
fi

exit $exitval
