Rework of debian install scripts

This should fix the issues that we've seen with an upgrade of nipapd
leading to a wipe of the configuration. The issue was that the
installation scripts (config & postinst) determined whether it was an
upgrade or fresh installation based on if we could find the 'nipap'
database in PostgreSQL. Along with NIPAP v0.25 a new patch release of
PostgreSQL was released and when debian is upgrading both nipap and
postgresql at the same time it will stop postgresql to perform the
upgrades. Since we relied on postgresql running to determine whether it
was an upgrade or fresh install we would take the wrong decision and
presume it was a fresh install which includes writing a new
configuration with a randomized password and so forth. Chaos ensued.

With this modification we check that Postgres is running before
proceeding which should fix the issue.

Some of the logic has been moved around between the config and postinst
script. In essence, all logic should be kept in the config file while
the actual installation actions are performed in postinst. It's hard to
do this in reality but this is a step in the right direction. Now all
error messages are printed to stderr from postinst instead of using
db_input to display messages which is also the right thing to do.

Fixes #496.
Merge pull request #550 from plajjan/496-fix-debian-install

Rework of debian install scripts