#!/bin/sh

set -e

# summary of how this script can be called:
#        * <prerm> `remove'
#        * <prerm> `purge'
#        * <old-prerm> `upgrade' <new-version>
#        * <new-prerm> `failed-upgrade' <old-version>
#        * <new-prerm> `abort-install'
#        * <new-prerm> `abort-install' <old-version>
#        * <new-prerm> `abort-upgrade' <old-version>
#        * <disappearer's-prerm> `disappear' <overwriter>
#          <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
    purge)
        rm -rf /dev/shm/sr_*
        rm -rf /dev/shm/srsub_*
        rm -rf /etc/sysrepo/
	if [ -x "$(command -v delgroup)" ]; then
	    delgroup --quiet --system sysrepo > /dev/null || true
	else
	    echo >&2 "not removing sysrepo system group because delgroup command was not found"
	fi
    ;;
    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
    ;;

    *)
        echo "prerm called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
