Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=ffho-site-generate
  3. PKG_VERSION:=2
  4. PKG_RELEASE:=$(GLUON_VERSION).$(GLUON_SITE_CODE)-$(GLUON_RELEASE).$(GLUON_CONFIG_VERSION)
  5. PFG_BUILD_DEPENDS := lua-cjson/host
  6. PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
  7. include $(GLUONDIR)/include/package.mk
  8. define Package/ffho-site-generate
  9. SECTION:=ffho
  10. CATEGORY:=Site-select
  11. TITLE:=Scripts for generating a new site.json
  12. DEPENDS:=+gluon-core +luci-lib-json
  13. MAINTAINER:=Freifunk Hochstift <kontakt@hochstift.freifunk.net>
  14. URL:=https://git.c3pb.de/freifunk-pb/ffho-packages
  15. endef
  16. define Package/ffho-site-generate/description
  17. endef
  18. define Build/Prepare
  19. mkdir -p $(PKG_BUILD_DIR)
  20. endef
  21. define Build/Configure
  22. endef
  23. define Build/Compile
  24. $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
  25. endef
  26. define Package/ffho-site-generate/install
  27. $(CP) ./files/* $(1)/
  28. $(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
  29. lua -e 'print(require("cjson").encode(assert(dofile("./scripts/template.lua"))))' > $(1)/lib/gluon/site-select/template.json
  30. lua -e 'print(require("cjson").encode(assert(dofile("./scripts/sites.lua"))))' > $(1)/lib/gluon/site-select/sites.json
  31. if [ -e $(GLUON_SITEDIR)/extra/groups.conf ]; then lua -e 'print(require("cjson").encode(assert(dofile("./scripts/groups.lua"))))' > $(1)/lib/gluon/site-select/groups.json; fi
  32. endef
  33. $(eval $(call BuildPackage,ffho-site-generate))