All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 1/2] alfred: fix batadv-vis invocation in init.d script
@ 2013-12-13 19:03 Gui Iribarren
  2013-12-13 19:05 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: workaround race condition when batmanif is not ready at boot time Gui Iribarren
  2013-12-16 15:10 ` [B.A.T.M.A.N.] [PATCH 1/2] alfred: fix batadv-vis invocation in init.d script Simon Wunderlich
  0 siblings, 2 replies; 3+ messages in thread
From: Gui Iribarren @ 2013-12-13 19:03 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

broken (wouldn't start, failing silently) since the following commit:
 * "renamed vis to batadv-vis to avoid collisions with other vis binaries"
which renamed only some instances of the "vis" command

Signed-off-by: Gui Iribarren <gui@altermundi.net>
---
 alfred/Makefile          |  2 +-
 alfred/files/alfred.init | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/alfred/Makefile b/alfred/Makefile
index ffc8026..b9c2c33 100644
--- a/alfred/Makefile
+++ b/alfred/Makefile
@@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk
 #
 PKG_NAME:=alfred
 PKG_VERSION:=2013.4.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_MD5SUM:=3891697e127b1037cfc9349fd96e9993
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init
index e52a7bd..b678d4c 100755
--- a/alfred/files/alfred.init
+++ b/alfred/files/alfred.init
@@ -13,7 +13,7 @@ alfred_args=""
 vis_args=""
 facters_dir="/etc/alfred"
 pid_file_alfred="/var/run/alfred.pid"
-pid_file_vis="/var/run/vis.pid"
+pid_file_vis="/var/run/batadv-vis.pid"
 enable=0
 vis_enable=0
 SERVICE_DAEMONIZE=1
@@ -44,7 +44,7 @@ alfred_start()
 	enable=1
 
         config_get_bool start_vis "$section" start_vis 0
-        if [ "$start_vis" = 1 ] && [ -x /usr/sbin/vis ]; then
+        if [ "$start_vis" = 1 ] && [ -x /usr/sbin/batadv-vis ]; then
                 vis_enable=1
                 append vis_args "-i $batmanif -s"
         fi
@@ -67,9 +67,9 @@ start()
 	service_start /usr/sbin/alfred ${alfred_args}
 
 	if [ "$vis_enable" = "1" ]; then
-		echo "${initscript}: starting vis"
+		echo "${initscript}: starting batadv-vis"
 		SERVICE_PID_FILE="$pid_file_vis"
-		service_start /usr/sbin/vis ${vis_args}
+		service_start /usr/sbin/batadv-vis ${vis_args}
 	fi
 
 	if [ "$run_facters" = "1" ]; then
@@ -87,7 +87,7 @@ stop()
 	SERVICE_PID_FILE="$pid_file_alfred"
 	service_stop /usr/sbin/alfred
 	SERVICE_PID_FILE="$pid_file_vis"
-	[ -x /usr/sbin/vis ] && service_stop /usr/sbin/vis
+	[ -x /usr/sbin/batadv-vis ] && service_stop /usr/sbin/batadv-vis
 	sed "\|for file in $facters_dir/\* ; do |d" -i /etc/crontabs/root
 	/etc/init.d/cron restart
 }
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/2] alfred: workaround race condition when batmanif is not ready at boot time
  2013-12-13 19:03 [B.A.T.M.A.N.] [PATCH 1/2] alfred: fix batadv-vis invocation in init.d script Gui Iribarren
@ 2013-12-13 19:05 ` Gui Iribarren
  2013-12-16 15:10 ` [B.A.T.M.A.N.] [PATCH 1/2] alfred: fix batadv-vis invocation in init.d script Simon Wunderlich
  1 sibling, 0 replies; 3+ messages in thread
From: Gui Iribarren @ 2013-12-13 19:05 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

Wait up to 30 seconds during init.d script on boot, so that batmanif can
come up. If the timeout is reached, the init.d script refuses to start
alfred and related daemons.

This prevents an alfred crash when it would start during early boot, before
batmanif is available. Instead, alfred is started as soon as batmanif appears,
if that happens during the 30-second window.

Signed-off-by: Gui Iribarren <gui@altermundi.net>
---
 alfred/Makefile          |  2 +-
 alfred/files/alfred.init | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/alfred/Makefile b/alfred/Makefile
index b9c2c33..c8e73c2 100644
--- a/alfred/Makefile
+++ b/alfred/Makefile
@@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk
 #
 PKG_NAME:=alfred
 PKG_VERSION:=2013.4.0
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_MD5SUM:=3891697e127b1037cfc9349fd96e9993
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init
index b678d4c..b777b53 100755
--- a/alfred/files/alfred.init
+++ b/alfred/files/alfred.init
@@ -16,6 +16,7 @@ pid_file_alfred="/var/run/alfred.pid"
 pid_file_vis="/var/run/batadv-vis.pid"
 enable=0
 vis_enable=0
+batmanif=""
 SERVICE_DAEMONIZE=1
 SERVICE_WRITE_PID=1
 
@@ -23,7 +24,7 @@ alfred_start()
 {
 	local args=""
 	local section="$1"
-	local disabled interface mode batmanif
+	local disabled interface mode
 
 	# check if section is disabled
 	config_get_bool disabled "$section" disabled 0
@@ -62,6 +63,21 @@ start()
 	if [ "$enable" = "0" ]; then
 		exit 0
 	fi
+
+	mesh_dir="/sys/class/net/$batmanif/mesh/"
+	if ! [ -d "$mesh_dir" ] ; then
+		timeout=30
+		echo "${initscript}: waiting $timeout secs for $batmanif interface..."
+		for i in $(seq $timeout); do
+			sleep 1
+			[ -d "$mesh_dir" ] && break
+			if [ $i == $timeout ] ; then
+				echo "${initscript}: $batmanif not detected, alfred not starting."
+				exit 1
+			fi
+		done
+	fi
+
 	echo "${initscript}: starting alfred"
 	SERVICE_PID_FILE="$pid_file_alfred"
 	service_start /usr/sbin/alfred ${alfred_args}
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] alfred: fix batadv-vis invocation in init.d script
  2013-12-13 19:03 [B.A.T.M.A.N.] [PATCH 1/2] alfred: fix batadv-vis invocation in init.d script Gui Iribarren
  2013-12-13 19:05 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: workaround race condition when batmanif is not ready at boot time Gui Iribarren
@ 2013-12-16 15:10 ` Simon Wunderlich
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Wunderlich @ 2013-12-16 15:10 UTC (permalink / raw)
  To: b.a.t.m.a.n

> broken (wouldn't start, failing silently) since the following commit:
>  * "renamed vis to batadv-vis to avoid collisions with other vis binaries"
> which renamed only some instances of the "vis" command
> 
> Signed-off-by: Gui Iribarren <gui@altermundi.net>
Thanks Guido!

I've applied your patches, resvision 0a7457d and aee1e4f in openwrt-feed-
alfred.git and revisions 47a466e and e2cfab7 in git@github.com:openwrt-
routing/packages.git.

Thanks, 
    Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-12-16 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-13 19:03 [B.A.T.M.A.N.] [PATCH 1/2] alfred: fix batadv-vis invocation in init.d script Gui Iribarren
2013-12-13 19:05 ` [B.A.T.M.A.N.] [PATCH 2/2] alfred: workaround race condition when batmanif is not ready at boot time Gui Iribarren
2013-12-16 15:10 ` [B.A.T.M.A.N.] [PATCH 1/2] alfred: fix batadv-vis invocation in init.d script Simon Wunderlich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.