distinguish between problematic binaries before commit 94932c1 and after

This commit is contained in:
john30
2019-10-06 11:25:33 +02:00
parent f8733a5e6b
commit 20a8f4f7f6
3 changed files with 20 additions and 14 deletions
+1
View File
@@ -4,3 +4,4 @@ revision=`git describe --always`
echo "ebusd=${version},${revision}" > versions.txt
files=`find config/ -type f -or -type l`
../../src/lib/ebus/test/test_filereader $files|sed -e 's#^config/##' -e 's#^\([^ ]*\) #\1=#' -e 's# #,#g'|sort >> versions.txt
./oldtest_filereader $files|sed -e 's#^config/##' -e 's#^\([^ ]*\) #\1=#' -e 's# #,#g'|sort >> oldversions.txt
+1 -1
View File
@@ -5,7 +5,7 @@ if (substr($agent, 0, 5)==='ebusd') {
$r = @file_get_contents('php://input');
header('Content-Type: text/plain');
$r = @json_decode($r, true);
echo checkUpdate(@$r['v'], @$r['r'], @$r['l']);
echo checkUpdate(@$r['v'], @$r['r'], @$r['a'], @$r['l']);
exit;
}
header('HTTP/1.1 404 Not Found');
+18 -13
View File
@@ -1,21 +1,26 @@
<?php
$v = @file_get_contents('versions.txt');
$versions = array();
if ($v) {
$v = explode("\n", $v);
$func = function($val, $k) {
global $versions;
$val = explode('=', $val);
if (count($val)>1) {
$versions[$val[0]] = explode(',', $val[1]);
}
};
array_walk($v, $func);
function readVersions($old=false) {
global $versions;
$versions = array();
$v = @file_get_contents(($old?'old':'').'versions.txt');
if ($v) {
$v = explode("\n", $v);
$func = function($val, $k) {
global $versions;
$val = explode('=', $val);
if (count($val)>1) {
$versions[$val[0]] = explode(',', $val[1]);
}
};
array_walk($v, $func);
}
}
function checkUpdate($ebusdVersion, $ebusdRelease, $loadedFiles) {
function checkUpdate($ebusdVersion, $ebusdRelease, $architecture, $loadedFiles) {
if (!$ebusdVersion) {
return 'invalid request';
}
readVersions($architecture && substr($architecture, 0, 3)!=='arm' && ($ebusdVersion<'3.3' || ($ebusdVersion==='3.3' && ($ebusdRelease==='v3.3' || (strtok($ebusdRelease, '-')==='v3.3') && strtok('-')<18))));
global $versions;
$ret = 'unknown';
if ($ebusdVersion==$versions['ebusd'][0] && $ebusdRelease==$versions['ebusd'][1]) {
@@ -39,7 +44,7 @@ function checkUpdate($ebusdVersion, $ebusdRelease, $loadedFiles) {
}
}
}
if (strlen($configs)>100) {
if (strlen($configs)>1000) {
return $ret.($newerAvailable?', '.$newerAvailable.' newer':', different').' configuration files available';
}
return $ret.$configs;