logmngr: Make sure we never fail to setup /var/log/messages.

If it fails during MP the verfication of buttons will not work
as expected. The problem is that the file is created before
data is commited and when power is cut prematurely it won't
re-create the file, maybe because the uci-default script has
been removed already as well.
This commit is contained in:
Markus Gothe 2025-07-30 21:29:42 +02:00
parent b917a2177e
commit 27b9fb9350
3 changed files with 19 additions and 29 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=logmngr
PKG_VERSION:=1.0.19
PKG_VERSION:=1.0.20
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
@ -54,8 +54,8 @@ define Package/logmngr/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/logmngr.init $(1)/etc/init.d/logmngr
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/10-logmngr_config_generate $(1)/etc/uci-defaults/
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_BIN) ./files/logmngr.uci $(1)/etc/config/logmngr
$(INSTALL_DIR) $(1)/lib/logmngr
ifeq ($(CONFIG_LOGMNGR_BACKEND_FLUENTBIT),y)
@ -68,6 +68,7 @@ ifeq ($(CONFIG_LOGMNGR_BACKEND_SYSLOG_NG),y)
endif
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbfsyslog.so $(1) core 10
ifeq ($(CONFIG_LOGMNGR_LOGROTATE),y)
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) ./files/11-logmngr_logrotate_config_generate $(1)/etc/uci-defaults/
$(INSTALL_DATA) ./files/lib/logmngr/logrotate.sh $(1)/lib/logmngr/
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/bbf_plugin/libbbflogrotate.so $(1) sysmngr 11

View file

@ -1,26 +0,0 @@
#!/bin/sh
if uci -q get logmngr.@globals[0] >/dev/null; then
# return if there is any valid content
exit 0
else
rm -f /etc/config/logmngr
fi
touch /etc/config/logmngr
uci set logmngr.globals=globals
uci set logmngr.globals.enable=1
uci set logmngr.a1=action
uci set logmngr.a1.name="ac1"
uci set logmngr.lf1=log_file
uci set logmngr.lf1.enable=1
uci set logmngr.lf1.action="ac1"
uci set logmngr.lf1.file="/var/log/messages"
uci set logmngr.lr1=log_remote
uci set logmngr.lr1.enable=0
uci set logmngr.lr1.action="ac1"
uci set logmngr.lr1.port="514"

15
logmngr/files/logmngr.uci Normal file
View file

@ -0,0 +1,15 @@
config globals 'globals'
option enable '1'
config action 'a1'
option name 'ac1'
config log_file 'lf1'
option enable '1'
option action 'ac1'
option file '/var/log/messages'
config log_remote 'lr1'
option enable '0'
option action 'ac1'
option port '514'