diff --git a/packages/lime-app/files/etc/uci-defaults/shared-state-reference_state_nodes_info_cron b/packages/lime-app/files/etc/uci-defaults/shared-state-reference_state_nodes_info_cron new file mode 100755 index 000000000..5cba2a6fa --- /dev/null +++ b/packages/lime-app/files/etc/uci-defaults/shared-state-reference_state_nodes_info_cron @@ -0,0 +1,10 @@ +#!/bin/sh + +unique_append() +{ + grep -qF "$1" "$2" || echo "$1" >> "$2" +} + +unique_append \ + '*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state-multiwriter sync reference_state_nodes_info &> /dev/null)&)'\ + /etc/crontabs/root diff --git a/packages/lime-app/files/etc/uci-defaults/shared-state-reference_state_wifi_links_info_cron b/packages/lime-app/files/etc/uci-defaults/shared-state-reference_state_wifi_links_info_cron new file mode 100644 index 000000000..d71d2b4c5 --- /dev/null +++ b/packages/lime-app/files/etc/uci-defaults/shared-state-reference_state_wifi_links_info_cron @@ -0,0 +1,10 @@ +#!/bin/sh + +unique_append() +{ + grep -qF "$1" "$2" || echo "$1" >> "$2" +} + +unique_append \ + '*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state-multiwriter sync reference_state_wifi_links_info &> /dev/null)&)'\ + /etc/crontabs/root diff --git a/packages/lime-system/files/usr/lib/lua/lime/utils.lua b/packages/lime-system/files/usr/lib/lua/lime/utils.lua index 4d9111fd4..b175a8ee6 100644 --- a/packages/lime-system/files/usr/lib/lua/lime/utils.lua +++ b/packages/lime-system/files/usr/lib/lua/lime/utils.lua @@ -574,6 +574,8 @@ function utils.is_valid_mac(string) end end +--! TODO: Better having a C strcmp/memcmp like behavior so the output can be +--! used for sorting beyond determining equality function utils.deepcompare(t1,t2) if t1 == t2 then return true end local ty1 = type(t1) diff --git a/packages/shared-state-network_nodes/Makefile b/packages/shared-state-network_nodes/Makefile index 10c37aab7..b6158d2ad 100644 --- a/packages/shared-state-network_nodes/Makefile +++ b/packages/shared-state-network_nodes/Makefile @@ -1,23 +1,22 @@ # -# Copyright (C) 2020 German Ferrero +# Copyright (C) 2020-2023 Asociacion Civil Altermundi # -# This is free software, licensed under the GNU General Public License v3. +# This is free software, licensed under the GNU Affero General Public License v3. # include ../../libremesh.mk define Package/$(PKG_NAME) - SECTION:=utils - CATEGORY:=Utilities - TITLE:=$(PKG_NAME) provides shared state database of all times network nodes - MAINTAINER:=Germán Ferrero + CATEGORY:=LibreMesh + TITLE:=$(PKG_NAME) provides data-type for network nodes marked as reliable by user + MAINTAINER:=Asociacion Civil Altermundi DEPENDS:=+shared-state +shared-state-nodes_and_links +lime-system +luci-lib-jsonc \ +libubus-lua +random-numgen PKGARCH:=all endef define Package/$(PKG_NAME)/description - This $(PKG_NAME) provides shared state database of all times network nodes. + Provides data-type for network nodes marked as reliable by user via lime-app endef $(eval $(call BuildPackage,$(PKG_NAME)))