Fix template script

BIG FAT WARNING:
As this script silently failed up to now (on every postgresql 9.1 at least), we now must check if postgis is properly installed on every GIS database created on 9.1. If it has been manually installed by someone, chances is that postgis doesn't work properly (because superuser permissions are needed to create postgis functions).