Alter to use avahi scripts from toxid
This commit is contained in:
parent
96bcdd36d5
commit
41c0c6f449
|
@ -8168,44 +8168,15 @@ function tox_avahi {
|
||||||
fi
|
fi
|
||||||
make install
|
make install
|
||||||
|
|
||||||
# script to publish the tox user
|
toxavahi
|
||||||
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 \"<?xml version='1.0' standalone='no'?><!--*-nxml-*-->\" > /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi
|
|
||||||
echo "echo '<!DOCTYPE service-group SYSTEM \"avahi-service.dtd\">' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi
|
|
||||||
echo "echo '<service-group>' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi
|
|
||||||
echo -n 'echo " <name replace-wildcards=' >> /usr/bin/publish-to-avahi
|
|
||||||
echo -n "'yes'" >> /usr/bin/publish-to-avahi
|
|
||||||
echo '>%h $TOX_ID</name>" >> /etc/avahi/services/tox.service' >> /usr/bin/publish-to-avahi
|
|
||||||
echo "echo ' <service>' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi
|
|
||||||
echo "echo ' <type>_tox._tcp</type>' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi
|
|
||||||
echo "echo \" <port>$TOX_PORT</port>\" >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi
|
|
||||||
echo "echo ' </service>' >> /etc/avahi/services/tox.service" >> /usr/bin/publish-to-avahi
|
|
||||||
echo "echo '</service-group>' >> /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
|
|
||||||
|
|
||||||
# publish regularly
|
# publish regularly
|
||||||
if ! grep -Fxq "publish-to-avahi" /etc/crontab; then
|
if ! grep -Fxq "toxavahi" /etc/crontab; then
|
||||||
echo '* * * * * root /usr/bin/publish-to-avahi > /dev/null' >> /etc/crontab
|
echo '* * * * * root toxavahi > /dev/null' >> /etc/crontab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
systemctl restart avahi-daemon
|
||||||
|
|
||||||
echo 'tox_avahi' >> $COMPLETION_FILE
|
echo 'tox_avahi' >> $COMPLETION_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue