fix zerotier dialogs (#4495)

This commit is contained in:
/rootzoll 2024-03-21 21:34:53 +01:00 committed by GitHub
parent e4cf6d294a
commit 02fca137b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 12 deletions

View file

@ -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

View file

@ -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