From 41c0c6f449fc277c29b3f8beb158203a83552c36 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 25 Aug 2015 18:43:27 +0100 Subject: [PATCH] Alter to use avahi scripts from toxid --- src/freedombone | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/src/freedombone b/src/freedombone index 5546a71f..c93531b5 100755 --- a/src/freedombone +++ b/src/freedombone @@ -8167,45 +8167,16 @@ function tox_avahi { exit 58432 fi make install - - # script to publish the tox user - if [ ! -f /usr/bin/publish-to-avahi ]; then - echo '#!/bin/bash' > /usr/bin/publish-to-avahi - fi - echo '' >> /usr/bin/publish-to-avahi - echo "DATA_FILE=/home/$MY_USERNAME/.config/tox/data" >> /usr/bin/publish-to-avahi - echo 'if [ ! -f $DATA_FILE ]; then' >> /usr/bin/publish-to-avahi - echo ' exit 0' >> /usr/bin/publish-to-avahi - echo 'fi' >> /usr/bin/publish-to-avahi - echo '' >> /usr/bin/publish-to-avahi - echo -n 'TOX_ID=$(toxid -u ' >> /usr/bin/publish-to-avahi - echo "$MY_USERNAME)" >> /usr/bin/publish-to-avahi - echo '' >> /usr/bin/publish-to-avahi - - echo "echo \"\" > /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi - echo "echo '' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi - echo "echo '' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi - echo -n 'echo " > /usr/bin/publish-to-avahi - echo '>%h $TOX_ID" >> /etc/avahi/services/tox.service' >> /usr/bin/publish-to-avahi - echo "echo ' ' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi - echo "echo ' _tox._tcp' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi - echo "echo \" $TOX_PORT\" >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi - echo "echo ' ' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi - echo "echo '' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi - - echo '' >> /usr/bin/publish-to-avahi - echo 'exit 0' >> /usr/bin/publish-to-avahi - chmod +x /usr/bin/publish-to-avahi - - publish-to-avahi - systemctl restart avahi-daemon + + toxavahi # publish regularly - if ! grep -Fxq "publish-to-avahi" /etc/crontab; then - echo '* * * * * root /usr/bin/publish-to-avahi > /dev/null' >> /etc/crontab + if ! grep -Fxq "toxavahi" /etc/crontab; then + echo '* * * * * root toxavahi > /dev/null' >> /etc/crontab fi + systemctl restart avahi-daemon + echo 'tox_avahi' >> $COMPLETION_FILE }