From patchwork Sun Oct 15 12:09:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: fff-hoods: Fix case of missing keyxchangev2data From: Adrian Schmutzler X-Patchwork-Id: 587 Message-Id: <1508069347-8927-1-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Sun, 15 Oct 2017 14:09:07 +0200 This fixes a missing /tmp/keyxchangev2data due to gateway misconfiguration. Signed-off-by: Adrian Schmutzler --- src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange | 7 ++++++- src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange index be27e5a..293d56f 100644 --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange @@ -5,7 +5,12 @@ . /usr/share/libubox/jshn.sh getUpgradePath() { - if [ -s /tmp/keyxchangev2data ]; then + if [ -s /www/public/keyxchangev2data ]; then + json_load "$(cat /www/public/keyxchangev2data)" + json_select hood + json_get_var upath upgrade_path + echo "$upath" + elif [ -s /tmp/keyxchangev2data ] ; then json_load "$(cat /tmp/keyxchangev2data)" json_select hood json_get_var upath upgrade_path diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html index 1569c01..1aa41ea 100755 --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html @@ -49,7 +49,12 @@ fi # read from keyxchangev2data . /usr/share/libubox/jshn.sh -if [ -s /tmp/keyxchangev2data ] ; then +if [ -s /www/public/keyxchangev2data ] ; then + json_load "$(cat /www/public/keyxchangev2data)" + json_select hood + json_get_var mesh_type2 mesh_type2 + json_get_var mesh_type5 mesh_type5 +elif [ -s /tmp/keyxchangev2data ] ; then json_load "$(cat /tmp/keyxchangev2data)" json_select hood json_get_var mesh_type2 mesh_type2