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.

150 lines
4.0 KiB

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