Skip to content

Commit

Permalink
Merge pull request #1117 from ilario/use-busybox-RANDOM
Browse files Browse the repository at this point in the history
Stop using random-numgen, not needed in recent OpenWrt
  • Loading branch information
G10h4ck authored Aug 1, 2024
2 parents 4bdd010 + 523aaa0 commit a3d751c
Show file tree
Hide file tree
Showing 30 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion packages/check-date-http/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Gioacchino Mazzurco <[email protected]>
URL:=http://libremesh.org
DEPENDS:=+libuci-lua +lua +random-numgen \
DEPENDS:=+libuci-lua +lua \
+luci-lib-httpclient
PKGARCH:=all
endef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/eupgrade/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Utilities
TITLE:=$(PKG_NAME) provides semi automated firmware upgrades
MAINTAINER:=Santiago Piccinini <[email protected]>
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

Expand Down
2 changes: 1 addition & 1 deletion packages/eupgrade/files/etc/uci-defaults/99-eupgrades-cron
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/hotplug-initd-services/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Gioacchino Mazzurco <[email protected]>
URL:=http://libremesh.org
DEPENDS:=+libubox-lua +libubus-lua +random-numgen \
DEPENDS:=+libubox-lua +libubus-lua \
+lua +luci-lib-nixio
PKGARCH:=all
endef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ unique_append()
}

unique_append \
'*/30 * * * * ((sleep $(($RANDOM % 120)); shared-state-async-publish-all &> /dev/null)&)' \
'*/30 * * * * ((sleep $((RANDOM % 120)); shared-state-async-publish-all &> /dev/null)&)' \
/etc/crontabs/root
2 changes: 1 addition & 1 deletion packages/shared-state-babel_links_info/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ define Package/$(PKG_NAME)
TITLE:=Babel links module for shared-state
MAINTAINER:=Asociación Civil Altermundi <[email protected]>
DEPENDS:=+lua +luci-lib-jsonc +ubus-lime-utils \
+libubus-lua +random-numgen shared-state-async
+libubus-lua shared-state-async
PKGARCH:=all
endef

Expand Down
2 changes: 1 addition & 1 deletion packages/shared-state-babeld_hosts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Gioacchino Mazzurco <[email protected]>
URL:=http://libremesh.org
DEPENDS:=+hotplug-initd-services +random-numgen \
DEPENDS:=+hotplug-initd-services \
+lua +luci-lib-jsonc shared-state
PKGARCH:=all
endef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/shared-state-dnsmasq_hosts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Gioacchino Mazzurco <[email protected]>
URL:=http://libremesh.org
DEPENDS:=+lua +luci-lib-jsonc +random-numgen \
DEPENDS:=+lua +luci-lib-jsonc \
shared-state
PKGARCH:=all
endef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/shared-state-dnsmasq_leases/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Gioacchino Mazzurco <[email protected]>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/shared-state-dnsmasq_servers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Gui iribarren <[email protected]>
URL:=http://libremesh.org
DEPENDS:=+lua +luci-lib-jsonc +random-numgen \
DEPENDS:=+lua +luci-lib-jsonc \
shared-state
PKGARCH:=all
endef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/shared-state-network_nodes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
DEPENDS:=+shared-state +shared-state-nodes_and_links +lime-system +luci-lib-jsonc \
+libubus-lua +random-numgen
+libubus-lua
PKGARCH:=all
endef

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/shared-state-nodes_and_links/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Nicolas Pace <[email protected]>
URL:=http://libremesh.org
DEPENDS:=+lua +luci-lib-jsonc +random-numgen \
DEPENDS:=+lua +luci-lib-jsonc \
shared-state +ubus-lime-location
PKGARCH:=all
endef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/shared-state-pirania/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
MAINTAINER:=Asociación Civil AlterMundi <[email protected]>
URL:=http://libremesh.org
DEPENDS:=+lua +luci-lib-jsonc +random-numgen shared-state
DEPENDS:=+lua +luci-lib-jsonc shared-state
PKGARCH:=all
endef

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion packages/shared-state/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ define Package/$(PKG_NAME)
MAINTAINER:=Gioacchino Mazzurco <[email protected]>
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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a3d751c

Please sign in to comment.