From a70f13dcba01b4d355a0b5242572c5d6d3fcac41 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Thu, 12 Apr 2018 17:48:14 +0200 Subject: [PATCH] zerotier: abort on zerotier-idtool error Signed-off-by: Moritz Warning --- net/zerotier/files/zerotier.init | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/net/zerotier/files/zerotier.init b/net/zerotier/files/zerotier.init index 78fe87e947..6d0f4f239d 100644 --- a/net/zerotier/files/zerotier.init +++ b/net/zerotier/files/zerotier.init @@ -44,10 +44,13 @@ start_instance() { if [ "$secret" = "generate" ]; then echo "Generate secret - please wait..." - local tmp="/tmp/zt.$cfg.secret" - zerotier-idtool generate "$tmp" > /dev/null - secret="$(cat $tmp)" - rm "$tmp" + local sf="/tmp/zt.$cfg.secret" + + zerotier-idtool generate "$sf" > /dev/null + [ $? -ne 0 ] && return 1 + + secret="$(cat $sf)" + rm "$sf" uci set zerotier.$cfg.secret="$secret" uci commit zerotier -- 2.30.2