Grafana 13.1.1 Debian upgrade broken due to bug in postinst script (and how to fix it)

The Grafana 13.1.1 Debian package contains an error in the post-installation script. Here is how to fix it and finish the apt upgrade process.