Skip to content

Instantly share code, notes, and snippets.

@HillReywer
Created May 13, 2019 08:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HillReywer/d6d10ff8bbec55b3dc0bf4a32d8ef74e to your computer and use it in GitHub Desktop.
Save HillReywer/d6d10ff8bbec55b3dc0bf4a32d8ef74e to your computer and use it in GitHub Desktop.
Install Deployer php
<?php
$version = '6.4.3';
echo "Downloading Deployer manifest file...\n";
$manifest = json_decode(file_get_contents('https://deployer.org/manifest.json'), true);
$sha1 = $url = null;
foreach ($manifest as $manifestEntry)
{
if ($manifestEntry['version'] == $version)
{
$sha1 = $manifestEntry['sha1'];
$url = $manifestEntry['url'];
break;
}
}
if (null == $sha1)
{
throw new Exception("Deployer version `$version` not found in manifest.");
}
echo "Downloading Deployer version $version...\n";
file_put_contents("/bin/dep", fopen($url, 'r'));
echo "Checking downloaded file...\n";
if (sha1_file("/bin/dep") != $sha1)
{
throw new Exception("Deployer download seems to be corrupt.");
}
echo "Making Deployer writeable...\n";
exec('chmod +x /bin/dep');
echo "Deployer installed.\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment