aboutsummaryrefslogtreecommitdiff
path: root/lang/lua-cs-bouncer/Makefile
blob: 3f8f7593039ac9986e3415a63b0ff4ac607149a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2021-2022 Gerald Kerma
#

include $(TOPDIR)/rules.mk

PKG_NAME:=lua-cs-bouncer
PKG_SOURCE_DATE:=2022-01-18
PKG_SOURCE_VERSION:=e0f68b1265c386715c1d6ab79fe9063c0a9e3d3a
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_DATE).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/crowdsecurity/$(PKG_NAME)/tar.gz/$(PKG_SOURCE_VERSION)?
PKG_HASH:=c7e92cc9dc023ebcd84f3632d6cf0e38a7d9f5e7bba15367247753a306b89829
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)

PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Gerald Kerma <gandalf@gk2.net>

HOST_BUILD_DEPENDS:=lua/host
PKG_BUILD_DEPENDS:=luarocks/host

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk

define Package/lua-cs-bouncer
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=Lua Crowdsec Bouncer module
  URL:=https://github.com/crowdsecurity/lua-cs-bouncer
  DEPENDS:=+lua \
        +luasec
endef

define Package/lua-cs-bouncer/description
  Lua module to allow ip (or not) from CrowdSec API.
endef

define Build/Compile
endef

define Package/lua-cs-bouncer/install
	$(INSTALL_DIR) $(1)/usr/lib/lua/crowdsec
	$(INSTALL_DATA) \
	        $(PKG_BUILD_DIR)/lib/*.lua \
	        $(1)/usr/lib/lua/crowdsec/
	$(INSTALL_DATA) \
	        $(PKG_BUILD_DIR)/template.conf \
	        $(1)/usr/lib/lua/crowdsec/crowdsec.conf

	$(INSTALL_DIR) $(1)/usr/lib/crowdsec/lua/plugins/crowdsec
	$(INSTALL_DATA) \
	        $(PKG_BUILD_DIR)/nginx/config.lua \
	        $(1)/usr/lib/crowdsec/lua/plugins/crowdsec/
	$(INSTALL_DATA) \
	        $(PKG_BUILD_DIR)/nginx/crowdsec.lua \
	        $(1)/usr/lib/crowdsec/lua/
	$(INSTALL_DATA) \
	        $(PKG_BUILD_DIR)/nginx/recaptcha.lua \
	        $(1)/usr/lib/crowdsec/lua/
	$(INSTALL_DATA) \
	        $(PKG_BUILD_DIR)/nginx/access.lua \
	        $(1)/usr/lib/crowdsec/lua/

	$(INSTALL_DIR) $(1)/etc/uci-defaults
	$(INSTALL_BIN) \
		./files/lua-cs-bouncer.defaults \
		$(1)/etc/uci-defaults/99_lua-cs-bouncer
endef

define Package/lua-cs-bouncer/conffiles
/usr/lib/lua/crowdsec/crowdsec.conf
endef

$(eval $(call BuildPackage,lua-cs-bouncer))