| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# post-removal script for AIDE |
| 4 |
# A whole lot of this is "borrowed" from tripwire's postinst |
| 5 |
# |
| 6 |
|
| 7 |
set -e |
| 8 |
|
| 9 |
if [ -n "$AIDEDEBUG" ]; then |
| 10 |
printf "now debugging %s %s\n" "$0" "$@" |
| 11 |
set -x |
| 12 |
fi |
| 13 |
|
| 14 |
PKGNAME="aide" |
| 15 |
|
| 16 |
# Make sure we should be running... |
| 17 |
[ "$1" = "purge" ] || exit 0 |
| 18 |
|
| 19 |
UCF="ucf" |
| 20 |
UCFR="ucfr" |
| 21 |
|
| 22 |
if command -v ucfq >/dev/null; then |
| 23 |
for file in $(ucfq --with-colons "$PKGNAME" | cut --delimiter=: --fields=1); do |
| 24 |
for ext in '' '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist .ucf-new .ucf-old .ucf-dist; do |
| 25 |
rm -f "${file}${ext}" |
| 26 |
done |
| 27 |
|
| 28 |
if command -v $UCF >/dev/null; then |
| 29 |
$UCF --purge "${file}" |
| 30 |
fi |
| 31 |
if command -v $UCFR >/dev/null; then |
| 32 |
$UCFR --purge "${PKGNAME}" "${file}" |
| 33 |
fi |
| 34 |
done |
| 35 |
else |
| 36 |
printf >&2 "ucf no longer installed, not cleaning up\n" |
| 37 |
fi |
| 38 |
|
| 39 |
if [ -d "/run/aide" ]; then |
| 40 |
rmdir --ignore-fail-on-non-empty "/run/aide" |
| 41 |
fi |
| 42 |
|
| 43 |
#DEBHELPER# |