From 02fca137b3f780c80435bc8fb85114ec0029294b Mon Sep 17 00:00:00 2001 From: /rootzoll Date: Thu, 21 Mar 2024 21:34:53 +0100 Subject: [PATCH] fix zerotier dialogs (#4495) --- home.admin/00settingsMenuBasics.sh | 12 ++---------- home.admin/config.scripts/bonus.zerotier.sh | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/home.admin/00settingsMenuBasics.sh b/home.admin/00settingsMenuBasics.sh index 6110fefc0..5b208474c 100755 --- a/home.admin/00settingsMenuBasics.sh +++ b/home.admin/00settingsMenuBasics.sh @@ -376,16 +376,8 @@ if [ "${zerotierSwitch}" != "${choice}" ]; then echo "zerotier setting changed .." anychange=1 error="" - source <(sudo -u admin /home/admin/config.scripts/bonus.zerotier.sh ${choice}) - if [ "${choice}" == "on" ]; then - if [ ${#error} -eq 0 ]; then - dialog --msgbox "Your RaspiBlitz joined the ZeroTier network." 6 46 - else - if [ "${error}" != "cancel" ]; then - dialog --msgbox "ZeroTier Error:\n${error}" 8 46 - fi - fi - else + sudo -u admin /home/admin/config.scripts/bonus.zerotier.sh ${choice} + if [ "${choice}" != "on" ]; then dialog --msgbox "ZeroTier is now OFF." 5 46 fi diff --git a/home.admin/config.scripts/bonus.zerotier.sh b/home.admin/config.scripts/bonus.zerotier.sh index 5cae3b6d9..19591f8f7 100755 --- a/home.admin/config.scripts/bonus.zerotier.sh +++ b/home.admin/config.scripts/bonus.zerotier.sh @@ -38,8 +38,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then exit 1 fi + sshUI=0 networkID=$2 if [ ${#networkID} -eq 0 ]; then + + sshUI=1 trap 'rm -f "$_temp"' EXIT _temp=$(mktemp -p /dev/shm/) @@ -53,9 +56,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then rm -f "$_temp" if [ -z "$networkID" ]; then - echo "error='cancel'" + dialog --msgbox "ZeroTier Connection canceled." 8 46 exit 0 fi + clear fi echo "# *** INSTALL ZeroTier ***" @@ -80,9 +84,19 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then # sudo /home/admin/config.scripts/lnd.credentials.sh reset "${chain:-main}net" tls # sudo /home/admin/config.scripts/lnd.credentials.sh sync "${chain:-main}net" + if [ $sshUI -eq 1 ]; then + dialog --msgbox "Your RaspiBlitz joined the ZeroTier network." 6 46 + else + echo "# OK, ZeroTier is joined." + fi + else sudo -u admin sudo apt -y purge zerotier-one 1>&2 - echo "error='ZeroTier join failed'" + if [ $sshUI -eq 1 ]; then + dialog --msgbox "FAILED: Joining the ZeroTier networkID(${networkID})" 6 46 + else + echo "error='ZeroTier join failed'" + fi fi exit 0 fi