[v2] Fixed unwanted reboot every 5 Minutes after -n flash

Submitted by Jan Kraus on Jan. 7, 2017, 1:52 p.m.

Details

Message ID 1483797143-21634-1-git-send-email-mayosemmel@gmail.com
State Accepted
Commit 74bc7e794927b1438270b4f71661b5ee1c7e8614
Headers show

Commit Message

Jan Kraus Jan. 7, 2017, 1:52 p.m.
The error only occurs if there isn't any network connection.
Fixes #23
Also added prevention for applying empty coordinates.

Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
---
changes in v2:
fixed typo in error message (cannot to can't)
added prevention for applying empty coordinates (thanks Tim)
updated commit message for Mantis compatibility
---
 .../fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh    | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
index 4c20974..1d042e4 100755
--- a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
+++ b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
@@ -26,6 +26,9 @@  xml_data=$( wget -q -O - "http://fe80::ff:feee:1%br-mesh/api/rest/api.php?rquest
 if [ -z "$xml_data" ]; then
 	echo "xml_data is not set"
 	exit 1
+elif echo "$xml_data"|grep "can't connect to remote host" ;then
+	echo "The Netmon Server can't be reached."
+	exit 1
 elif echo "$xml_data"|grep "HTTP/1.1 404 Not Found" ;then
 	echo "This Router is not present in the Netmon Database."
 	delete_myself
@@ -45,6 +48,9 @@  if [ "$latitude" -eq 0 ] && [ "$longitude" -eq 0 ]; then
 	echo "Unable to retrieve coordinates from Netmon."
 	echo "Maybe the coordinates are suppressed."
 	delete_myself
+elif [ -z "$latitude" ] || [ -z "$longitude" ]; then
+    echo "No coordinates, looks like an error"
+    exit 1
 fi
 
 uci set system.@system[0]=system

Comments

Tobias Klaus Jan. 9, 2017, 9:57 p.m.
Hey,

Reviewed-by: Tobias Klaus <tk+ff@meskal.net>

Grüße
Tobias

Am Samstag, 7. Januar 2017, 14:52:23 CET schrieb Jan Kraus:
> The error only occurs if there isn't any network connection.
> Fixes #23
> Also added prevention for applying empty coordinates.
> 
> Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
> ---
> changes in v2:
> fixed typo in error message (cannot to can't)
> added prevention for applying empty coordinates (thanks Tim)
> updated commit message for Mantis compatibility
> ---
>  .../fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh    | 6
> ++++++ 1 file changed, 6 insertions(+)
> 
> diff --git
> a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> index 4c20974..1d042e4 100755
> ---
> a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> +++
> b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> @@ -26,6 +26,9 @@ xml_data=$( wget -q -O -
> "http://fe80::ff:feee:1%br-mesh/api/rest/api.php?rquest if [ -z "$xml_data"
> ]; then
>  	echo "xml_data is not set"
>  	exit 1
> +elif echo "$xml_data"|grep "can't connect to remote host" ;then
> +	echo "The Netmon Server can't be reached."
> +	exit 1
>  elif echo "$xml_data"|grep "HTTP/1.1 404 Not Found" ;then
>  	echo "This Router is not present in the Netmon Database."
>  	delete_myself
> @@ -45,6 +48,9 @@ if [ "$latitude" -eq 0 ] && [ "$longitude" -eq 0 ]; then
>  	echo "Unable to retrieve coordinates from Netmon."
>  	echo "Maybe the coordinates are suppressed."
>  	delete_myself
> +elif [ -z "$latitude" ] || [ -z "$longitude" ]; then
> +    echo "No coordinates, looks like an error"
> +    exit 1
>  fi
> 
>  uci set system.@system[0]=system
Tim Niemeyer Jan. 10, 2017, 6:29 p.m.
Hi

Danke fürs Nachbessern. Sieht gut aus.

Reviewed-by: Tim Niemeyer <tim@tn-x.org>

Tim

Am Samstag, den 07.01.2017, 14:52 +0100 schrieb Jan Kraus:
> The error only occurs if there isn't any network connection.
> Fixes #23
> Also added prevention for applying empty coordinates.
> 
> Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
> ---
> changes in v2:
> fixed typo in error message (cannot to can't)
> added prevention for applying empty coordinates (thanks Tim)
> updated commit message for Mantis compatibility
> ---
>  .../fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh    | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> index 4c20974..1d042e4 100755
> --- a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> +++ b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> @@ -26,6 +26,9 @@ xml_data=$( wget -q -O - "http://fe80::ff:feee:1%br-mesh/api/rest/api.php?rquest
>  if [ -z "$xml_data" ]; then
>  	echo "xml_data is not set"
>  	exit 1
> +elif echo "$xml_data"|grep "can't connect to remote host" ;then
> +	echo "The Netmon Server can't be reached."
> +	exit 1
>  elif echo "$xml_data"|grep "HTTP/1.1 404 Not Found" ;then
>  	echo "This Router is not present in the Netmon Database."
>  	delete_myself
> @@ -45,6 +48,9 @@ if [ "$latitude" -eq 0 ] && [ "$longitude" -eq 0 ]; then
>  	echo "Unable to retrieve coordinates from Netmon."
>  	echo "Maybe the coordinates are suppressed."
>  	delete_myself
> +elif [ -z "$latitude" ] || [ -z "$longitude" ]; then
> +    echo "No coordinates, looks like an error"
> +    exit 1
>  fi
>  
>  uci set system.@system[0]=system
> -- 
> 2.1.4
>
Tim Niemeyer Jan. 10, 2017, 6:32 p.m.
Hi

Und applied.

Tim

Am Samstag, den 07.01.2017, 14:52 +0100 schrieb Jan Kraus:
> The error only occurs if there isn't any network connection.
> Fixes #23
> Also added prevention for applying empty coordinates.
> 
> Signed-off-by: Jan Kraus <mayosemmel@gmail.com>
> ---
> changes in v2:
> fixed typo in error message (cannot to can't)
> added prevention for applying empty coordinates (thanks Tim)
> updated commit message for Mantis compatibility
> ---
>  .../fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh    | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> index 4c20974..1d042e4 100755
> --- a/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> +++ b/src/packages/fff/fff-sysupgrade/files/usr/sbin/copy_netmon_coordinates.sh
> @@ -26,6 +26,9 @@ xml_data=$( wget -q -O - "http://fe80::ff:feee:1%br-mesh/api/rest/api.php?rquest
>  if [ -z "$xml_data" ]; then
>  	echo "xml_data is not set"
>  	exit 1
> +elif echo "$xml_data"|grep "can't connect to remote host" ;then
> +	echo "The Netmon Server can't be reached."
> +	exit 1
>  elif echo "$xml_data"|grep "HTTP/1.1 404 Not Found" ;then
>  	echo "This Router is not present in the Netmon Database."
>  	delete_myself
> @@ -45,6 +48,9 @@ if [ "$latitude" -eq 0 ] && [ "$longitude" -eq 0 ]; then
>  	echo "Unable to retrieve coordinates from Netmon."
>  	echo "Maybe the coordinates are suppressed."
>  	delete_myself
> +elif [ -z "$latitude" ] || [ -z "$longitude" ]; then
> +    echo "No coordinates, looks like an error"
> +    exit 1
>  fi
>  
>  uci set system.@system[0]=system
> -- 
> 2.1.4
>