Files

24 lines
1.1 KiB
Plaintext

if [ "$action" != "purge" ]; then
exit 0
fi
# If the user is "purging" the package (removing the package and associated
# configuration), remove our custom repository and signing key.
# Determine the path to the apt-config command.
APT_CONFIG="$(command -v apt-config 2> /dev/null)"
# Use apt-config to determine the location of the trusted keys directory, then
# delete our key from it.
eval $("$APT_CONFIG" shell APT_TRUSTED_KEYRING_DIR 'Dir::Etc::trustedparts/d')
rm -f "${APT_TRUSTED_KEYRING_DIR}@@REPO_NAME@@.gpg"
# Use apt-config to determine the location of the source list config directory,
# then delete our entry. We may have written either the legacy `.list` format
# (older installs) or the modern `.sources` (DEB822) format introduced in the
# postinst, so remove both filenames to ensure a clean purge regardless of
# which format was last written. `rm -f` is silent on missing files.
eval $("$APT_CONFIG" shell APT_SOURCE_LIST_DIR 'Dir::Etc::sourceparts/d')
rm -f "${APT_SOURCE_LIST_DIR}@@REPO_NAME@@.list"
rm -f "${APT_SOURCE_LIST_DIR}@@REPO_NAME@@.sources"