How to automatically install civicrm extensions in drupal+civicrm installation profile? We are building a Drupal distribution / installation profile similar to CiviCRM Starter Kit. This will install Drupal 7 and CiviCRM 4.3 while installing the distribution.

We want to add some CiviCRM Extensions like "Extended Reports for CiviCRM" etc. in our distribution so that whenever user will install the distribution, these CiviCRM Extensions also gets installed by default.

We have added these CiviCRM Extensions in drupal-org.make file like below,

libraries[nz.co.fuzion.extendedreport][download][type] = get
libraries[nz.co.fuzion.extendedreport][download][url] = "https://github.com/eileenmcnaughton/nz.co.fuzion.extendedreport/archive/master.zip"
libraries[nz.co.fuzion.extendedreport][destination] = "extensions"


and these get downloaded/unzipped when we run drupal packaging script (drush make). But we are not sure how to enable them as part of the distribution installation.

We know we can add the Drupal modules in profile.info file like below,

dependencies[] = civicrm


but don't know how and where to add CiviCRM Extensions so that they get installed as part of distribution / installation profile setup.

Please suggest how can we install CiviCRM Extensions automatically as part of installation profile setup.
The current API call requires more than just the key. To enable modules as part of an install profile, you simply need to include this code somewhere in the process when it's possible to initialize CiviCRM...

  if (!civicrm_initialize()) {
    drupal_set_message(t('Failed to initialize CiviCRM'));
    return;
  }

  require_once 'CRM/Extension/Manager.php';

  $params = array(
    'version' =&gt; 3,
    'sequential' =&gt; 1,
    'key' =&gt; 'org.civicrm.volunteer',
  );

  $result = civicrm_api('Extension', 'install', $params);


As long as the Extensions Directory and ResourceURL are set in the civicrm.settings.php, you should be set.  I've been setting the Extensions Directory for Pantheon users, but still need to dynamically configure the ResourceURL https://drupal.org/node/1980088.

Rather than create a "Drupal distribution / installation profile similar to CiviCRM Starter Kit", PLEASE consider building on the CiviCRM Starter Kit by using it as the base distribution and contribute to maintaining it.  Take a look at this patch and how the latest version of OpenAtrium builds on Panopoly.

https://drupal.org/comment/6117722#comment-6117722

http://drupalcode.org/project/openatrium.git/blob/refs/heads/7.x-2.x:/drupal-org-core.make

We really need more developers working to push the patches that are still requires back into CiviCRM to keep this stable.  I hardly have time to figure out the changes with each CiviCRM release.  It has taken several years to get to the point we can install and run CiviCRM from the /profiles directory, package CiviCRM w/ drush make, and rebuild the required libraries.  

The CiviCRM Starter Kit was always designed to remain a base install to build other use case specific distributions on, but I've really been maintaining this on my own so far and would love some help. 

UPDATE:  I went ahead and created https://drupal.org/project/civicrm_extension_enabler since troubleshooting code in this queue is difficult.  That module enables the CiviVolunteer extensions and works a site running https://dashboard.getpantheon.com/products/civicrm_starterkit/spinup once CiviVolunteer is uploaded to sites/all/extensions 

I've started an issue to change the specific extensions hard coded in the .install to be an array of extensions populated by the distribution https://drupal.org/node/2159317