mirror of
https://github.com/openwrt/packages.git
synced 2026-10-12 05:57:04 +04:00
ripe-atlas: add get_key and probeid to init script
Previous package (atlas-sw-probe) printed the public key to register a
new probe with "/etc/init.d/atlas get_key" and the probe ID with
"/etc/init.d/atlas probeid", and the documentation [1] [2] tells users
to run get_key. Add both back as "/etc/init.d/ripe-atlas get_key" and
"/etc/init.d/ripe-atlas probeid". For a probe that has registered since
boot, get_key prints the probe ID instead of asking to register it.
[1] https://docs.turris.cz/basics/apps/atlas/
[2] https://github.com/openwrt/packages/blob/d2aeaf041bc0/net/atlas-sw-probe/files/atlas.readme
Fixes: b77264c922 ("ripe-atlas: add new package")
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
This commit is contained in:
1 parent
cdcbc11db8
commit
21b1fefb41
2 files changed
+40
-1
No files matched your search
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ripe-atlas
|
||||
PKG_VERSION:=5130
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE:=ripe-atlas-software-probe-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/RIPE-NCC/ripe-atlas-software-probe/tar.gz/refs/tags/$(PKG_VERSION)?
|
||||
|
||||
@@ -6,6 +6,9 @@ MAINU=ripe-atlas
|
||||
MEASU=ripe-atlas
|
||||
GROUP=ripe-atlas
|
||||
|
||||
extra_command "get_key" "Print the public key to register the probe with"
|
||||
extra_command "probeid" "Print the probe ID"
|
||||
|
||||
validate_config()
|
||||
{
|
||||
uci_load_validate 'ripe-atlas' 'ripe-atlas' "${1}" "${2}" \
|
||||
@@ -244,6 +247,42 @@ reload_service()
|
||||
start
|
||||
}
|
||||
|
||||
registered_id()
|
||||
{
|
||||
awk '$1 == "PROBE_ID" { print $2 }' \
|
||||
/var/run/ripe-atlas/status/reg_init_reply.txt 2> /dev/null
|
||||
}
|
||||
|
||||
get_key()
|
||||
{
|
||||
local pub=/etc/ripe-atlas/probe_key.pub
|
||||
local id
|
||||
|
||||
if [ ! -s "${pub}" ]; then
|
||||
echo "${pub} is missing, start the probe to create it" >&2
|
||||
return 1
|
||||
fi
|
||||
id="$(registered_id)"
|
||||
if [ -n "${id}" ]; then
|
||||
echo "Registered as probe ${id} with:"
|
||||
else
|
||||
echo 'Register the probe at https://atlas.ripe.net/apply/swprobe/ with:'
|
||||
fi
|
||||
cat "${pub}"
|
||||
}
|
||||
|
||||
probeid()
|
||||
{
|
||||
local id
|
||||
|
||||
id="$(registered_id)"
|
||||
if [ -z "${id}" ]; then
|
||||
echo 'The probe has not registered since boot' >&2
|
||||
return 1
|
||||
fi
|
||||
echo "Probe ID is ${id}"
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger 'ripe-atlas'
|
||||
|
||||
Reference in new issue
Block a user