if [ "$1" = "remove" ]; then
    if [ -x "/usr/bin/svctl" ]; then
        # recompile since files are removed
        svctl compile || true
        if ! svctl update; then
            echo "dh-s6: WARNING 'svctl update' failed. The message above names" >&2
            echo "dh-s6: WARNING the services that did not reach the wanted state." >&2
            echo "dh-s6: WARNING The removal continues anyway: a hanging service must not" >&2
            echo "dh-s6: WARNING leave dpkg holding its lock and block every further" >&2
            echo "dh-s6: WARNING package operation (rt-2.tick1, 22.09.2026). The s6" >&2
            echo "dh-s6: WARNING database is NOT up to date then:" >&2
            echo "dh-s6: WARNING fix the cause and run 'svctl update' again." >&2
        fi
    fi
fi
if [ "$1" = "remove" ] || [ "$1" = "purge" ] || [ "$1" = "abort-install" ]; then
    for unit in #UNITFILES#; do
        rm -f "/var/lib/dh-s6/enabled/$unit"
    done
fi
