include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-cve-triage
PKG_VERSION:=1.0.0
PKG_RELEASE:=1

PKG_MAINTAINER:=CyberMind <contact@cybermind.fr>
PKG_LICENSE:=GPL-3.0

LUCI_TITLE:=LuCI CVE Triage Dashboard
LUCI_DEPENDS:=+secubox-cve-triage +luci-base
LUCI_PKGARCH:=all

PKG_FLAGS:=nonshared

include $(TOPDIR)/feeds/luci/luci.mk

define Package/luci-app-cve-triage/install
	$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
	$(INSTALL_DATA) ./root/usr/share/luci/menu.d/*.json $(1)/usr/share/luci/menu.d/

	$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
	$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/*.json $(1)/usr/share/rpcd/acl.d/

	$(INSTALL_DIR) $(1)/usr/libexec/rpcd
	$(INSTALL_BIN) ./root/usr/libexec/rpcd/luci.cve-triage $(1)/usr/libexec/rpcd/

	$(INSTALL_DIR) $(1)/www/luci-static/resources/view/cve-triage
	$(INSTALL_DATA) ./htdocs/luci-static/resources/view/cve-triage/*.js $(1)/www/luci-static/resources/view/cve-triage/

	$(INSTALL_DIR) $(1)/www/luci-static/resources/cve-triage
	$(INSTALL_DATA) ./htdocs/luci-static/resources/cve-triage/*.js $(1)/www/luci-static/resources/cve-triage/
endef

define Package/luci-app-cve-triage/postinst
#!/bin/sh
[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/rpcd restart
exit 0
endef

$(eval $(call BuildPackage,luci-app-cve-triage))
