Browse Source

systemd or init

Bob Mottram 10 years ago
parent
commit
820a66a06c
2 changed files with 11 additions and 3 deletions
  1. 1
    1
      src/freedombone
  2. 10
    2
      src/freedombone-client

+ 1
- 1
src/freedombone View File

1702
   # this is a blatant hack, but I couldn't find a better way of mitigating the problem
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
1703
   # of avahi-daemon stopping after a few minutes
1704
   if ! grep -q "avahi-daemon" /etc/crontab; then
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
   fi
1706
   fi
1707
 
1707
 
1708
   echo 'configure_avahi' >> $COMPLETION_FILE
1708
   echo 'configure_avahi' >> $COMPLETION_FILE

+ 10
- 2
src/freedombone-client View File

119
   echo '    sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
119
   echo '    sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
120
   echo '    sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
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
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
   echo '    fi' >> $babel_script
127
   echo '    fi' >> $babel_script
124
   echo '    if [ -f /bin/systemctl ]; then' >> $babel_script
128
   echo '    if [ -f /bin/systemctl ]; then' >> $babel_script
125
   echo '        systemctl restart avahi-daemon' >> $babel_script
129
   echo '        systemctl restart avahi-daemon' >> $babel_script
199
   echo '    sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf' >> $batman_script
203
   echo '    sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf' >> $batman_script
200
   echo '    sed -i "s|hosts:.*|hosts:          files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf' >> $batman_script
204
   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
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
   echo '    fi' >> $batman_script
211
   echo '    fi' >> $batman_script
204
   echo 'fi' >> $batman_script
212
   echo 'fi' >> $batman_script
205
   echo '' >> $batman_script
213
   echo '' >> $batman_script