From 4c2c198842195a2e81f099c39aec2b0a8798896d Mon Sep 17 00:00:00 2001 From: John Date: Sat, 17 Dec 2022 17:43:39 +0100 Subject: [PATCH] add device version to update check --- contrib/updatecheck/calcversions.sh | 3 +++ contrib/updatecheck/index.php | 2 +- contrib/updatecheck/prepend.inc | 9 ++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/contrib/updatecheck/calcversions.sh b/contrib/updatecheck/calcversions.sh index 9893e59b..728e8f3c 100755 --- a/contrib/updatecheck/calcversions.sh +++ b/contrib/updatecheck/calcversions.sh @@ -3,6 +3,9 @@ version=`head -n 1 ../../VERSION` revision=`git describe --always` echo "ebusd=${version},${revision}" > versions.txt echo "ebusd=${version},${revision}" > oldversions.txt +devver=`curl -s https://adapter.ebusd.eu/firmware/ChangeLog|grep "Version "|head -n 1|sed -e 's#.*]*>##' -e 's#<.*##' -e 's# ##'` +devbl=`curl -s https://adapter.ebusd.eu/firmware/ChangeLog|grep "Bootloader "|head -n 1|sed -e 's#.*]*>##' -e 's#<.*##' -e 's# ##'` +echo "device=${devver},${devbl}" >> 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 9a0d92c3..1fc33e42 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['a'], @$r['l']); + echo checkUpdate(@$r['v'], @$r['r'], @$r['a'], @$r['dv'], @$r['l']); exit; } readVersions(); diff --git a/contrib/updatecheck/prepend.inc b/contrib/updatecheck/prepend.inc index 76c4492f..fe248873 100644 --- a/contrib/updatecheck/prepend.inc +++ b/contrib/updatecheck/prepend.inc @@ -16,7 +16,7 @@ function readVersions($old=false) { array_walk($v, $func); } } -function checkUpdate($ebusdVersion, $ebusdRelease, $architecture, $loadedFiles) { +function checkUpdate($ebusdVersion, $ebusdRelease, $architecture, $deviceVersion, $loadedFiles) { if (!$ebusdVersion) { return 'invalid request'; } @@ -30,6 +30,13 @@ function checkUpdate($ebusdVersion, $ebusdRelease, $architecture, $loadedFiles) } else { $ret = 'version '.$versions['ebusd'][0].' available'; } + if ($deviceVersion && @$versions['device']) { + $feat = strtok($deviceVersion, '.'); + $ver = strtok('.'); + if ($ver && $ver!==$versions['device'][0]) { + $ret .= ', device firmware '.$versions['device'][0].' available'; + } + } $newerAvailable = 0; $configs = ''; foreach ($loadedFiles as $k => $val) {