Browse Source

Only install avahi on mesh startup

Bob Mottram 9 years ago
parent
commit
c9e58f1852
1 changed files with 10 additions and 8 deletions
  1. 10
    8
      src/freedombone-client

+ 10
- 8
src/freedombone-client View File

@@ -95,14 +95,16 @@ function mesh_babel {
95 95
 
96 96
   echo '#!/bin/sh' > $babel_script
97 97
   echo '' >> $babel_script
98
-  echo '# install avahi' >> $babel_script
99
-  echo 'apt-get -y install avahi-utils avahi-autoipd' >> $babel_script
100
-  echo 'sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
101
-  echo 'sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
102
-  echo 'if [ -f /bin/systemctl ]; then' >> $babel_script
103
-  echo '    systemctl restart avahi-daemon' >> $babel_script
104
-  echo 'else' >> $babel_script
105
-  echo '    service avahi-daemon restart' >> $babel_script
98
+  echo 'if [[ $1 == "start" ]]; then' >> $babel_script
99
+  echo '    # install avahi' >> $babel_script
100
+  echo '    apt-get -y install avahi-utils avahi-autoipd' >> $babel_script
101
+  echo '    sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
102
+  echo '    sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
103
+  echo '    if [ -f /bin/systemctl ]; then' >> $babel_script
104
+  echo '        systemctl restart avahi-daemon' >> $babel_script
105
+  echo '    else' >> $babel_script
106
+  echo '        service avahi-daemon restart' >> $babel_script
107
+  echo '    fi' >> $babel_script
106 108
   echo 'fi' >> $babel_script
107 109
   echo '' >> $babel_script
108 110
   echo 'IFACE=wlan0' >> $babel_script