Skip to content

Commit

Permalink
Fix shared-state-nodes_and_links
Browse files Browse the repository at this point in the history
  • Loading branch information
G10h4ck committed Dec 18, 2020
1 parent 836b9af commit 45c6d04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
8 changes: 4 additions & 4 deletions packages/shared-state-nodes_and_links/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)
include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
TITLE:=nodes_and_links module for shared-state
CATEGORY:=LiMe
TITLE:=Nodes and links module for shared-state
CATEGORY:=LibreMesh
MAINTAINER:=Nicolas Pace <nico@libre.ws>
URL:=http://libremesh.org
DEPENDS:=+@BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT +lua +luci-lib-jsonc \
DEPENDS:=+@BUSYBOX_CONFIG_ASH_RANDOM_SUPPORT +lua \
shared-state +ubus-lime-location
PKGARCH:=all
endef

define Package/$(PKG_NAME)/description
Syncronize nodes_and_links beween nodes.
Syncronize nodes and links beween nodes.
endef

define Build/Compile
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/lua

--! LibreMesh
--! Copyright (C) 2019 Gioacchino Mazzurco <gio@altermundi.net>
--! Copyright (C) 2020 Gioacchino Mazzurco <gio@altermundi.net>
--!
--! This program is free software: you can redistribute it and/or modify
--! it under the terms of the GNU Affero General Public License as
Expand All @@ -16,15 +16,11 @@
--! You should have received a copy of the GNU Affero General Public License
--! along with this program. If not, see <http://www.gnu.org/licenses/>.

local fs = require("nixio.fs")
local JSON = require("luci.jsonc")
local dataHandle = io.popen(
"echo '{}' | /usr/libexec/rpcd/lime-location call nodes_and_links", "r" )

local function shell(command)
-- TODO(nicoechaniz): sanitize or evaluate if this is a security risk
local handle = io.popen(command)
local result = handle:read("*a")
handle:close()
return result
end
io.popen("shared-state insert nodes_and_links", "w"):write(shell("/usr/libexec/rpcd/lime-location call nodes_and_links </dev/null"))
local ssHandle = io.popen("shared-state insert nodes_and_links", "w")
ssHandle:write(dataHandle:read("*a"))

dataHandle:close()
ssHandle:close()

0 comments on commit 45c6d04

Please sign in to comment.