Updated stubs, improved PHP7 compatibility
This commit is contained in:
parent
10f4f09a34
commit
9f8cf0bf38
@ -18,3 +18,8 @@ HotFix; Quickly patch and fix system
|
|||||||
|
|
||||||
$ hotfix sign test.hotfix
|
$ hotfix sign test.hotfix
|
||||||
|
|
||||||
|
|
||||||
|
## Building the executable
|
||||||
|
|
||||||
|
Included is `makephar`, a utility to create highly compressed self-executable
|
||||||
|
php archives.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
define("APP_VERSION", "0.1-pre");
|
||||||
|
|
||||||
require_once __DIR__."/../vendor/autoload.php";
|
require_once __DIR__."/../vendor/autoload.php";
|
||||||
require_once __DIR__."/systemtest.php";
|
require_once __DIR__."/systemtest.php";
|
||||||
if (file_exists(__DIR__."/banner.php"))
|
if (file_exists(__DIR__."/banner.php"))
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
if (!is_callable("gnupg_init")) {
|
if (!is_callable("gnupg_init")) {
|
||||||
fprintf(STDERR, "Error: The PHP GnuPG extension is not installed.\n\n");
|
fprintf(STDERR, "Error: The PHP GnuPG extension is not installed.\n\n");
|
||||||
fprintf(STDERR," * Debian/Ubuntu: Resolve with 'sudo apt-get install php5-gnupg' (or 'php7-gnupg')\n");
|
if (PHP_VERSION_ID >= 7) {
|
||||||
|
fprintf(STDERR, "Resolve using pecl:\n sudo pecl install gnupg-1.4.0RC1\n");
|
||||||
|
fprintf(STDERR, " echo 'extension=gnupg.so' | sudo tee /etc/php/7.0/mods-available/gnupg.ini\n");
|
||||||
|
fprintf(STDERR, " sudo phpenmod gnupg\n");
|
||||||
|
} else {
|
||||||
|
fprintf(STDERR," * Debian/Ubuntu: Resolve with 'sudo apt-get install php5-gnupg'\n");
|
||||||
|
fprintf(STDERR," * Any distro: Resolve with 'sudp pecl install gnupg', follow instructions to enable.\n");
|
||||||
|
}
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"symfony/console": "^3.0",
|
"symfony/console": "^3.0",
|
||||||
"symfony/yaml": "^3.0"
|
"symfony/yaml": "^3.0",
|
||||||
|
"noccylabs/downloader": "@dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,5 @@ author: Noccy <cvagnetoft@gmail.com>
|
|||||||
lang: bash
|
lang: bash
|
||||||
---
|
---
|
||||||
|
|
||||||
echo "Hello World"
|
info "Hello World"
|
||||||
|
exec "ls -al"
|
||||||
echo "This is executing in bash! Woot"
|
|
||||||
|
@ -57,6 +57,7 @@ class Hotfix
|
|||||||
break;
|
break;
|
||||||
case 'php':
|
case 'php':
|
||||||
$exec = "/usr/bin/env php";
|
$exec = "/usr/bin/env php";
|
||||||
|
$head = "<?php require_once \"".__DIR__."/../../vendor/autoload.php\"; ".file_get_contents(__DIR__."/../stubs/php.stub");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(STDERR, "Error: Unsupported language %s\n", $lang);
|
fprintf(STDERR, "Error: Unsupported language %s\n", $lang);
|
||||||
|
@ -44,7 +44,11 @@ class Loader
|
|||||||
} else {
|
} else {
|
||||||
list ($body, $signature) = explode($sigHeader, $hotfix);
|
list ($body, $signature) = explode($sigHeader, $hotfix);
|
||||||
$signature = $sigHeader.$signature;
|
$signature = $sigHeader.$signature;
|
||||||
|
if (!$insecure) {
|
||||||
$signer = $this->verifySignature($body, $signature);
|
$signer = $this->verifySignature($body, $signature);
|
||||||
|
} else {
|
||||||
|
$signer = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new Hotfix($body, $signer);
|
return new Hotfix($body, $signer);
|
||||||
}
|
}
|
||||||
@ -64,6 +68,10 @@ class Loader
|
|||||||
$fingerprint = $sigInfo[0]['fingerprint'];
|
$fingerprint = $sigInfo[0]['fingerprint'];
|
||||||
$keyInfo = gnupg_keyinfo($gpg, $fingerprint);
|
$keyInfo = gnupg_keyinfo($gpg, $fingerprint);
|
||||||
|
|
||||||
|
if (empty($keyInfo)) {
|
||||||
|
throw new \Exception("Unknown signer (key id {$sigInfo[0]['fingerprint']})");
|
||||||
|
}
|
||||||
|
|
||||||
$subKeys = $keyInfo[0]['subkeys'];
|
$subKeys = $keyInfo[0]['subkeys'];
|
||||||
$keyId = null;
|
$keyId = null;
|
||||||
foreach ($subKeys as $subKey) {
|
foreach ($subKeys as $subKey) {
|
||||||
@ -73,10 +81,6 @@ class Loader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($keyInfo)) {
|
|
||||||
throw new \Exception("Unknown signer (key id {$sigInfo[0]['fingerprint']})");
|
|
||||||
}
|
|
||||||
|
|
||||||
return [ $keyInfo[0], $keyId ];
|
return [ $keyInfo[0], $keyId ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ class HotfixApplication extends Application
|
|||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct("Hotfixer", "0.1");
|
parent::__construct("Hotfix", APP_VERSION." (".PHAR_BUILD_DATE.")");
|
||||||
$this->add(new Command\ApplyCommand());
|
$this->add(new Command\ApplyCommand());
|
||||||
$this->add(new Command\SignCommand());
|
$this->add(new Command\SignCommand());
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,15 @@ test -e /etc/lsb-release && source /etc/lsb-release
|
|||||||
|
|
||||||
function exec() {
|
function exec() {
|
||||||
echo -e "\e[36;1m[exec]\e[36;21m $*\e[0m"
|
echo -e "\e[36;1m[exec]\e[36;21m $*\e[0m"
|
||||||
LOG=$(tempfile -p exec)
|
# LOG=$(tempfile -p exec)
|
||||||
$@ &>$LOG
|
$@
|
||||||
|
# &>$LOG
|
||||||
EC=$?
|
EC=$?
|
||||||
if [ $EC -gt 0 ]; then
|
if [ $EC -gt 0 ]; then
|
||||||
echo -e "\e[31;1m[warn]\e[31;21m Command completed with exitcode $EC\e[0m"
|
echo -e "\e[31;1m[warn]\e[31;21m Command completed with exitcode $EC\e[0m"
|
||||||
tail -n5 $LOG | awk '{ print " " $0 }'
|
# tail -n5 $LOG | awk '{ print " " $0 }'
|
||||||
fi
|
fi
|
||||||
rm $LOG
|
# rm $LOG
|
||||||
}
|
}
|
||||||
function info() {
|
function info() {
|
||||||
echo -e "\e[32;1m[info]\e[32;21m $*\e[0m"
|
echo -e "\e[32;1m[info]\e[32;21m $*\e[0m"
|
||||||
|
Loading…
Reference in New Issue
Block a user