You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
4.0 KiB

  1. # SPDX-License-Identifier: MIT
  2. #
  3. # Copyright (C) 2021 Gerald Kerma
  4. #
  5. include $(TOPDIR)/rules.mk
  6. PKG_NAME:=crowdsec
  7. PKG_VERSION:=1.2.0
  8. PKG_RELEASE:=$(AUTORELEASE)
  9. PKG_SOURCE_PROTO:=git
  10. PKG_SOURCE_URL:=https://github.com/crowdsecurity/crowdsec
  11. PKG_SOURCE_VERSION:=v$(PKG_VERSION)
  12. PKG_SOURCE_DATE:=20210914
  13. PKG_MIRROR_HASH:=911af2c49c28596256c31ebb26b48c5ba9e6a0abdd46830e75e2cf4c0eff4256
  14. PKG_LICENSE:=MIT
  15. PKG_LICENSE_FILES:=LICENSE
  16. PKG_MAINTAINER:=Gerald Kerma <gandalf@gk2.net>
  17. PKG_BUILD_DEPENDS:=golang/host
  18. PKG_BUILD_PARALLEL:=1
  19. PKG_USE_MIPS16:=0
  20. CWD_SYSTEM:=openwrt
  21. CWD_BUILD_VERSION?=$(PKG_SOURCE_VERSION)
  22. CWD_BUILD_GOVERSION:=$(shell go version | cut -d " " -f3 | sed -E 's/[go]+//g')
  23. CWD_BUILD_CODENAME:=alphaga
  24. CWD_BUILD_TIMESTAMP:=$(SOURCE_DATE_EPOCH)
  25. CWD_BUILD_TAG:=openwrt
  26. CWD_VERSION_PKG:=github.com/crowdsecurity/crowdsec/pkg/cwversion
  27. GO_PKG:=github.com/crowdsecurity/crowdsec
  28. GO_PKG_LDFLAGS_X:=$(CWD_VERSION_PKG).Version=$(CWD_BUILD_VERSION) \
  29. $(CWD_VERSION_PKG).System=$(CWD_SYSTEM) \
  30. $(CWD_VERSION_PKG).BuildDate=$(CWD_BUILD_TIMESTAMP) \
  31. $(CWD_VERSION_PKG).Codename=$(CWD_BUILD_CODENAME) \
  32. $(CWD_VERSION_PKG).Tag=$(CWD_BUILD_TAG) \
  33. $(CWD_VERSION_PKG).GoVersion=$(CWD_BUILD_GOVERSION)
  34. GO_PKG_INSTALL_ALL:=1
  35. include $(INCLUDE_DIR)/package.mk
  36. include ../../lang/golang/golang-package.mk
  37. define Package/crowdsec/Default
  38. SECTION:=net
  39. CATEGORY:=Network
  40. TITLE:=Crowdsec detection engine
  41. URL:=https://crowdsec.net/
  42. endef
  43. define Package/crowdsec
  44. $(call Package/crowdsec/Default)
  45. DEPENDS:=$(GO_ARCH_DEPENDS)
  46. endef
  47. define Package/golang-crowdsec-dev
  48. $(call Package/crowdsec/Default)
  49. $(call GoPackage/GoSubMenu)
  50. TITLE+= (source files)
  51. DEPENDS:=$(GO_ARCH_DEPENDS)
  52. PKGARCH:=all
  53. endef
  54. define Package/crowdsec/Default/description
  55. Crowdsec - An open-source, lightweight agent to detect
  56. and respond to bad behaviours.
  57. It also automatically benefits from a global
  58. community-wide IP reputation database.
  59. endef
  60. define Package/crowdsec/description
  61. $(call Package/crowdsec/Default/description)
  62. This package contains the main program.
  63. endef
  64. define Package/golang-crowdsec-dev/description
  65. $(call Package/crowdsec/Default/description)
  66. This package provides the source files for the program.
  67. endef
  68. define Package/crowdsec/install
  69. $(call GoPackage/Package/Install/Bin,$(1))
  70. $(INSTALL_DIR) $(1)/etc/crowdsec
  71. $(INSTALL_DIR) $(1)/etc/crowdsec/scenarios
  72. $(INSTALL_DIR) $(1)/etc/crowdsec/postoverflows
  73. $(INSTALL_DIR) $(1)/etc/crowdsec/collections
  74. $(INSTALL_DIR) $(1)/etc/crowdsec/patterns
  75. $(INSTALL_DIR) $(1)/etc/crowdsec/hub
  76. $(INSTALL_DATA) \
  77. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/config.yaml \
  78. $(1)/etc/crowdsec
  79. $(INSTALL_DATA) \
  80. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/dev.yaml \
  81. $(1)/etc/crowdsec
  82. $(INSTALL_DATA) \
  83. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/user.yaml \
  84. $(1)/etc/crowdsec
  85. $(INSTALL_DATA) \
  86. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/acquis.yaml \
  87. $(1)/etc/crowdsec
  88. $(INSTALL_DATA) \
  89. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/profiles.yaml \
  90. $(1)/etc/crowdsec
  91. $(INSTALL_DATA) \
  92. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/simulation.yaml \
  93. $(1)/etc/crowdsec
  94. $(INSTALL_DATA) \
  95. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/local_api_credentials.yaml \
  96. $(1)/etc/crowdsec
  97. $(INSTALL_DATA) \
  98. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/online_api_credentials.yaml \
  99. $(1)/etc/crowdsec
  100. $(CP) \
  101. $(GO_PKG_BUILD_DIR)/src/$(GO_PKG)/config/patterns/* \
  102. $(1)/etc/crowdsec/patterns
  103. $(INSTALL_DIR) $(1)/srv/crowdsec/data/
  104. $(INSTALL_DIR) $(1)/etc/init.d
  105. $(INSTALL_BIN) \
  106. ./files/crowdsec.initd \
  107. $(1)/etc/init.d/crowdsec
  108. $(INSTALL_DIR) $(1)/etc/config
  109. $(INSTALL_CONF) \
  110. ./files/crowdsec.config \
  111. $(1)/etc/config/crowdsec
  112. $(LN) /usr/bin/crowdsec-cli $(1)/usr/bin/cscli
  113. $(INSTALL_DIR) $(1)/etc/uci-defaults
  114. $(INSTALL_BIN) \
  115. ./files/crowdsec.defaults \
  116. $(1)/etc/uci-defaults/99_crowdsec
  117. endef
  118. define Package/crowdsec/conffiles
  119. /etc/crowdsec/
  120. /etc/config/crowdsec
  121. endef
  122. $(eval $(call GoBinPackage,crowdsec))
  123. $(eval $(call BuildPackage,crowdsec))