From 8c56ae771739fdb67e49a5b6f5dc2caab51a0e2d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 11 Jul 2015 12:01:46 +0100 Subject: [PATCH] Add tox node public key to the readme --- src/freedombone | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/freedombone b/src/freedombone index 67f01c42..f8d82635 100755 --- a/src/freedombone +++ b/src/freedombone @@ -7605,8 +7605,28 @@ function install_tox_node { systemctl status tox-bootstrapd.service exit 5846 fi + + systemctl restart tox-bootstrapd.service + TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}') + if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then + echo 'Could not obtain the tox node public key' + exit 6529 + fi + configure_firewall_for_tox + if ! grep -q "Tox node" /home/$MY_USERNAME/README; then + XMPP_PASSWORD="$(openssl rand -base64 8)" + prosodyctl register $MY_USERNAME $DEFAULT_DOMAIN_NAME $XMPP_PASSWORD + echo '' >> /home/$MY_USERNAME/README + echo '' >> /home/$MY_USERNAME/README + echo 'Tox' >> /home/$MY_USERNAME/README + echo '===' >> /home/$MY_USERNAME/README + echo "Your Tox node public key is: $TOX_PUBLIC_KEY" >> /home/$MY_USERNAME/README + chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README + chmod 600 /home/$MY_USERNAME/README + fi + echo 'install_tox_node' >> $COMPLETION_FILE }