mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 17:33:56 +08:00
🦄 Sync 2026-04-11 02:41:05
This commit is contained in:
1 parent
c6d54c1769
commit
f118665d70
9 files changed
+203
-66
No files matched your search
@@ -0,0 +1,55 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=beszel-agent
|
||||
PKG_VERSION:=0.18.7
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)_linux_$(or $(BESZEL_GOARCH),arm64).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/henrygd/beszel/releases/download/v$(PKG_VERSION)/
|
||||
PKG_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/beszel-agent
|
||||
SECTION:=admin
|
||||
CATEGORY:=Administration
|
||||
TITLE:=Beszel monitoring agent
|
||||
URL:=https://github.com/henrygd/beszel
|
||||
endef
|
||||
|
||||
define Package/beszel-agent/description
|
||||
Lightweight server monitoring agent for Beszel hub
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
tar -xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
if command -v upx >/dev/null 2>&1; then \
|
||||
upx --best --lzma $(PKG_BUILD_DIR)/beszel-agent || true; \
|
||||
fi
|
||||
endef
|
||||
|
||||
define Package/beszel-agent/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/beszel-agent $(1)/usr/bin/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/beszel-agent.init $(1)/etc/init.d/beszel-agent
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/beszel-agent.config $(1)/etc/config/beszel-agent
|
||||
endef
|
||||
|
||||
define Package/beszel-agent/conffiles
|
||||
/etc/config/beszel-agent
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,beszel-agent))
|
||||
@@ -0,0 +1,7 @@
|
||||
config agent 'agent'
|
||||
option enabled '0'
|
||||
option port '45876'
|
||||
option public_key ''
|
||||
option hub_url '' # optional, for outbound mode (websockets)
|
||||
option token '' # optional, for outbound mode (websockets)
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/bin/beszel-agent
|
||||
|
||||
start_service() {
|
||||
local enabled port key url token
|
||||
|
||||
config_load 'beszel-agent'
|
||||
config_get_bool enabled 'agent' 'enabled' '0'
|
||||
config_get port 'agent' 'port' '45876'
|
||||
config_get key 'agent' 'public_key' ''
|
||||
config_get url 'agent' 'hub_url' ''
|
||||
config_get token 'agent' 'token' ''
|
||||
|
||||
[ "$enabled" -eq 0 ] && return 0
|
||||
|
||||
[ -z "$key" ] && {
|
||||
logger -t beszel-agent "Public key not set!"
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ -n "$url" ] || [ -n "$token" ]; then
|
||||
if [ -z "$url" ] || [ -z "$token" ]; then
|
||||
logger -t beszel-agent "Outbound mode requires both hub_url and token, but only one set!"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
procd_open_instance beszel-agent
|
||||
procd_set_param command "$PROG" -listen "$port" -key "$key"
|
||||
[ -n "$url" ] && [ -n "$token" ] && {
|
||||
procd_append_param command -url "$url" -token "$token"
|
||||
}
|
||||
procd_set_param respawn 3600 5 5
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param user root
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
service_stop "$PROG"
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
restart
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "beszel-agent"
|
||||
}
|
||||
Reference in new issue
Block a user