Drush site-install and extra settings for the settings file?
Checkout the post about Collecting and writing configuration settings to setting.php from an install profile.

It describes how a custom task was injected into the installation profile and then details how drupal_rewrite_settings() was used to inject the custom settings into settings.php.