浏览代码

Separate avahi configuration

Bob Mottram 10 年前
父节点
当前提交
5641cd3bc8
共有 1 个文件被更改,包括 24 次插入2 次删除
  1. 24
    2
      src/freedombone

+ 24
- 2
src/freedombone 查看文件

1637
   echo 'install_atheros_wifi' >> $COMPLETION_FILE
1637
   echo 'install_atheros_wifi' >> $COMPLETION_FILE
1638
 }
1638
 }
1639
 
1639
 
1640
+function configure_avahi {
1641
+  if grep -Fxq "configure_avahi" $COMPLETION_FILE; then
1642
+      return
1643
+  fi
1644
+  # only enable avahi if we're doing mesh networking
1645
+  if [[ $ENABLE_BABEL != "yes" && $ENABLE_BATMAN != "yes" && $ENABLE_CJDNS != "yes" ]]; then
1646
+      return
1647
+  fi
1648
+  apt-get -y install avahi-utils avahi-autoipd
1649
+
1650
+  if [ $DEFAULT_DOMAIN_NAME ]; then
1651
+      sed -i "s|#host-name=.*|host-name=$DEFAULT_DOMAIN_NAME|g" /etc/avahi/avahi-daemon.conf
1652
+  else
1653
+      decarray=( 1 2 3 4 5 6 7 8 9 0 )
1654
+      PEER_ID=${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}${decarray[$RANDOM%10]}
1655
+      sed -i "s|#host-name=.*|host-name=freedombone-$PEER_ID|g" /etc/avahi/avahi-daemon.conf
1656
+  fi
1657
+  systemctl restart avahi-daemon
1658
+  echo 'configure_avahi' >> $COMPLETION_FILE
1659
+}
1660
+
1640
 function mesh_babel {
1661
 function mesh_babel {
1641
   if grep -Fxq "mesh_babel" $COMPLETION_FILE; then
1662
   if grep -Fxq "mesh_babel" $COMPLETION_FILE; then
1642
       return
1663
       return
1644
   if [[ $ENABLE_BABEL != "yes" ]]; then
1665
   if [[ $ENABLE_BABEL != "yes" ]]; then
1645
       return
1666
       return
1646
   fi
1667
   fi
1647
-  apt-get -y install babeld avahi-utils avahi-autoipd
1668
+  apt-get -y install babeld
1648
 
1669
 
1649
   numarray=( 1 2 3 4 5 6 7 8 9 0 )
1670
   numarray=( 1 2 3 4 5 6 7 8 9 0 )
1650
   a=${numarray[$RANDOM%2]}${numarray[$RANDOM%10]}${numarray[$RANDOM%10]}
1671
   a=${numarray[$RANDOM%2]}${numarray[$RANDOM%10]}${numarray[$RANDOM%10]}
1678
 
1699
 
1679
   apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
1700
   apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
1680
   apt-get -y install python-dev libevent-dev ebtables python-pip git
1701
   apt-get -y install python-dev libevent-dev ebtables python-pip git
1681
-  apt-get -y install avahi-utils avahi-autoipd wireless-tools
1702
+  apt-get -y install wireless-tools
1682
 
1703
 
1683
   install_vpn_tunnel
1704
   install_vpn_tunnel
1684
 
1705
 
9851
 time_synchronisation
9872
 time_synchronisation
9852
 configure_internet_protocol
9873
 configure_internet_protocol
9853
 create_git_project
9874
 create_git_project
9875
+configure_avahi
9854
 install_atheros_wifi
9876
 install_atheros_wifi
9855
 mesh_cjdns
9877
 mesh_cjdns
9856
 mesh_cjdns_tools
9878
 mesh_cjdns_tools