+# always do this; it's idempotent
+# hopefully it will help in various upgrade scenarios where
+# drupal was re-installed, and settings.php was left in the original drupal state
+# which results in the infamous "cannot connect to mysql database"
+sed -e 's|^[ \t]*\$db_url.*|require_once("plc_config.php");$db_url="pgsql://" . PLC_DB_USER . ":" . PLC_DB_PASSWORD . "@" . PLC_DB_HOST . ":" . PLC_DB_PORT . "/drupal";|' \
+ settings.php.drupal > settings.php