# Post erase script

# if this is the last version of presto-server-rpm being removed (i.e. not on upgrade)
if [ "$1" -eq 0 ]
then
    # Delete /etc/presto/env.sh manually during uninstall.
    # rpm -e wont remove it, because this file is created during preinstall
    rm -f /etc/presto/env.sh
    # Delete the data directory manually during uninstall.
    # rpm -e wont remove it, because this directory may later contain files not
    # deployed by the rpm
    rm -rf /var/lib/presto
    # Remove /etc/presto directory if no other files present
    if [ -z "$(ls -A /etc/presto)" ]
    then
        rm -rf /etc/presto
    fi
fi
