include $(TOPDIR)/rules.mk

PKG_NAME:=self-diagnostics
PKG_VERSION:=1.0.16
PKG_RELEASE:=1

PKG_LICENSE:=GPL-2.0-only

include $(INCLUDE_DIR)/package.mk
include ../bbfdm/bbfdm.mk

define Package/self-diagnostics
  CATEGORY:=Utilities
  TITLE:=System Report
  DEPENDS:=+@CONFIG_BUSYBOX_CONFIG_TIMEOUT +@CONFIG_BUSYBOX_CONFIG_FEATURE_FIND_PATH +@CONFIG_BUSYBOX_CONFIG_TEE \
           +@CONFIG_BUSYBOX_CONFIG_GZIP
  DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
  MENU:=1
endef

define Package/self-diagnostics/description
	Generate Self test diagnostics report and adds Device.SelfTestDiagnostics. datamodel object
endef

define Package/self-diagnostics/install
	$(INSTALL_DIR) $(1)/etc/self-diagnostics/spec/
	$(CP) ./files/* $(1)/
	$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/libselftest.so $(1) core 14
endef

$(eval $(call BuildPackage,self-diagnostics))
