archey4/packaging/before_remove

25 lines
550 B
Bash

#!/bin/sh
set -e
# Removes symbolic link created by `after_install`.
if [ -L /usr/bin/archey4 ]; then
rm /usr/bin/archey4
fi
# Removes any byte-code file that may have been generated by Archey.
# Wild-cards are being used to match all supported distribution layouts.
find /usr/lib/python3*/*-packages/archey \
-type d \
-name __pycache__ \
-exec \
rm -r {} +
# Removes the AppArmor definition from kernel.
APP_PROFILE="/etc/apparmor.d/usr.bin.archey4"
if aa-enabled --quiet 2>/dev/null; then
apparmor_parser -R "$APP_PROFILE" || true
fi