bluez-tools: Add package bluezetools
[feed/packages.git] / net / atlas-sw-probe / Makefile
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
9 PKG_NAME:=atlas-sw-probe
10 PKG_VERSION:=5020
11 PKG_RELEASE:=4
12
13 PKG_SOURCE_PROTO:=git
14 PKG_SOURCE_URL:=https://github.com/RIPE-NCC/ripe-atlas-software-probe.git
15 PKG_SOURCE:=ripe-atlas-software-probe-$(PKG_VERSION).tar.gz
16
17 PKG_MIRROR_HASH:=846aa20ff4bc938c07526a9893dcae4ac7dfa41982a5b2bcfe2dd53c974ecdc9
18 PKG_SOURCE_VERSION:=edee49c942b726a1d8865d91c8d7f32843bc8ad1
19
20 PKG_MAINTAINER:=Jan Pavlinec <jan.pavlinec1@gmail.com>
21 PKG_LICENSE:=GPL-3.0-or-later
22 PKG_LICENSE_FILES:=LICENSE
23
24 PKG_INSTALL:=1
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/atlas-sw-probe
29 SECTION:=net
30 CATEGORY:=Network
31 TITLE:=RIPE Atlas software probe
32 URL:=https://atlas.ripe.net/about/probes/
33 DEPENDS:=+atlas-probe +PACKAGE_dropbear:dropbearconvert
34 endef
35
36 define Package/atlas-sw-probe/description
37 RIPE Atlas SW probe is software variant of RIPE Atlas Probe.
38 It contains utilities which helps actively measure
39 Internet connectivity through ping, traceroute, DNS, SSL/TLS, NTP, and HTTP.
40 Data are then collected, aggregated and published by the RIPE NCC.
41 endef
42
43 define Package/atlas-sw-probe-rpc
44 SECTION:=net
45 CATEGORY:=Network
46 TITLE:=RPC service
47 URL:=https://atlas.ripe.net/about/probes/
48 DEPENDS:=+atlas-probe +bind-dig +rpcd
49 endef
50
51 define Package/atlas-sw-probe-rpc/description
52 Provides ubus calls for probe.
53 endef
54
55 Build/Compile:=:
56 Build/Install:=:
57
58 define Package/atlas-sw-probe-rpc/postinst
59 #!/bin/sh
60 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/rpcd restart
61 exit 0
62 endef
63
64 define Package/atlas-sw-probe-rpc/postrm
65 #!/bin/sh
66 [ -z "$${IPKG_INSTROOT}" ] && /etc/init.d/rpcd restart
67 exit 0
68 endef
69
70 define Package/atlas-sw-probe/conffiles
71 /etc/atlas/
72 /etc/config/atlas
73 /usr/libexec/atlas-probe-scripts/state/config.txt
74 endef
75
76 TMP_BASE_DIR:=/tmp/ripe_atlas_probe
77 SCRIPTS_DIR:=/usr/libexec/atlas-probe-scripts
78
79 define Package/atlas-sw-probe/install
80 $(INSTALL_DIR) $(1)/$(SCRIPTS_DIR)
81 $(INSTALL_DIR) $(1)/$(SCRIPTS_DIR)/{etc,state,bin/arch,bin/bin}
82
83 # Copy config
84 $(CP) $(PKG_BUILD_DIR)/atlas-config/etc/* $(1)/$(SCRIPTS_DIR)/etc/
85
86 # Copy firmware version
87 $(CP) $(PKG_BUILD_DIR)/atlas-config/state/FIRMWARE_APPS_VERSION $(1)/$(SCRIPTS_DIR)/state/
88
89 # Set probe mode
90 echo "prod" > $(1)/$(SCRIPTS_DIR)/state/mode
91
92 # Copy scripts
93 $(CP) $(PKG_BUILD_DIR)/bin/{ATLAS,common-pre.sh,common.sh,reginit.sh,resolvconf} $(1)/$(SCRIPTS_DIR)/bin/
94 $(CP) $(PKG_BUILD_DIR)/bin/arch/{linux,openwrt-sw-probe} $(1)/$(SCRIPTS_DIR)/bin/arch/
95
96 # Create config info
97 echo "DEVICE_NAME=openwrt-sw-probe" > $(1)/$(SCRIPTS_DIR)/bin/config.sh
98 echo "ATLAS_BASE=$(SCRIPTS_DIR)" >> $(1)/$(SCRIPTS_DIR)/bin/config.sh
99 echo "ATLAS_STATIC=$(SCRIPTS_DIR)" >> $(1)/$(SCRIPTS_DIR)/bin/config.sh
100 echo "SUB_ARCH=openwrt-$(ARCH)-$(PKG_VERSION)-$(PKG_RELEASE)" >> $(1)/$(SCRIPTS_DIR)/bin/bin/config.sh
101
102 # Enable sending interface traffic statistics as Atlas measurement results
103 echo "RXTXRPT=yes" > $(1)/$(SCRIPTS_DIR)/state/config.txt
104
105 # Fix permision
106 chmod 755 $(1)/$(SCRIPTS_DIR)/bin
107
108 # Add registration instruction
109 $(INSTALL_DIR) $(1)/etc/atlas/
110 $(CP) ./files/atlas.readme $(1)/etc/atlas/
111
112 # Create softlinks for writable dirs
113 $(LN) $(TMP_BASE_DIR)/crons $(1)/$(SCRIPTS_DIR)/crons
114 $(LN) $(TMP_BASE_DIR)/data $(1)/$(SCRIPTS_DIR)/data
115 $(LN) $(TMP_BASE_DIR)/run $(1)/$(SCRIPTS_DIR)/run
116 $(LN) $(TMP_BASE_DIR)/status $(1)/$(SCRIPTS_DIR)/status
117
118 # Copy init and config
119 $(INSTALL_DIR) $(1)/etc/init.d/
120 $(INSTALL_BIN) ./files/atlas.init $(1)/etc/init.d/atlas
121
122 $(INSTALL_DIR) $(1)/etc/config/
123 $(INSTALL_CONF) ./files/atlas.conf $(1)/etc/config/atlas
124 endef
125
126 define Package/atlas-sw-probe-rpc/install
127 $(INSTALL_DIR) $(1)/usr/libexec/rpcd
128 $(INSTALL_BIN) ./files/atlas_rpcd.sh $(1)/usr/libexec/rpcd/atlas
129 endef
130
131 $(eval $(call BuildPackage,atlas-sw-probe))
132 $(eval $(call BuildPackage,atlas-sw-probe-rpc))