Skip to content

Commit

Permalink
Fix features options setting WslApplyFeatures.php
Browse files Browse the repository at this point in the history
Because the features options are set in the evnirronement variables in https://github.com/laravel/homestead/blob/98a798b18a078121252f0ecfe3e10cba050ce504/scripts/homestead.rb#L308-L311

it must be the same in the WSL code
  • Loading branch information
sdespont authored Jul 20, 2024
1 parent 36bd28d commit f21aebb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/WslApplyFeatures.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,17 @@ public function execute(InputInterface $input, OutputInterface $output)
$feature_cmd = '';
$feature_name = array_key_first($feature);
$feature_variables = $feature[$feature_name];
$output->writeln(PHP_EOL.($feature[$feature_name] ? '' : 'Not ').'Configuring feature: '.$feature_name);
if ($feature_variables !== false) {
$feature_path = "{$this->featuresPath}/{$feature_name}.sh | tee ~/.homestead-features/{$feature_name}.log";
$output->writeln(PHP_EOL.($feature[$feature_name] ? '' : 'Not ').'Configuring feature: '.$feature_name);
if ($feature_variables !== false) {
// Prepare the feature variables if provided.
if (is_array($feature_variables)) {
$variables = join(' ', $feature_variables);
$feature_cmd = "sudo -E bash {$feature_path} {$variables}";
} else {
$feature_cmd = "sudo -E bash {$feature_path}";
}
if (is_array($feature_variables)) {
foreach ($feature_variables as $var_name => $var_value) {
$output->writeln("Set option ".$var_name." = ".$var_value);
putenv("$var_name=$var_value");
}
}
$feature_path = "{$this->featuresPath}/{$feature_name}.sh | tee ~/.homestead-features/{$feature_name}.log";
$feature_cmd = "sudo -E bash {$feature_path}";
shell_exec($feature_cmd);
$output->writeln("Feature installation log can be found via: sudo cat ~/.homestead-features/{$feature_name}.log");
}
Expand Down

0 comments on commit f21aebb

Please sign in to comment.