[PATCH] fff-hoods: Fix case of missing keyxchangev2data

Tim Niemeyer tim at tn-x.org
So Okt 15 17:41:08 CEST 2017


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 at 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
> 
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 488 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20171015/a4cecd57/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev