bbfdm: Added support for Device.DeviceInfo.Reboots. object

This commit is contained in:
Amin Ben Romdhane 2024-10-16 14:45:38 +02:00 committed by Vivek Kumar Dutta
parent 544000177c
commit 9bc4656525
3 changed files with 36 additions and 2 deletions

View file

@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm
PKG_VERSION:=1.12.13
PKG_VERSION:=1.12.14
USE_LOCAL:=0
ifneq ($(USE_LOCAL),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
PKG_SOURCE_VERSION:=5aa1298df5fa75c8ad6888768d1bf53089302b02
PKG_SOURCE_VERSION:=a813bf27159b5f26994ebb28eb4910a4fc4947e4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@ -130,12 +130,14 @@ define Package/bbfdmd/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
$(INSTALL_CONF) ./files/etc/config/schedules $(1)/etc/config/schedules
$(INSTALL_CONF) ./files/etc/config/deviceinfo $(1)/etc/config/deviceinfo
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
$(INSTALL_BIN) ./files/etc/init.d/bbf_device $(1)/etc/init.d/bbf_device
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
@ -151,6 +153,7 @@ ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
endif
$(INSTALL_DIR) $(1)/usr/share/bbfdm/scripts
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_reboot_handler.sh $(1)/usr/share/bbfdm/scripts/
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_activate_handler.sh $(1)/usr/share/bbfdm/scripts/
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_check_idle.sh $(1)/usr/share/bbfdm/scripts/
endef

View file

@ -0,0 +1,4 @@
config globals 'globals'
option max_reboot_entries '3'

View file

@ -0,0 +1,27 @@
#!/bin/sh /etc/rc.common
START=9
USE_PROCD=1
SCRIPT=/usr/share/bbfdm/scripts/bbf_reboot_handler.sh
LOCKFILE=/tmp/bbf_reboot_handler.lock
start_service()
{
# Check if the script has already been executed
if [ -f "${LOCKFILE}" ]; then
echo "Script already executed, not running again."
return 0
fi
# Ensure the script exists before running
[ ! -f "${SCRIPT}" ] && return 0
# Run the script once
procd_open_instance
procd_set_param command /bin/sh "${SCRIPT}"
procd_close_instance
# Create a lockfile to mark the script as executed
touch "${LOCKFILE}"
}