avahi services

This commit is contained in:
Bob Mottram 2015-08-09 13:46:26 +01:00
parent 9450b24fcc
commit 482a120a19
1 changed files with 26 additions and 0 deletions

View File

@ -1658,11 +1658,37 @@ function configure_avahi {
sed -i "s|#host-name=.*|host-name=mesh-$PEER_ID|g" /etc/avahi/avahi-daemon.conf sed -i "s|#host-name=.*|host-name=mesh-$PEER_ID|g" /etc/avahi/avahi-daemon.conf
fi fi
if [ ! -d /etc/avahi/services ]; then
mkdir -p /etc/avahi/services
fi
# remove an avahi service which isn't used # remove an avahi service which isn't used
if [ -f /etc/avahi/services/udisks.service ]; then if [ -f /etc/avahi/services/udisks.service ]; then
rm /etc/avahi/services/udisks.service rm /etc/avahi/services/udisks.service
fi fi
# Add an ssh service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /etc/avahi/services/ssh.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /etc/avahi/services/ssh.service
echo '<service-group>' >> /etc/avahi/services/ssh.service
echo '<name replace-wildcards="yes">%h SSH</name>' >> /etc/avahi/services/ssh.service
echo '<service>' >> /etc/avahi/services/ssh.service
echo '<type>_ssh._tcp</type>' >> /etc/avahi/services/ssh.service
echo "<port>$SSH_PORT</port>" >> /etc/avahi/services/ssh.service
echo '</service>' >> /etc/avahi/services/ssh.service
echo '</service-group>' >> /etc/avahi/services/ssh.service
# Add an irc service
echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /etc/avahi/services/irc.service
echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /etc/avahi/services/irc.service
echo '<service-group>' >> /etc/avahi/services/irc.service
echo '<name replace-wildcards="yes">%h IRC</name>' >> /etc/avahi/services/irc.service
echo '<service>' >> /etc/avahi/services/irc.service
echo '<type>_irc._tcp</type>' >> /etc/avahi/services/irc.service
echo "<port>6697</port>" >> /etc/avahi/services/irc.service
echo '</service>' >> /etc/avahi/services/irc.service
echo '</service-group>' >> /etc/avahi/services/irc.service
systemctl restart avahi-daemon systemctl restart avahi-daemon
echo 'configure_avahi' >> $COMPLETION_FILE echo 'configure_avahi' >> $COMPLETION_FILE
} }