#!/bin/sh
# prerm script for d7031-archive-keyring.gpg
#
# see: dh_installdeb(1)

set -e

# keyrings
KEYRING_ADD=/usr/share/keyrings/d7031-archive-keyring.gpg

# if the package is removed, also try to remove the keys from the apt keyring
if [ "$1" = remove ]; then
	if [ -x "`which apt-key 2>/dev/null`" ]; then
		keys=`gpg --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring $KEYRING_ADD --with-colons --list-keys | grep ^pub | cut -d: -f5`
		for key in $keys; do
			apt-key del ${key} > /dev/null || true
		done
	fi
fi

#DEBHELPER#

exit 0
