Created
May 13, 2019 08:50
-
-
Save HillReywer/d6d10ff8bbec55b3dc0bf4a32d8ef74e to your computer and use it in GitHub Desktop.
Install Deployer php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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