atlas-sw-probe: fix missing link on sysupgrade
authorAnsuel Smith <ansuelsmth@gmail.com>
Tue, 11 May 2021 22:27:31 +0000 (00:27 +0200)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Fri, 14 May 2021 06:10:08 +0000 (08:10 +0200)
Recreate symbolic link if it's missing after a sysupgrade with a private and public key present in /etc/atlas/

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
net/atlas-sw-probe/Makefile
net/atlas-sw-probe/files/atlas.init

index 41043749c5f28d9142a5022567f301f31dca79bf..13f224a4f78ff874d7f9d5df7e99ac4bd1379f9a 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=atlas-sw-probe
 PKG_VERSION:=5020
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/RIPE-NCC/ripe-atlas-software-probe.git
index bc826c00290ab33e6ddedef36a7bf51cb1c4ace9..a833a9510cbe4a2380ef68986d9ac73433233f46 100644 (file)
@@ -207,7 +207,16 @@ start_service() {
        local log_stdout
        local rxtxrpt
        local test_setting
+       local probe_key=/etc/atlas/probe_key
+       local probe_pub_key=/etc/atlas/probe_key.pub
+
+       # The link is not saved across sysupgrade, recreate if missing
+       if [ ! -f $PRIV_KEY_FILE ]; then
+               [ -f $probe_key ] && ln -s $probe_key $PRIV_KEY_FILE
+               [ -f $probe_pub_key ] && ln -s $probe_pub_key $PUB_KEY_FILE
+       fi
 
+       # With the precheck done, check if the priv key is actually present
        if [ ! -f $PRIV_KEY_FILE ]; then
                print_msg "Missing probe_key. To init the key follow instruction in /etc/atlas/atlas.readme"
                print_msg "Assuming atlas-sw-probe not init. Exiting..."