ソースを参照

Hack to work around erratic avahi-daemon behavior

Bob Mottram 9 年 前
コミット
fcd1799e94
共有2 個のファイルを変更した13 個の追加0 個の削除を含む
  1. 7
    0
      src/freedombone
  2. 6
    0
      src/freedombone-client

+ 7
- 0
src/freedombone ファイルの表示

@@ -1698,6 +1698,13 @@ function configure_avahi {
1698 1698
   echo '</service-group>' >> /etc/avahi/services/irc.service
1699 1699
 
1700 1700
   systemctl restart avahi-daemon
1701
+
1702
+  # this is a blatant hack, but I couldn't find a better way of mitigating the problem
1703
+  # of avahi-daemon stopping after a few minutes
1704
+  if ! grep -q "avahi-daemon" /etc/crontab; then
1705
+      echo '2 * * * *   root    systemctl restart avahi-daemon' >> /etc/crontab
1706
+  fi
1707
+
1701 1708
   echo 'configure_avahi' >> $COMPLETION_FILE
1702 1709
 }
1703 1710
 

+ 6
- 0
src/freedombone-client ファイルの表示

@@ -118,6 +118,9 @@ function mesh_babel {
118 118
   echo '    apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd' >> $babel_script
119 119
   echo '    sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
120 120
   echo '    sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
121
+  echo '    if ! grep -q "avahi-daemon" /etc/crontab; then' >> $babel_script
122
+  echo "        echo '2 *   * * *   root    systemctl restart avahi-daemon' >> /etc/crontab" >> $babel_script
123
+  echo '    fi' >> $babel_script
121 124
   echo '    if [ -f /bin/systemctl ]; then' >> $babel_script
122 125
   echo '        systemctl restart avahi-daemon' >> $babel_script
123 126
   echo '    else' >> $babel_script
@@ -195,6 +198,9 @@ function mesh_batman {
195 198
   echo '    sed -i "s|use-ipv4=.*|use-ipv4=yes|g" /etc/avahi/avahi-daemon.conf' >> $batman_script
196 199
   echo '    sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf' >> $batman_script
197 200
   echo '    sed -i "s|hosts:.*|hosts:          files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf' >> $batman_script
201
+  echo '    if ! grep -q "avahi-daemon" /etc/crontab; then' >> $batman_script
202
+  echo "        echo '2 *   * * *   root    systemctl restart avahi-daemon' >> /etc/crontab" >> $batman_script
203
+  echo '    fi' >> $batman_script
198 204
   echo 'fi' >> $batman_script
199 205
   echo '' >> $batman_script
200 206
   echo '# Mesh definition' >> $batman_script