feat(agent): package stable Go runtime for OpenWrt

This commit is contained in:
benya
2026-07-21 00:20:48 +03:00
parent e6236f505c
commit 01e0350cde
18 changed files with 461 additions and 38 deletions
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=rmm-agent-go-production
PKG_VERSION:=0.5.0
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_MAINTAINER:=RMM OpenWrt
PKG_LICENSE:=MIT
@@ -14,6 +14,8 @@ define Package/rmm-agent-go-production
CATEGORY:=Administration
TITLE:=OpenWrt RMM Go agent (production replacement)
DEPENDS:=+ca-bundle +ip-tiny +iwinfo +openssh-client +openssh-keygen
PROVIDES:=rmm-agent-runtime
CONFLICTS:=rmm-agent
endef
define Package/rmm-agent-go-production/description
@@ -6,6 +6,29 @@ USE_PROCD=1
PROG=/usr/bin/rmm-agent
CONFIG_FILE=/etc/rmm-agent.conf
DEFAULT_LOCK_FILE=/tmp/rmm-agent.lock
configured_lock_file() {
local lock_file
lock_file="$(sed -n 's/^LOCK_FILE="\([^" ]*\)"$/\1/p' "$CONFIG_FILE" 2>/dev/null | tail -n 1)"
printf '%s\n' "${lock_file:-$DEFAULT_LOCK_FILE}"
}
remove_lock_file() {
local lock_file
lock_file="$(configured_lock_file)"
case "$lock_file" in
/*) ;;
*) logger -t rmm-agent "refusing to remove non-absolute lock path"; return 0 ;;
esac
case "$lock_file" in
/|/tmp|/run|/var|/var/run|/var/lock)
logger -t rmm-agent "refusing to remove unsafe lock path"
return 0
;;
esac
rmdir "$lock_file" 2>/dev/null || true
}
start_service() {
[ -x /usr/libexec/rmm-agent-uci-sync ] && /usr/libexec/rmm-agent-uci-sync
@@ -30,7 +53,6 @@ service_triggers() {
procd_add_reload_trigger "rmm-agent"
}
stop_service() {
service_stop "$PROG"
rm -rf /tmp/rmm-agent.lock
service_stopped() {
remove_lock_file
}