瀏覽代碼

systemd or init

Bob Mottram 10 年之前
父節點
當前提交
820a66a06c
共有 2 個檔案被更改,包括 11 行新增3 行删除
  1. 1
    1
      src/freedombone
  2. 10
    2
      src/freedombone-client

+ 1
- 1
src/freedombone 查看文件

@@ -1702,7 +1702,7 @@ function configure_avahi {
1702 1702
   # this is a blatant hack, but I couldn't find a better way of mitigating the problem
1703 1703
   # of avahi-daemon stopping after a few minutes
1704 1704
   if ! grep -q "avahi-daemon" /etc/crontab; then
1705
-      echo '2 * * * *   root    systemctl restart avahi-daemon' >> /etc/crontab
1705
+      echo '2 * * * *   root    systemctl restart avahi-daemon > /dev/null' >> /etc/crontab
1706 1706
   fi
1707 1707
 
1708 1708
   echo 'configure_avahi' >> $COMPLETION_FILE

+ 10
- 2
src/freedombone-client 查看文件

@@ -119,7 +119,11 @@ function mesh_babel {
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 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
122
+  echo '        if [ -f /bin/systemctl ]; then' >> $babel_script
123
+  echo "            echo '2 *   * * *   root    systemctl restart avahi-daemon > /dev/null' >> /etc/crontab" >> $babel_script
124
+  echo '        else' >> $babel_script
125
+  echo "            echo '2 *   * * *   root    service avahi-daemon restart > /dev/null' >> /etc/crontab" >> $babel_script
126
+  echo '        fi' >> $babel_script
123 127
   echo '    fi' >> $babel_script
124 128
   echo '    if [ -f /bin/systemctl ]; then' >> $babel_script
125 129
   echo '        systemctl restart avahi-daemon' >> $babel_script
@@ -199,7 +203,11 @@ function mesh_batman {
199 203
   echo '    sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf' >> $batman_script
200 204
   echo '    sed -i "s|hosts:.*|hosts:          files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf' >> $batman_script
201 205
   echo '    if ! grep -q "avahi-daemon" /etc/crontab; then' >> $batman_script
202
-  echo "        echo '2 *   * * *   root    systemctl restart avahi-daemon' >> /etc/crontab" >> $batman_script
206
+  echo '        if [ -f /bin/systemctl ]; then' >> $batman_script
207
+  echo "            echo '2 *   * * *   root    systemctl restart avahi-daemon > /dev/null' >> /etc/crontab" >> $batman_script
208
+  echo '        else' >> $batman_script
209
+  echo "            echo '2 *   * * *   root    service avahi-daemon restart > /dev/null' >> /etc/crontab" >> $batman_script
210
+  echo '        fi' >> $batman_script
203 211
   echo '    fi' >> $batman_script
204 212
   echo 'fi' >> $batman_script
205 213
   echo '' >> $batman_script