Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2020.1] Fix shared-state-nodes_and_links #835

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()