Browse Source

Add avahi service for matrix

Bob Mottram 7 years ago
parent
commit
23fc305fb2
1 changed files with 20 additions and 0 deletions
  1. 20
    0
      src/freedombone-app-matrix

+ 20
- 0
src/freedombone-app-matrix View File

597
 
597
 
598
     remove_completion_param install_matrix
598
     remove_completion_param install_matrix
599
     sed -i '/matrix/d' $COMPLETION_FILE
599
     sed -i '/matrix/d' $COMPLETION_FILE
600
+
601
+    rm /etc/avahi/services/matrix.service
602
+    systemctl restart avahi-daemon
600
 }
603
 }
601
 
604
 
602
 function install_home_server {
605
 function install_home_server {
802
 
805
 
803
     set_completion_param "matrix domain" "$MATRIX_DOMAIN_NAME"
806
     set_completion_param "matrix domain" "$MATRIX_DOMAIN_NAME"
804
 
807
 
808
+    # Add avahi services
809
+    echo '<?xml version="1.0" standalone="no"?><!--*-nxml-*-->' > /etc/avahi/services/matrix.service
810
+    echo '<!DOCTYPE service-group SYSTEM "avahi-service.dtd">' >> /etc/avahi/services/matrix.service
811
+    echo '<service-group>' >> /etc/avahi/services/matrix.service
812
+    echo '  <name replace-wildcards="yes">%h MATRIX</name>' >> /etc/avahi/services/matrix.service
813
+    echo '  <service>' >> /etc/avahi/services/matrix.service
814
+    echo '    <type>_matrix._tcp</type>' >> /etc/avahi/services/matrix.service
815
+    echo "    <port>$MATRIX_HTTP_PORT</port>" >> /etc/avahi/services/matrix.service
816
+    echo '  </service>' >> /etc/avahi/services/matrix.service
817
+    echo '  <service>' >> /etc/avahi/services/matrix.service
818
+    echo '    <type>_matrix._udp</type>' >> /etc/avahi/services/matrix.service
819
+    echo "    <port>$MATRIX_HTTP_PORT</port>" >> /etc/avahi/services/matrix.service
820
+    echo '  </service>' >> /etc/avahi/services/matrix.service
821
+    echo '</service-group>' >> /etc/avahi/services/matrix.service
822
+
823
+    systemctl restart avahi-daemon
824
+
805
     APP_INSTALLED=1
825
     APP_INSTALLED=1
806
 }
826
 }