debian/purge.sh: move all operations inside the main loop