diff --git a/contrib/updatecheck/calcversions.sh b/contrib/updatecheck/calcversions.sh index da502b97..1052c352 100755 --- a/contrib/updatecheck/calcversions.sh +++ b/contrib/updatecheck/calcversions.sh @@ -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 diff --git a/contrib/updatecheck/index.php b/contrib/updatecheck/index.php index 9a0105a6..6a4f092e 100644 --- a/contrib/updatecheck/index.php +++ b/contrib/updatecheck/index.php @@ -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'); diff --git a/contrib/updatecheck/prepend.inc b/contrib/updatecheck/prepend.inc index c4f2c144..bb93f14c 100644 --- a/contrib/updatecheck/prepend.inc +++ b/contrib/updatecheck/prepend.inc @@ -1,21 +1,26 @@ 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;