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.

132 lines
3.9 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:=3
  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 +PACKAGE_dropbear:dropbearconvert
  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/atlas/
  58. /etc/config/atlas
  59. /usr/libexec/atlas-probe-scripts/state/config.txt
  60. endef
  61. TMP_BASE_DIR:=/tmp/ripe_atlas_probe
  62. SCRIPTS_DIR:=/usr/libexec/atlas-probe-scripts
  63. define Package/atlas-sw-probe/install
  64. $(INSTALL_DIR) $(1)/$(SCRIPTS_DIR)
  65. $(INSTALL_DIR) $(1)/$(SCRIPTS_DIR)/{etc,state,bin/arch,bin/bin}
  66. # Copy config
  67. $(CP) $(PKG_BUILD_DIR)/atlas-config/etc/* $(1)/$(SCRIPTS_DIR)/etc/
  68. # Copy firmware version
  69. $(CP) $(PKG_BUILD_DIR)/atlas-config/state/FIRMWARE_APPS_VERSION $(1)/$(SCRIPTS_DIR)/state/
  70. # Set probe mode
  71. echo "prod" > $(1)/$(SCRIPTS_DIR)/state/mode
  72. # Copy scripts
  73. $(CP) $(PKG_BUILD_DIR)/bin/{ATLAS,common-pre.sh,common.sh,reginit.sh,resolvconf} $(1)/$(SCRIPTS_DIR)/bin/
  74. $(CP) $(PKG_BUILD_DIR)/bin/arch/{linux,openwrt-sw-probe} $(1)/$(SCRIPTS_DIR)/bin/arch/
  75. # Create config info
  76. echo "DEVICE_NAME=openwrt-sw-probe" > $(1)/$(SCRIPTS_DIR)/bin/config.sh
  77. echo "ATLAS_BASE=$(SCRIPTS_DIR)" >> $(1)/$(SCRIPTS_DIR)/bin/config.sh
  78. echo "ATLAS_STATIC=$(SCRIPTS_DIR)" >> $(1)/$(SCRIPTS_DIR)/bin/config.sh
  79. echo "SUB_ARCH=openwrt-$(ARCH)-$(PKG_VERSION)-$(PKG_RELEASE)" >> $(1)/$(SCRIPTS_DIR)/bin/bin/config.sh
  80. # Enable sending interface traffic statistics as Atlas measurement results
  81. echo "RXTXRPT=yes" > $(1)/$(SCRIPTS_DIR)/state/config.txt
  82. # Fix permision
  83. chmod 755 $(1)/$(SCRIPTS_DIR)/bin
  84. # Add registration instruction
  85. $(INSTALL_DIR) $(1)/etc/atlas/
  86. $(CP) ./files/atlas.readme $(1)/etc/atlas/
  87. # Create softlinks for writable dirs
  88. $(LN) $(TMP_BASE_DIR)/crons $(1)/$(SCRIPTS_DIR)/crons
  89. $(LN) $(TMP_BASE_DIR)/data $(1)/$(SCRIPTS_DIR)/data
  90. $(LN) $(TMP_BASE_DIR)/run $(1)/$(SCRIPTS_DIR)/run
  91. $(LN) $(TMP_BASE_DIR)/status $(1)/$(SCRIPTS_DIR)/status
  92. # Copy init and config
  93. $(INSTALL_DIR) $(1)/etc/init.d/
  94. $(INSTALL_BIN) ./files/atlas.init $(1)/etc/init.d/atlas
  95. $(INSTALL_DIR) $(1)/etc/config/
  96. $(INSTALL_CONF) ./files/atlas.conf $(1)/etc/config/atlas
  97. endef
  98. define Package/atlas-sw-probe-rpc/install
  99. $(INSTALL_DIR) $(1)/usr/libexec/rpcd
  100. $(INSTALL_BIN) ./files/atlas_rpcd.sh $(1)/usr/libexec/rpcd/atlas
  101. endef
  102. $(eval $(call BuildPackage,atlas-sw-probe))
  103. $(eval $(call BuildPackage,atlas-sw-probe-rpc))