fff-hoods: Fix case of missing keyxchangev2data

Submitted by Adrian Schmutzler on Oct. 15, 2017, 12:09 p.m.

Details

Message ID 1508069347-8927-1-git-send-email-freifunk@adrianschmutzler.de
State Superseded
Headers show

Commit Message

Adrian Schmutzler Oct. 15, 2017, 12:09 p.m.
This fixes a missing /tmp/keyxchangev2data due to gateway
misconfiguration.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 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(-)

Patch hide | download patch | download mbox

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

Comments

Tim Niemeyer Oct. 15, 2017, 3:41 p.m.
Hi

Am Sonntag, den 15.10.2017, 14:09 +0200 schrieb Adrian Schmutzler:
> This fixes a missing /tmp/keyxchangev2data due to gateway
> misconfiguration.
> 
> > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
> ---
>  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"
Ich mag doppelten Code nicht so gern. Vielleicht wäre es besser, wenn
man den Dateinamen in eine Variable packt und diesen dann je nach
Bedingung setzt.

> +	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
Hier auch..

Tim

> +elif [ -s /tmp/keyxchangev2data ] ; then
> >  	json_load "$(cat /tmp/keyxchangev2data)"
> >  	json_select hood
> >  	json_get_var mesh_type2 mesh_type2
> -- 
> 2.7.4
>