Skip to content
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
4 changes: 2 additions & 2 deletions net/prplmesh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=prplmesh
PKG_VERSION:=6.0.1
PKG_RELEASE:=2
PKG_RELEASE:=3

PKG_SOURCE:=prplMesh-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://gitlab.com/prpl-foundation/prplmesh/prplMesh/-/archive/$(PKG_VERSION)/
Expand All @@ -25,7 +25,7 @@ define Package/prplmesh
CATEGORY:=Network
TITLE:=prplMesh controller and agent for stock OpenWrt
URL:=https://gitlab.com/prpl-foundation/prplmesh/prplMesh
DEPENDS:=+libstdcpp +libpthread +librt +libjson-c +libopenssl +libnl-core +libnl-genl +libnl-route +libuci +libubus +libubox
DEPENDS:=+libstdcpp +libpthread +librt +libjson-c +libopenssl +libnl-core +libnl-genl +libnl-route +libuci +libubus +libubox +getopt
endef

define Package/prplmesh/description
Expand Down
24 changes: 24 additions & 0 deletions net/prplmesh/files/prplmesh.init
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ STOP=10
USE_PROCD=1

PRPLMESH_DIR=/usr/libexec/prplmesh
LOG_ROLL_INTERVAL_SECONDS=86400

enabled() {
[ "$(uci -q get prplmesh.config.enabled)" = "1" ]
Expand All @@ -23,6 +24,28 @@ register_process() {
procd_close_instance
}

register_log_roller() {
local helper="$PRPLMESH_DIR/scripts/prplmesh_utils.sh"

[ -x "$helper" ] || {
logger -t prplmesh "log-roll helper is missing or not executable"
return 1
}

procd_open_instance log-roller
# shellcheck disable=SC2016
procd_set_param command /bin/sh -c '
helper=$1
interval=$2
while sleep "$interval"; do
"$helper" roll_logs || logger -t prplmesh "log roll failed"
done' sh "$helper" "$LOG_ROLL_INTERVAL_SECONDS"
procd_set_param respawn 3600 5 5
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}

start_service() {
local mode need_agent=1 need_controller=1

Expand Down Expand Up @@ -60,6 +83,7 @@ start_service() {
fi

register_process transport "$PRPLMESH_DIR/bin/ieee1905_transport"
register_log_roller || return 1

if [ "$need_controller" = 1 ]; then
register_process controller "$PRPLMESH_DIR/bin/beerocks_controller"
Expand Down
11 changes: 11 additions & 0 deletions net/prplmesh/patches/161-openwrt-log-roll-helper.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/common/beerocks/scripts/prplmesh_utils.sh.in
+++ b/common/beerocks/scripts/prplmesh_utils.sh.in
@@ -165,7 +165,7 @@ stop_func() {

main() {
case "${TARGET_PLATFORM}" in
- linux|rdkb)
+ linux|rdkb|openwrt)
Comment thread
krotname marked this conversation as resolved.
;;
*)
echo "Unsupported platform: ${TARGET_PLATFORM}" >&2
4 changes: 4 additions & 0 deletions net/prplmesh/test-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ prplmesh)
grep -Fx 'log_global_syslog_levels=error,info,warning,fatal' "$config"
done
test -x /usr/libexec/prplmesh/scripts/prplmesh_utils.sh
/usr/libexec/prplmesh/scripts/prplmesh_utils.sh -h >/dev/null
grep -F 'register_log_roller || return 1' /etc/init.d/prplmesh
# shellcheck disable=SC2016
grep -F '"$helper" roll_logs || logger -t prplmesh "log roll failed"' /etc/init.d/prplmesh
;;
*)
echo "Untested package: $PKG_NAME" >&2
Expand Down