Skip to content

Commit

Permalink
Merge d629b2a into 9f0c353
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Feb 17, 2019
2 parents 9f0c353 + d629b2a commit 37f37b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/CosyComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ protected function handleTimeIntervalSetting($composer_json)
*/
public function run()
{
// Always start by making sure the .ssh directory exists.
$directory = sprintf('%s/.ssh', getenv('HOME'));
@mkdir($directory, 0700);
if (!empty($_SERVER['violinist_hostname'])) {
$this->log(sprintf('Running update check on %s', $_SERVER['violinist_hostname']));
}
Expand All @@ -484,6 +487,15 @@ public function run()
$url = null;
// Make sure we accept the fingerprint of whatever we are cloning.
$this->execCommand(sprintf('ssh-keyscan -t rsa,dsa %s >> ~/.ssh/known_hosts', $hostname));
if (!empty($_SERVER['private_key'])) {
$this->log('Checking for existing private key');
$filename = "$directory/id_rsa";
if (!file_exists($filename)) {
$this->log('Installing private key');
file_put_contents($filename, $_SERVER['private_key']);
$this->execCommand(sprintf('chmod 600 %s', $filename), false);
}
}
switch ($hostname) {
case 'github.com':
$this->execCommand(
Expand Down

0 comments on commit 37f37b7

Please sign in to comment.