diff --git a/README.md b/README.md index ed81bad67..29ea7d419 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Start an ImageBuilder of your choice, for example ath79-generic if your device i ```shell mkdir ./images/ -docker run -it -v $(pwd)/images:/images/ ghcr.io/openwrt/imagebuilder:ath79-generic-v22.03.5 +docker run -it -v $(pwd)/images:/images/ ghcr.io/openwrt/imagebuilder:ath79-generic-v23.05.3 ``` If your device is not part of ath79-generic profiles, you can replace it with another <target>-<subtarget> combination. For knowing which target and subtarget is best suited for your router, check out the page about it in the [OpenWrt's Table of Hardware][OpenWrt-ToH]. @@ -65,6 +65,7 @@ Within the container, add the `lime-packages` feeds: ```shell echo "src/gz libremesh https://feed.libremesh.org/master" >> repositories.conf +echo "src/gz libremesh_profiles https://feed.libremesh.org/profiles" >> repositories.conf echo "src/gz libremesh_arch_packages https://feed.libremesh.org/arch_packages/master/mips_24kc" >> repositories.conf echo "untrusted comment: signed by libremesh.org key a71b3c8285abd28b" > keys/a71b3c8285abd28b echo "RWSnGzyChavSiyQ+vLk3x7F0NqcLa4kKyXCdriThMhO78ldHgxGljM/8" >> keys/a71b3c8285abd28b @@ -95,6 +96,7 @@ Go to . Find your device. Click on the f ```shell echo "src/gz libremesh https://feed.libremesh.org/master" >> repositories.conf +echo "src/gz libremesh_profiles https://feed.libremesh.org/profiles" >> repositories.conf echo "src/gz libremesh_arch_packages https://feed.libremesh.org/arch_packages/master/mips_24kc" >> repositories.conf echo "untrusted comment: signed by libremesh.org key a71b3c8285abd28b" > keys/a71b3c8285abd28b echo "RWSnGzyChavSiyQ+vLk3x7F0NqcLa4kKyXCdriThMhO78ldHgxGljM/8" >> keys/a71b3c8285abd28b diff --git a/packages/bmx7-auto-gw-bw-mode/files/usr/sbin/bmx7-auto-bw-test b/packages/bmx7-auto-gw-bw-mode/files/usr/sbin/bmx7-auto-bw-test index ee6f1f685..f221d7b10 100755 --- a/packages/bmx7-auto-gw-bw-mode/files/usr/sbin/bmx7-auto-bw-test +++ b/packages/bmx7-auto-gw-bw-mode/files/usr/sbin/bmx7-auto-bw-test @@ -7,7 +7,7 @@ bw_test() { while [ -z "$bw" -a $try -lt $TRIES ]; do test=$({ wget -T5 -q $1 -O- | pv -n -b -t >/dev/null; } 2>&1) bw=$(echo $test | awk '{printf "%.0f",$NF/$(NF-1)*8}') - try=$(($try+1)) + try=$((try+1)) done echo $bw } diff --git a/packages/check-date-http/Makefile b/packages/check-date-http/Makefile index 868eafd34..cab37f7e5 100644 --- a/packages/check-date-http/Makefile +++ b/packages/check-date-http/Makefile @@ -19,7 +19,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh MAINTAINER:=Gioacchino Mazzurco URL:=http://libremesh.org - DEPENDS:=+libuci-lua +lua +random-numgen \ + DEPENDS:=+libuci-lua +lua \ +luci-lib-httpclient PKGARCH:=all endef diff --git a/packages/check-date-http/files/etc/uci-defaults/check-date-http-cron b/packages/check-date-http/files/etc/uci-defaults/check-date-http-cron index 1dc3b4557..5ed89ddaa 100755 --- a/packages/check-date-http/files/etc/uci-defaults/check-date-http-cron +++ b/packages/check-date-http/files/etc/uci-defaults/check-date-http-cron @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '*/20 * * * * ((sleep $(($(random-numgen) % 600)); check-date-http &> /dev/null)&)'\ + '*/20 * * * * ((sleep $((RANDOM % 600)); check-date-http &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/eupgrade/Makefile b/packages/eupgrade/Makefile index fab7708d3..1e51b5fcd 100644 --- a/packages/eupgrade/Makefile +++ b/packages/eupgrade/Makefile @@ -11,7 +11,7 @@ define Package/$(PKG_NAME) CATEGORY:=Utilities TITLE:=$(PKG_NAME) provides semi automated firmware upgrades MAINTAINER:=Santiago Piccinini - DEPENDS:=+lua +lime-system +luci-lib-jsonc +luci-lib-nixio +libubus-lua +libuci-lua +random-numgen + DEPENDS:=+lua +lime-system +luci-lib-jsonc +luci-lib-nixio +libubus-lua +libuci-lua PKGARCH:=all endef diff --git a/packages/eupgrade/files/etc/uci-defaults/99-eupgrades-cron b/packages/eupgrade/files/etc/uci-defaults/99-eupgrades-cron index e1931c549..8afc37818 100755 --- a/packages/eupgrade/files/etc/uci-defaults/99-eupgrades-cron +++ b/packages/eupgrade/files/etc/uci-defaults/99-eupgrades-cron @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '0 */6 * * * ((sleep $(($(random-numgen) % 120)); eupgrade-check &> /dev/null)&)'\ + '0 */6 * * * ((sleep $((RANDOM % 120)); eupgrade-check &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/hotplug-initd-services/Makefile b/packages/hotplug-initd-services/Makefile index e2bbecda1..be1fb06ab 100644 --- a/packages/hotplug-initd-services/Makefile +++ b/packages/hotplug-initd-services/Makefile @@ -19,7 +19,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh MAINTAINER:=Gioacchino Mazzurco URL:=http://libremesh.org - DEPENDS:=+libubox-lua +libubus-lua +random-numgen \ + DEPENDS:=+libubox-lua +libubus-lua \ +lua +luci-lib-nixio PKGARCH:=all endef 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 index 5cba2a6fa..2ad5ee2f1 100755 --- 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 @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state-multiwriter sync reference_state_nodes_info &> /dev/null)&)'\ + '*/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 index d71d2b4c5..87731d618 100644 --- 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 @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state-multiwriter sync reference_state_wifi_links_info &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state-multiwriter sync reference_state_wifi_links_info &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/lime-docs/files/www/docs/lime-example.txt b/packages/lime-docs/files/www/docs/lime-example.txt index 0f88dbda8..15659d107 100644 --- a/packages/lime-docs/files/www/docs/lime-example.txt +++ b/packages/lime-docs/files/www/docs/lime-example.txt @@ -224,9 +224,9 @@ config net wirelessclientbackbone # list protocols 'wan' # Some of these protocols require the relative package "lime-proto-..." # list protocols 'static' # Set up a static IP (both IPv4 and IPv6 supported) # option static_ipv4 '192.168.1.2/24' -# option static_gateway_ipv4 '192.168.1.1' +# option static_gateway_ipv4 '192.168.1.1' # in static protocol, specifying an IP for the gateway is optional. Skip this line if no default route should be added on this interface. # option static_ipv6 '2a00:1508:0a00::1234/64' -# option static_gateway_ipv6 'fe80::1' +# option static_gateway_ipv6 'fe80::1' # in static protocol, specifying an IP for the gateway is optional. Skip this line if no default route should be added on this interface. ## (optional) configure lan1 for connection to other nodes, not for users connection: config net diff --git a/packages/shared-state-async/Makefile b/packages/shared-state-async/Makefile index 1086d27f5..a2686614f 100644 --- a/packages/shared-state-async/Makefile +++ b/packages/shared-state-async/Makefile @@ -29,7 +29,7 @@ PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/libremesh/shared-state-async.git -PKG_SOURCE_VERSION:=575a4774a5fa38e6d5549e08e217f6299dc16742 +PKG_SOURCE_VERSION:=db58e3d16e8658417956f9bb42e7e87f6aadcd4d PKG_MAINTAINER:=Asociación Civil Altermundi PKG_LICENSE:=AGPL-3.0 diff --git a/packages/shared-state-async/README.adoc b/packages/shared-state-async/README.adoc index 6d7535708..3359017c7 100644 --- a/packages/shared-state-async/README.adoc +++ b/packages/shared-state-async/README.adoc @@ -47,3 +47,24 @@ https://openwrt.org/docs/guide-developer/gdb VoCore2: Develop for OpenWrt on Qt Creator https://vonger.cn/?p=14657 +=== Plugin related notes +Plugins must be registered into shared-state-async by using the config file. UCI infrastructure is preferred + +[source,console] +-------------------------------------------------------------------------------- +mSc="plugin_name" + +uci set shared-state.${mSc}=dataType +uci set shared-state.${mSc}.name='plugin-name' +uci set shared-state.${mSc}.scope='community' +uci set shared-state.${mSc}.ttl='1200' +uci set shared-state.${mSc}.update_interval='120' +uci commit shared-state +-------------------------------------------------------------------------------- + +Publishers must be located at +/usr/share/shared-state/publishers+ +All Publishers will be called at least once using shared-state-async-publish-all + +Sync is called automatically by shared-state-async according to "update_interval" parameter +"ttl" stands for "time to live" and will decrease until 0. +Data contents will be erased if "ttl" reaches 0. diff --git a/packages/shared-state-async/files/etc/init.d/shared-state-async b/packages/shared-state-async/files/etc/init.d/shared-state-async index c8949a51d..d99d2bf4f 100755 --- a/packages/shared-state-async/files/etc/init.d/shared-state-async +++ b/packages/shared-state-async/files/etc/init.d/shared-state-async @@ -31,4 +31,7 @@ start_service() procd_set_param stderr 1 procd_set_param term_timeout 10 procd_close_instance + + #wait 10 secconds in detached mode and call publishres + ((sleep 10; shared-state-async-publish-all)&) } diff --git a/packages/shared-state-async/files/etc/uci-defaults/shared-state-net_stats-cron b/packages/shared-state-async/files/etc/uci-defaults/shared-state-net_stats-cron index c653162db..274ab3143 100755 --- a/packages/shared-state-async/files/etc/uci-defaults/shared-state-net_stats-cron +++ b/packages/shared-state-async/files/etc/uci-defaults/shared-state-net_stats-cron @@ -15,5 +15,5 @@ uci set shared-state.${mSc}.update_interval='120' uci commit shared-state unique_append \ - '*/3 * * * * ((sleep $(($RANDOM % 120)); shared-state-async insert net-stats < /tmp/shared-state/network_statistics.json &> /dev/null)&)' \ + '*/3 * * * * ((sleep $((RANDOM % 120)); shared-state-async insert net-stats < /tmp/shared-state/network_statistics.json &> /dev/null)&)' \ /etc/crontabs/root diff --git a/packages/shared-state-async/files/etc/uci-defaults/shared-state-publish-all-cron b/packages/shared-state-async/files/etc/uci-defaults/shared-state-publish-all-cron new file mode 100755 index 000000000..6587e50d4 --- /dev/null +++ b/packages/shared-state-async/files/etc/uci-defaults/shared-state-publish-all-cron @@ -0,0 +1,10 @@ +#!/bin/sh + +unique_append() +{ + grep -qF "$1" "$2" || echo "$1" >> "$2" +} + +unique_append \ + '*/30 * * * * ((sleep $((RANDOM % 120)); shared-state-async-publish-all &> /dev/null)&)' \ + /etc/crontabs/root diff --git a/packages/shared-state-async/files/usr/bin/shared-state-async-publish-all b/packages/shared-state-async/files/usr/bin/shared-state-async-publish-all new file mode 100755 index 000000000..651f8685b --- /dev/null +++ b/packages/shared-state-async/files/usr/bin/shared-state-async-publish-all @@ -0,0 +1,5 @@ +#!/bin/sh + +for publisher in /usr/share/shared-state/publishers/* ; do + [ -x "$publisher" ] && "$publisher"; +done diff --git a/packages/shared-state-async/files/usr/libexec/rpcd/shared-state-async b/packages/shared-state-async/files/usr/libexec/rpcd/shared-state-async index fdcb6ed04..1dac5b03c 100755 --- a/packages/shared-state-async/files/usr/libexec/rpcd/shared-state-async +++ b/packages/shared-state-async/files/usr/libexec/rpcd/shared-state-async @@ -11,7 +11,7 @@ sinc_args="" case "$1" in list) - echo '{ "sync": { "data_type": "str", "peers_ip": "str" }, "get": { "data_type": "str" } }' + echo '{ "sync": { "data_type": "str", "peers_ip": "str" }, "get": { "data_type": "str" }, "publish": { "data_type": "str" }, "publish_all": { } }' ;; call) # source jshn shell library @@ -33,6 +33,14 @@ case "$1" in shared-state-async sync $data_type ${peers_ip//,/ } > /dev/null 2>&1 echo {\"data\": {} , \"error\": $? } ;; + publish) + /usr/share/shared-state/publishers/shared-state-publish_$data_type > /dev/null 2>&1 + echo {\"data\": {} , \"error\": $? } + ;; + publish_all) + shared-state-async-publish-all > /dev/null 2>&1 + echo {\"data\": {} , \"error\": $? } + ;; *) echo '{\"data\" {} ,\"error\" = "Method not found"}' ;; diff --git a/packages/shared-state-babel_links_info/Makefile b/packages/shared-state-babel_links_info/Makefile index 73ea636c1..6b3fb1228 100644 --- a/packages/shared-state-babel_links_info/Makefile +++ b/packages/shared-state-babel_links_info/Makefile @@ -12,7 +12,7 @@ define Package/$(PKG_NAME) TITLE:=Babel links module for shared-state MAINTAINER:=Asociación Civil Altermundi DEPENDS:=+lua +luci-lib-jsonc +ubus-lime-utils \ - +libubus-lua +random-numgen shared-state-async + +libubus-lua shared-state-async PKGARCH:=all endef diff --git a/packages/shared-state-babel_links_info/files/etc/shared-state/publishers/shared-state-publish_babel_links_info b/packages/shared-state-babel_links_info/files/etc/shared-state/publishers/shared-state-publish_babel_links_info deleted file mode 120000 index c11b29137..000000000 --- a/packages/shared-state-babel_links_info/files/etc/shared-state/publishers/shared-state-publish_babel_links_info +++ /dev/null @@ -1 +0,0 @@ -../../../usr/bin/shared-state-publish_babel_links_info \ No newline at end of file diff --git a/packages/shared-state-babel_links_info/files/etc/uci-defaults/shared-state_babel_links_info b/packages/shared-state-babel_links_info/files/etc/uci-defaults/shared-state_babel_links_info index 599d8cf9b..372624d4a 100755 --- a/packages/shared-state-babel_links_info/files/etc/uci-defaults/shared-state_babel_links_info +++ b/packages/shared-state-babel_links_info/files/etc/uci-defaults/shared-state_babel_links_info @@ -12,6 +12,3 @@ uci set shared-state.babel_links_info.ttl='2400' uci set shared-state.babel_links_info.update_interval='30' uci commit shared-state -unique_append \ - '*/30 * * * * ((sleep $(($RANDOM % 120)); shared-state-publish_babel_links_info &> /dev/null)&)' \ - /etc/crontabs/root diff --git a/packages/shared-state-babel_links_info/files/usr/bin/shared-state-publish_babel_links_info b/packages/shared-state-babel_links_info/files/usr/share/shared-state/publishers/shared-state-publish_babel_links_info similarity index 100% rename from packages/shared-state-babel_links_info/files/usr/bin/shared-state-publish_babel_links_info rename to packages/shared-state-babel_links_info/files/usr/share/shared-state/publishers/shared-state-publish_babel_links_info diff --git a/packages/shared-state-babel_links_info/tests/test_shared-state-babel_links_info.lua b/packages/shared-state-babel_links_info/tests/test_shared-state-babel_links_info.lua index 0ea931008..5dff885fa 100644 --- a/packages/shared-state-babel_links_info/tests/test_shared-state-babel_links_info.lua +++ b/packages/shared-state-babel_links_info/tests/test_shared-state-babel_links_info.lua @@ -27,7 +27,7 @@ describe('Tests network_nodes #network_nodes', function() end) it('a simple test to get babel info and assert requiered fields are present', function() - package.path = package.path .. ";packages/shared-state-babel_links_info/files/usr/bin/?;;" + package.path = package.path .. ";packages/shared-state-babel_links_info/files/usr/share/shared-state/publishers/?;;" require("shared-state-publish_babel_links_info") babelinfo = get_babel_links_info() diff --git a/packages/shared-state-babeld_hosts/Makefile b/packages/shared-state-babeld_hosts/Makefile index e409b6886..070450e84 100644 --- a/packages/shared-state-babeld_hosts/Makefile +++ b/packages/shared-state-babeld_hosts/Makefile @@ -19,7 +19,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh MAINTAINER:=Gioacchino Mazzurco URL:=http://libremesh.org - DEPENDS:=+hotplug-initd-services +random-numgen \ + DEPENDS:=+hotplug-initd-services \ +lua +luci-lib-jsonc shared-state PKGARCH:=all endef diff --git a/packages/shared-state-babeld_hosts/files/etc/uci-defaults/shared-state-babeld_hosts-cron b/packages/shared-state-babeld_hosts/files/etc/uci-defaults/shared-state-babeld_hosts-cron index 9ecd8db66..cc30b458e 100755 --- a/packages/shared-state-babeld_hosts/files/etc/uci-defaults/shared-state-babeld_hosts-cron +++ b/packages/shared-state-babeld_hosts/files/etc/uci-defaults/shared-state-babeld_hosts-cron @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($(random-numgen) % 120)); shared-state sync babeld-hosts &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state sync babeld-hosts &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/shared-state-bat_hosts/Makefile b/packages/shared-state-bat_hosts/Makefile index defd8b5eb..6a8508bd8 100644 --- a/packages/shared-state-bat_hosts/Makefile +++ b/packages/shared-state-bat_hosts/Makefile @@ -20,7 +20,7 @@ define Package/$(PKG_NAME) MAINTAINER:=Asociación Civil Altermundi URL:=http://libremesh.org DEPENDS:=+libubus-lua +lime-system +lua +luci-lib-jsonc +luci-lib-nixio \ - shared-state-async + +shared-state-async PKGARCH:=all endef diff --git a/packages/shared-state-bat_hosts/files/etc/hotplug.d/iface/shared-state-bat_hosts.sh b/packages/shared-state-bat_hosts/files/etc/hotplug.d/iface/shared-state-bat_hosts.sh index 7ed4a9666..40ab79aa9 100755 --- a/packages/shared-state-bat_hosts/files/etc/hotplug.d/iface/shared-state-bat_hosts.sh +++ b/packages/shared-state-bat_hosts/files/etc/hotplug.d/iface/shared-state-bat_hosts.sh @@ -1,2 +1,2 @@ #!/bin/sh -[ "x$ACTION" == "xifup" ] && ((sleep 30; shared-state-publish_bat_hosts; shared-state-async sync bat-hosts)&) +[ "x$ACTION" == "xifup" ] && ((sleep 30; /usr/share/shared-state/publishers/shared-state-publish_bat_hosts)&) diff --git a/packages/shared-state-bat_hosts/files/etc/uci-defaults/shared-state-bat_hosts-cron b/packages/shared-state-bat_hosts/files/etc/uci-defaults/shared-state-bat_hosts-cron index 817759679..d1efbe5d3 100755 --- a/packages/shared-state-bat_hosts/files/etc/uci-defaults/shared-state-bat_hosts-cron +++ b/packages/shared-state-bat_hosts/files/etc/uci-defaults/shared-state-bat_hosts-cron @@ -12,6 +12,3 @@ uci set shared-state.bat_hosts.ttl='2400' uci set shared-state.bat_hosts.update_interval='30' uci commit shared-state -unique_append \ - '*/30 * * * * ((sleep $(($RANDOM % 120)); shared-state-publish_bat_hosts &> /dev/null)&)' \ - /etc/crontabs/root diff --git a/packages/shared-state-bat_hosts/files/usr/bin/shared-state-publish_bat_hosts b/packages/shared-state-bat_hosts/files/usr/share/shared-state/publishers/shared-state-publish_bat_hosts similarity index 100% rename from packages/shared-state-bat_hosts/files/usr/bin/shared-state-publish_bat_hosts rename to packages/shared-state-bat_hosts/files/usr/share/shared-state/publishers/shared-state-publish_bat_hosts diff --git a/packages/shared-state-bat_links_info/files/etc/hotplug.d/iface/shared-state-bat_links.sh b/packages/shared-state-bat_links_info/files/etc/hotplug.d/iface/shared-state-bat_links.sh new file mode 100755 index 000000000..3634563f5 --- /dev/null +++ b/packages/shared-state-bat_links_info/files/etc/hotplug.d/iface/shared-state-bat_links.sh @@ -0,0 +1,2 @@ +#!/bin/sh +[ "x$ACTION" == "xifup" ] && ((sleep 30; /usr/share/shared-state/publishers/shared-state-publish_bat_links)&) diff --git a/packages/shared-state-bat_links_info/files/etc/shared-state/publishers/shared-state-publish_bat_links_info b/packages/shared-state-bat_links_info/files/etc/shared-state/publishers/shared-state-publish_bat_links_info deleted file mode 120000 index 895385186..000000000 --- a/packages/shared-state-bat_links_info/files/etc/shared-state/publishers/shared-state-publish_bat_links_info +++ /dev/null @@ -1 +0,0 @@ -../../../usr/bin/shared-state-publish_bat_links_info \ No newline at end of file diff --git a/packages/shared-state-bat_links_info/files/etc/uci-defaults/shared-state_bat_links_info_cron b/packages/shared-state-bat_links_info/files/etc/uci-defaults/shared-state_bat_links_info_cron index c725f7168..e31bbaf38 100755 --- a/packages/shared-state-bat_links_info/files/etc/uci-defaults/shared-state_bat_links_info_cron +++ b/packages/shared-state-bat_links_info/files/etc/uci-defaults/shared-state_bat_links_info_cron @@ -11,7 +11,3 @@ uci set shared-state.bat_links_info.scope='community' uci set shared-state.bat_links_info.ttl='2400' uci set shared-state.bat_links_info.update_interval='30' uci commit shared-state - -unique_append \ - '*/30 * * * * ((sleep $(($RANDOM % 120)); shared-state-publish_bat_links_info &> /dev/null)&)' \ - /etc/crontabs/root diff --git a/packages/shared-state-bat_links_info/files/usr/bin/shared-state-publish_bat_links_info b/packages/shared-state-bat_links_info/files/usr/share/shared-state/publishers/shared-state-publish_bat_links_info similarity index 100% rename from packages/shared-state-bat_links_info/files/usr/bin/shared-state-publish_bat_links_info rename to packages/shared-state-bat_links_info/files/usr/share/shared-state/publishers/shared-state-publish_bat_links_info diff --git a/packages/shared-state-bat_links_info/tests/test_shared-state-bat_links_info.lua b/packages/shared-state-bat_links_info/tests/test_shared-state-bat_links_info.lua index 2dc3c7e42..d1b6045bd 100644 --- a/packages/shared-state-bat_links_info/tests/test_shared-state-bat_links_info.lua +++ b/packages/shared-state-bat_links_info/tests/test_shared-state-bat_links_info.lua @@ -189,7 +189,7 @@ describe('Tests bat_links_info #bat_links_info', function () return iwinfo.mocks.wlan1_mesh_mac end) - package.path = package.path .. ";packages/shared-state-bat_links_info/files/usr/bin/?;;" + package.path = package.path .. ";packages/shared-state-bat_links_info/files/usr/share/shared-state/publishers/?;;" require ("shared-state-publish_bat_links_info") it('a simple test to get node info and assert requiered fields are present', function() diff --git a/packages/shared-state-dnsmasq_hosts/Makefile b/packages/shared-state-dnsmasq_hosts/Makefile index 010c253ac..e4881f908 100644 --- a/packages/shared-state-dnsmasq_hosts/Makefile +++ b/packages/shared-state-dnsmasq_hosts/Makefile @@ -19,7 +19,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh MAINTAINER:=Gioacchino Mazzurco URL:=http://libremesh.org - DEPENDS:=+lua +luci-lib-jsonc +random-numgen \ + DEPENDS:=+lua +luci-lib-jsonc \ shared-state PKGARCH:=all endef diff --git a/packages/shared-state-dnsmasq_hosts/files/etc/uci-defaults/shared-state-dnsmasq_hosts-cron b/packages/shared-state-dnsmasq_hosts/files/etc/uci-defaults/shared-state-dnsmasq_hosts-cron index 63a2803ed..7b69e3d61 100755 --- a/packages/shared-state-dnsmasq_hosts/files/etc/uci-defaults/shared-state-dnsmasq_hosts-cron +++ b/packages/shared-state-dnsmasq_hosts/files/etc/uci-defaults/shared-state-dnsmasq_hosts-cron @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($(random-numgen) % 120)); shared-state sync dnsmasq-hosts &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state sync dnsmasq-hosts &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/shared-state-dnsmasq_leases/Makefile b/packages/shared-state-dnsmasq_leases/Makefile index 09f0f04f0..422fa3a51 100644 --- a/packages/shared-state-dnsmasq_leases/Makefile +++ b/packages/shared-state-dnsmasq_leases/Makefile @@ -19,7 +19,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh MAINTAINER:=Gioacchino Mazzurco URL:=http://libremesh.org - DEPENDS:=+libuci-lua +lua +random-numgen \ + DEPENDS:=+libuci-lua +lua \ +luci-lib-jsonc shared-state +shared-state-dnsmasq_hosts \ +luci-lib-nixio PKGARCH:=all diff --git a/packages/shared-state-dnsmasq_leases/files/etc/uci-defaults/90_dnsmasq-lease-share b/packages/shared-state-dnsmasq_leases/files/etc/uci-defaults/90_dnsmasq-lease-share index 701f85121..3e9e8eb4a 100755 --- a/packages/shared-state-dnsmasq_leases/files/etc/uci-defaults/90_dnsmasq-lease-share +++ b/packages/shared-state-dnsmasq_leases/files/etc/uci-defaults/90_dnsmasq-lease-share @@ -12,7 +12,7 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($(random-numgen) % 120)); shared-state sync dnsmasq-leases &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state sync dnsmasq-leases &> /dev/null)&)'\ /etc/crontabs/root exit 0 diff --git a/packages/shared-state-dnsmasq_servers/Makefile b/packages/shared-state-dnsmasq_servers/Makefile index 1223e6daa..70d21a2dd 100644 --- a/packages/shared-state-dnsmasq_servers/Makefile +++ b/packages/shared-state-dnsmasq_servers/Makefile @@ -19,7 +19,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh MAINTAINER:=Gui iribarren URL:=http://libremesh.org - DEPENDS:=+lua +luci-lib-jsonc +random-numgen \ + DEPENDS:=+lua +luci-lib-jsonc \ shared-state PKGARCH:=all endef diff --git a/packages/shared-state-dnsmasq_servers/files/etc/uci-defaults/shared-state-dnsmasq_servers b/packages/shared-state-dnsmasq_servers/files/etc/uci-defaults/shared-state-dnsmasq_servers index 7adb6d63f..9271b1d92 100755 --- a/packages/shared-state-dnsmasq_servers/files/etc/uci-defaults/shared-state-dnsmasq_servers +++ b/packages/shared-state-dnsmasq_servers/files/etc/uci-defaults/shared-state-dnsmasq_servers @@ -10,5 +10,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($(random-numgen) % 120)); shared-state sync dnsmasq-servers &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state sync dnsmasq-servers &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/shared-state-network_nodes/Makefile b/packages/shared-state-network_nodes/Makefile index b6158d2ad..88a91e40c 100644 --- a/packages/shared-state-network_nodes/Makefile +++ b/packages/shared-state-network_nodes/Makefile @@ -11,7 +11,7 @@ define Package/$(PKG_NAME) 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 + +libubus-lua PKGARCH:=all endef diff --git a/packages/shared-state-network_nodes/files/etc/uci-defaults/shared-state-network_nodes-cron b/packages/shared-state-network_nodes/files/etc/uci-defaults/shared-state-network_nodes-cron index dc67e2c8b..595db4ad5 100644 --- a/packages/shared-state-network_nodes/files/etc/uci-defaults/shared-state-network_nodes-cron +++ b/packages/shared-state-network_nodes/files/etc/uci-defaults/shared-state-network_nodes-cron @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($(random-numgen) % 120)); shared-state-multiwriter sync network_nodes &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state-multiwriter sync network_nodes &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/shared-state-node_info/files/etc/uci-defaults/shared-state_node_info_cron b/packages/shared-state-node_info/files/etc/uci-defaults/shared-state_node_info_cron index 27132a824..e898e45d2 100755 --- a/packages/shared-state-node_info/files/etc/uci-defaults/shared-state_node_info_cron +++ b/packages/shared-state-node_info/files/etc/uci-defaults/shared-state_node_info_cron @@ -5,5 +5,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state sync node_info &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state sync node_info &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/shared-state-nodes_and_links/Makefile b/packages/shared-state-nodes_and_links/Makefile index 6d44bdabc..c17ad8477 100644 --- a/packages/shared-state-nodes_and_links/Makefile +++ b/packages/shared-state-nodes_and_links/Makefile @@ -19,7 +19,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh MAINTAINER:=Nicolas Pace URL:=http://libremesh.org - DEPENDS:=+lua +luci-lib-jsonc +random-numgen \ + DEPENDS:=+lua +luci-lib-jsonc \ shared-state +ubus-lime-location PKGARCH:=all endef diff --git a/packages/shared-state-nodes_and_links/files/etc/uci-defaults/shared-state-bat_nodes_and_links b/packages/shared-state-nodes_and_links/files/etc/uci-defaults/shared-state-bat_nodes_and_links index 27a449ee4..05b76dad3 100755 --- a/packages/shared-state-nodes_and_links/files/etc/uci-defaults/shared-state-bat_nodes_and_links +++ b/packages/shared-state-nodes_and_links/files/etc/uci-defaults/shared-state-bat_nodes_and_links @@ -6,5 +6,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($(random-numgen) % 120)); shared-state sync nodes_and_links &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state sync nodes_and_links &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/shared-state-pirania/Makefile b/packages/shared-state-pirania/Makefile index 86f6cf843..c79d1a2db 100644 --- a/packages/shared-state-pirania/Makefile +++ b/packages/shared-state-pirania/Makefile @@ -19,7 +19,7 @@ define Package/$(PKG_NAME) CATEGORY:=LibreMesh MAINTAINER:=Asociación Civil AlterMundi URL:=http://libremesh.org - DEPENDS:=+lua +luci-lib-jsonc +random-numgen shared-state + DEPENDS:=+lua +luci-lib-jsonc shared-state PKGARCH:=all endef diff --git a/packages/shared-state-pirania/files/etc/uci-defaults/90-pirania-cron b/packages/shared-state-pirania/files/etc/uci-defaults/90-pirania-cron index 0522035de..79bc62afd 100755 --- a/packages/shared-state-pirania/files/etc/uci-defaults/90-pirania-cron +++ b/packages/shared-state-pirania/files/etc/uci-defaults/90-pirania-cron @@ -6,7 +6,7 @@ unique_append() } unique_append \ - '*/2 * * * * ((sleep $(($(random-numgen) % 30)); /etc/shared-state/publishers/shared-state-publish_vouchers && shared-state sync pirania-vouchers &> /dev/null)&)'\ + '*/2 * * * * ((sleep $((RANDOM % 30)); /etc/shared-state/publishers/shared-state-publish_vouchers && shared-state sync pirania-vouchers &> /dev/null)&)'\ /etc/crontabs/root exit 0 diff --git a/packages/shared-state-wifi_links_info/files/etc/uci-defaults/shared-state_wifi_links_info b/packages/shared-state-wifi_links_info/files/etc/uci-defaults/shared-state_wifi_links_info index 483e0ab4f..061669265 100755 --- a/packages/shared-state-wifi_links_info/files/etc/uci-defaults/shared-state_wifi_links_info +++ b/packages/shared-state-wifi_links_info/files/etc/uci-defaults/shared-state_wifi_links_info @@ -5,5 +5,5 @@ unique_append() } unique_append \ - '*/5 * * * * ((sleep $(($RANDOM % 120)); shared-state sync wifi_links_info &> /dev/null)&)'\ + '*/5 * * * * ((sleep $((RANDOM % 120)); shared-state sync wifi_links_info &> /dev/null)&)'\ /etc/crontabs/root diff --git a/packages/shared-state/Makefile b/packages/shared-state/Makefile index 971081768..b377ddbc0 100644 --- a/packages/shared-state/Makefile +++ b/packages/shared-state/Makefile @@ -20,7 +20,7 @@ define Package/$(PKG_NAME) MAINTAINER:=Gioacchino Mazzurco URL:=http://libremesh.org DEPENDS:=+libuci-lua +lime-system +lua +luci-lib-jsonc +luci-lib-nixio \ - +iputils-ping +uclient-fetch +random-numgen + +iputils-ping +uclient-fetch PKGARCH:=all endef diff --git a/packages/shared-state/files/etc/uci-defaults/shared-state-publishers-cron b/packages/shared-state/files/etc/uci-defaults/shared-state-publishers-cron index c1fbde161..4ea7e7508 100755 --- a/packages/shared-state/files/etc/uci-defaults/shared-state-publishers-cron +++ b/packages/shared-state/files/etc/uci-defaults/shared-state-publishers-cron @@ -6,7 +6,7 @@ unique_append() } unique_append \ - '*/30 * * * * ((sleep $(($(random-numgen) % 1000)); shared-state-publish-all &> /dev/null)&)'\ + '*/30 * * * * ((sleep $((RANDOM % 1000)); shared-state-publish-all &> /dev/null)&)'\ /etc/crontabs/root unique_append \ diff --git a/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh b/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh index 1f9593921..d4aa72dac 100755 --- a/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh +++ b/packages/shared-state/files/usr/bin/shared-state-get_candidates_neigh @@ -20,7 +20,7 @@ lastRunFile="/tmp/shared-state-get_candidates_neigh.lastrun" lastRun=$(if [ -s $lastRunFile ]; then echo $(cat $lastRunFile); else echo -9999; fi) currUptime="$(get_uptime)" -[ "$(($currUptime - $lastRun))" -lt "30" ] && +[ "$((currUptime - lastRun))" -lt "30" ] && { cat "$cacheFile" exit 0