#!/bin/sh
# Runs after the package is removed.
#
# Nothing to clean here, and that is worth stating explicitly:
#
#   - The firewall rules were removed by preuninst, while the binary that
#     owns them still existed. By now target/ is gone.
#   - The database and config were copied out by preuninst too. DSM deletes
#     the entire package directory, var/ included — this script used to
#     claim the data was "kept at /var/packages/SvrGuard/var", which was
#     simply untrue and cost a NAS its block history and hub enrolment key
#     before anyone checked.
#
# Both jobs have to happen in preuninst because everything this script
# might want to act on has already been deleted by the time it runs.

for VOL in /volume1 /volume2 /volume3; do
    if [ -d "${VOL}/SvrGuard-backup" ]; then
        echo "SvrGuard: previous configuration and database are at ${VOL}/SvrGuard-backup"
        break
    fi
done
exit 0
