=== modified file 'features.admin.inc'
--- features.admin.inc	2009-12-04 08:44:33 +0000
+++ features.admin.inc	2009-12-04 08:47:21 +0000
@@ -197,7 +197,7 @@
 
     $tar = array();
     foreach ($files as $extension => $file_contents) {
-      if (!in_array($extension, array('module', 'info'))) {
+      if (!in_array($extension, array('module', 'info', 'install'))) {
         $extension .= '.inc';
       }
       $tar["{$module_name}/{$module_name}.$extension"] = $file_contents;

=== modified file 'features.drush.inc'
--- features.drush.inc	2009-12-04 08:44:33 +0000
+++ features.drush.inc	2009-12-04 08:45:19 +0000
@@ -198,7 +198,7 @@
       drush_op('mkdir', $directory);
     }
     foreach ($files as $extension => $file_contents) {
-      if (!in_array($extension, array('module', 'info'))) {
+      if (!in_array($extension, array('module', 'info', 'install'))) {
         $extension .= '.inc';
       }
       drush_op('file_put_contents', "{$directory}/{$module_name}.$extension", $file_contents);

=== modified file 'features.export.inc'
--- features.export.inc	2009-12-04 08:44:33 +0000
+++ features.export.inc	2009-12-04 09:07:32 +0000
@@ -188,6 +188,10 @@
  */
 function features_export_render($export, $module_name, $reset = FALSE) {
   $code = array();
+  $install_hooks = array(
+    'enable' => array(),
+    'disable' => array(),
+  );
 
   // Generate hook code
   $component_hooks = features_export_render_hooks($export, $module_name, $reset);
@@ -213,6 +217,11 @@
     }
 
     foreach ($hooks as $hook_name => $hook_code) {
+      if (isset($install_hooks[$hook_name])) {
+        $new_hook_name = $hook_name .'_'. $component;
+        $install_hooks[$hook_name][] = $new_hook_name;
+        $hook_name = $new_hook_name;
+      }
       if ($file['stub']) {
         if (!isset($code['features'])) {
           $code['features'] = array();
@@ -223,6 +232,16 @@
     }
   }
 
+  // Generate the features install hooks
+  foreach ($install_hooks as $hook_name => $hook_functions) {
+    $hook_code = array();
+    foreach ($hook_functions as $hook_function_name) {
+      $hook_code[] = '  '. $module_name .'_'. $hook_function_name . '();';
+    }
+    $hook_code = implode("\n", $hook_code);
+    $code['features'][$hook_name] = features_export_render_defaults($module_name, $hook_name, $hook_code);
+  }
+
   // Finalize strings to be written to files
   foreach ($code as $filename => $contents) {
     $code[$filename] = "<?php\n\n". implode("\n\n", $contents) ."\n";
@@ -237,11 +256,19 @@
   $existing = features_get_modules($module_name, TRUE);
   if ($existing) {
     $code['module'] = file_get_contents($existing->filename);
+    $code['install'] = file_get_contents(preg_replace('/\.module$/', '.install', $existing->filename));
   }
   // Add a stub module to include the defaults
   else if (!empty($code['features'])) {
     $code['module'] = "<?php\n\ninclude_once('{$module_name}.features.inc');\n";
+
+    // Prepare install file
+    foreach ($install_hooks as $hook_name => $hook_functions) {
+      $code['install'][] = features_export_render_features($module_name, $hook_name, "features.inc");
+    }
+    $code['install'] = implode("\n\n", $code['install']) ."\n";
   }
+
   return $code;
 }
 

