    
include $(TOPDIR)/rules.mk

PKG_NAME:=sysmonitor
PKG_RELEASE:=1
VERSION_YEAR=$(shell date +%Y)
VERSION_MAJOR=$(shell expr $(VERSION_YEAR) - 2018)
VERSION_MINOR=$(shell date +%V%u)
VERSION_REVISION=0001
PKG_VERSION:=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_REVISION)

include $(INCLUDE_DIR)/package.mk

define Package/sysmonitor
	SECTION:=DYIOT
	CATEGORY:=DYIOT Software
	TITLE:=System Monitor Services for Lnxall gateways
	DEPENDS:=+lua-libutils
endef

define Package/sysmonitor/description
	sysmonitor for LNXALL gateways
endef

define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Package/sysmonitor/conffiles
/app/config/sysmonitor.json
endef

define Build/InstallDev
endef

define Build/Compile
endef

define Package/sysmonitor/install
	$(INSTALL_DIR) $(1)/app/config
	$(INSTALL_DIR) $(1)/etc/init.d
	$(CP) $(PKG_BUILD_DIR)/sysmonitor.lua $(1)/app/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/sysmonitor.init $(1)/etc/init.d/sysmonitor
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/sysmonitor.json $(1)/app/config/
endef

$(eval $(call BuildPackage,sysmonitor))
