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.

127 lines
3.7 KiB

  1. #
  2. # Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (https://www.nic.cz/)
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=atlas-sw-probe
  9. PKG_VERSION:=5020
  10. PKG_RELEASE:=1
  11. PKG_SOURCE_PROTO:=git
  12. PKG_SOURCE_URL:=https://github.com/RIPE-NCC/ripe-atlas-software-probe.git
  13. PKG_SOURCE:=ripe-atlas-software-probe-$(PKG_VERSION).tar.gz
  14. PKG_MIRROR_HASH:=846aa20ff4bc938c07526a9893dcae4ac7dfa41982a5b2bcfe2dd53c974ecdc9
  15. PKG_SOURCE_VERSION:=edee49c942b726a1d8865d91c8d7f32843bc8ad1
  16. PKG_MAINTAINER:=Jan Pavlinec <jan.pavlinec@nic.cz>
  17. PKG_LICENSE:=GPL-3.0-or-later
  18. PKG_LICENSE_FILES:=LICENSE
  19. PKG_INSTALL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/atlas-sw-probe
  22. SECTION:=net
  23. CATEGORY:=Network
  24. TITLE:=RIPE Atlas software probe
  25. URL:=https://atlas.ripe.net/about/probes/
  26. DEPENDS:=+atlas-probe
  27. endef
  28. define Package/atlas-sw-probe/description
  29. RIPE Atlas SW probe is software variant of RIPE Atlas Probe.
  30. It contains utilities which helps actively measure
  31. Internet connectivity through ping, traceroute, DNS, SSL/TLS, NTP, and HTTP.
  32. Data are then collected, aggregated and published by the RIPE NCC.
  33. endef
  34. define Package/atlas-sw-probe-rpc
  35. SECTION:=net
  36. CATEGORY:=Network
  37. TITLE:=RPC service
  38. URL:=https://atlas.ripe.net/about/probes/
  39. DEPENDS:=+atlas-probe +bind-dig +rpcd
  40. endef
  41. define Package/atlas-sw-probe-rpc/description
  42. Provides ubus calls for probe.
  43. endef
  44. Build/Compile:=:
  45. Build/Install:=:
  46. define Package/atlas-sw-probe-rpc/postinst
  47. #!/bin/sh
  48. [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/rpcd restart
  49. exit 0
  50. endef
  51. define Package/atlas-sw-probe-rpc/postrm
  52. #!/bin/sh
  53. [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/rpcd restart
  54. exit 0
  55. endef
  56. define Package/atlas-sw-probe/conffiles
  57. /etc/config/atlas
  58. /usr/libexec/atlas-probe-scripts/state/config.txt
  59. endef
  60. TMP_BASE_DIR:=/tmp/ripe_atlas_probe
  61. SCRIPTS_DIR:=/usr/libexec/atlas-probe-scripts
  62. define Package/atlas-sw-probe/install
  63. $(INSTALL_DIR) $(1)/$(SCRIPTS_DIR)
  64. $(INSTALL_DIR) $(1)/$(SCRIPTS_DIR)/{etc,state,bin/arch,bin/bin}
  65. # Copy config
  66. $(CP) $(PKG_BUILD_DIR)/atlas-config/etc/* $(1)/$(SCRIPTS_DIR)/etc/
  67. # Copy firmware version
  68. $(CP) $(PKG_BUILD_DIR)/atlas-config/state/FIRMWARE_APPS_VERSION $(1)/$(SCRIPTS_DIR)/state/
  69. # Set probe mode
  70. echo "prod" > $(1)/$(SCRIPTS_DIR)/state/mode
  71. # Copy scripts
  72. $(CP) $(PKG_BUILD_DIR)/bin/{ATLAS,common-pre.sh,common.sh,reginit.sh,resolvconf} $(1)/$(SCRIPTS_DIR)/bin/
  73. $(CP) $(PKG_BUILD_DIR)/bin/arch/{linux,openwrt-sw-probe} $(1)/$(SCRIPTS_DIR)/bin/arch/
  74. # Create config info
  75. echo "DEVICE_NAME=openwrt-sw-probe" > $(1)/$(SCRIPTS_DIR)/bin/config.sh
  76. echo "ATLAS_BASE=$(SCRIPTS_DIR)" >> $(1)/$(SCRIPTS_DIR)/bin/config.sh
  77. echo "ATLAS_STATIC=$(SCRIPTS_DIR)" >> $(1)/$(SCRIPTS_DIR)/bin/config.sh
  78. echo "SUB_ARCH=openwrt-$(ARCH)-$(PKG_VERSION)-$(PKG_RELEASE)" >> $(1)/$(SCRIPTS_DIR)/bin/bin/config.sh
  79. # Enable sending interface traffic statistics as Atlas measurement results
  80. echo "RXTXRPT=yes" > $(1)/$(SCRIPTS_DIR)/state/config.txt
  81. # Fix permision
  82. chmod 755 $(1)/$(SCRIPTS_DIR)/bin
  83. # Create softlinks for writable dirs
  84. $(LN) $(TMP_BASE_DIR)/crons $(1)/$(SCRIPTS_DIR)/crons
  85. $(LN) $(TMP_BASE_DIR)/data $(1)/$(SCRIPTS_DIR)/data
  86. $(LN) $(TMP_BASE_DIR)/run $(1)/$(SCRIPTS_DIR)/run
  87. $(LN) $(TMP_BASE_DIR)/status $(1)/$(SCRIPTS_DIR)/status
  88. # Copy init and config
  89. $(INSTALL_DIR) $(1)/etc/init.d/
  90. $(INSTALL_BIN) ./files/atlas.init $(1)/etc/init.d/atlas
  91. $(INSTALL_DIR) $(1)/etc/config/
  92. $(INSTALL_CONF) ./files/atlas.conf $(1)/etc/config/atlas
  93. endef
  94. define Package/atlas-sw-probe-rpc/install
  95. $(INSTALL_DIR) $(1)/usr/libexec/rpcd
  96. $(INSTALL_BIN) ./files/atlas_rpcd.sh $(1)/usr/libexec/rpcd/atlas
  97. endef
  98. $(eval $(call BuildPackage,atlas-sw-probe))
  99. $(eval $(call BuildPackage,atlas-sw-probe-rpc))