浏览代码

Install atheros wifi driver for use with mesh

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

+ 80
- 43
src/freedombone 查看文件

@@ -1576,6 +1576,67 @@ function get_batman_ipv6_address {
1576 1576
   fi
1577 1577
 }
1578 1578
 
1579
+function install_vpn_tunnel {
1580
+  if ! grep -q "repo.universe-factory.net" /etc/apt/sources.list; then
1581
+      echo 'deb http://repo.universe-factory.net/debian/ sid main' >> /etc/apt/sources.list
1582
+      gpg --keyserver pgpkeys.mit.edu --recv-key 16EF3F64CB201D9C
1583
+      if [ ! "$?" = "0" ]; then
1584
+          exit 76272
1585
+      fi
1586
+      gpg -a --export 16EF3F64CB201D9C | sudo apt-key add -
1587
+      apt-get update
1588
+      apt-get -y install fastd
1589
+      if [ ! "$?" = "0" ]; then
1590
+          exit 52026
1591
+      fi
1592
+  fi
1593
+}
1594
+
1595
+# ath9k_htc driver
1596
+function install_atheros_wifi {
1597
+  if grep -Fxq "install_atheros_wifi" $COMPLETION_FILE; then
1598
+      return
1599
+  fi
1600
+  if [ $INSTALLING_ON_BBB != "yes" ]; then
1601
+      return
1602
+  fi
1603
+  if [[ $ENABLE_BABEL != "yes" && $ENABLE_BATMAN != "yes" && $ENABLE_CJDNS != "yes" ]]; then
1604
+      return
1605
+  fi
1606
+  if [ -d $INSTALL_DIR/open-ath9k-htc-firmware ]; then
1607
+      return
1608
+  fi
1609
+  apt-get -y install build-essential cmake git m4 texinfo
1610
+  if [ ! -d $INSTALL_DIR ]; then
1611
+      mkdir -p $INSTALL_DIR
1612
+  fi
1613
+  cd $INSTALL_DIR
1614
+  if [ ! -d $INSTALL_DIR/open-ath9k-htc-firmware ]; then
1615
+      git clone https://github.com/qca/open-ath9k-htc-firmware.git
1616
+      if [ ! "$?" = "0" ]; then
1617
+          rm -rf $INSTALL_DIR/open-ath9k-htc-firmware
1618
+          exit 74283
1619
+      fi
1620
+  fi
1621
+  cd $INSTALL_DIR/open-ath9k-htc-firmware
1622
+  git checkout 1.4.0
1623
+  make toolchain
1624
+  if [ ! "$?" = "0" ]; then
1625
+      rm -rf $INSTALL_DIR/open-ath9k-htc-firmware
1626
+      exit 24820
1627
+  fi
1628
+  make firmware
1629
+  if [ ! "$?" = "0" ]; then
1630
+      rm -rf $INSTALL_DIR/open-ath9k-htc-firmware
1631
+      exit 63412
1632
+  fi
1633
+  cp target_firmware/*.fw /lib/firmware/
1634
+  if [ ! "$?" = "0" ]; then
1635
+      exit 74681
1636
+  fi
1637
+  echo 'install_atheros_wifi' >> $COMPLETION_FILE
1638
+}
1639
+
1579 1640
 function mesh_babel {
1580 1641
   if grep -Fxq "mesh_babel" $COMPLETION_FILE; then
1581 1642
       return
@@ -1617,7 +1678,10 @@ function mesh_batman_bridge {
1617 1678
 
1618 1679
   apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
1619 1680
   apt-get -y install python-dev libevent-dev ebtables python-pip git
1681
+  apt-get -y install avahi-utils avahi-autoipd wireless-tools
1620 1682
 
1683
+  install_vpn_tunnel
1684
+  
1621 1685
   modprobe batman-adv
1622 1686
   [ $? -ne 0 ] && echo "B.A.T.M.A.N module not available" && exit 76482
1623 1687
   if ! grep -q "batman_adv" /etc/modules; then
@@ -1640,51 +1704,23 @@ function mesh_batman_bridge {
1640 1704
   if ! grep -q "# Mesh Networking (B.A.T.M.A.N)" /etc/network/interfaces; then
1641 1705
       echo '' >> /etc/network/interfaces
1642 1706
       echo '# Mesh Networking (B.A.T.M.A.N)' >> /etc/network/interfaces
1643
-      echo 'iface bat0 inet6 static' >> /etc/network/interfaces
1644
-      echo '    pre-up modprobe ipv6' >> /etc/network/interfaces
1645
-      echo "    address $BATMAN_IPV6" >> /etc/network/interfaces
1646
-      echo '    netmask 64' >> /etc/network/interfaces
1647
-      service networking restart
1648
-      if [ ! "$?" = "0" ]; then
1649
-          systemctl status networking.service
1650
-          exit 6949
1651
-      fi
1707
+      echo 'auto wlan0' >> /etc/network/interfaces
1708
+      echo 'iface wlan0 inet static' >> /etc/network/interfaces
1709
+      echo '    pre-up modprobe batman_adv' >> /etc/network/interfaces
1710
+      echo '    post-down modprobe -rf batman_adv' >> /etc/network/interfaces
1711
+      echo '    address 0.0.0.0' >> /etc/network/interfaces
1712
+      echo '    mtu 1532' >> /etc/network/interfaces
1713
+      echo '    wireless-mode ad-hoc' >> /etc/network/interfaces
1714
+      echo "    wireless-essid mesh" >> /etc/network/interfaces
1715
+      echo "    wireless-channel 2" >> /etc/network/interfaces
1716
+      echo "    wireless-ap 02:12:34:56:78:9A" >> /etc/network/interfaces
1717
+  fi
1718
+  systemctl restart networking.service
1719
+  if [ ! "$?" = "0" ]; then
1720
+      systemctl status networking.service
1721
+      exit 6949
1652 1722
   fi
1653 1723
 
1654
-  echo '#!/bin/bash' > /usr/bin/mesh
1655
-  echo '' > /usr/bin/mesh
1656
-  echo '# stop network manager to make the mesh network work' >> /usr/bin/mesh
1657
-  echo 'systemctl stop networking' >> /usr/bin/mesh
1658
-  echo '' >> /usr/bin/mesh
1659
-  echo -n '# configure the wlan interface to operate with ' >> /usr/bin/mesh
1660
-  echo 'mtus of 1532(batman requires it) and turn enc off ' >> /usr/bin/mesh
1661
-  echo 'to ensure it works' >> /usr/bin/mesh
1662
-  echo 'ifconfig wlan0 down' >> /usr/bin/mesh
1663
-  echo 'ifconfig wlan0 mtu 1532' >> /usr/bin/mesh
1664
-  echo 'iwconfig wlan0 enc off' >> /usr/bin/mesh
1665
-  echo '' >> /usr/bin/mesh
1666
-  echo '# add the interface to the ad-hoc network - or create it.' >> /usr/bin/mesh
1667
-  echo -n "iwconfig wlan0 mode ad-hoc essid mesh ap " >> /usr/bin/mesh
1668
-  echo "$BATMAN_IPV6 channel 2" >> /usr/bin/mesh
1669
-  echo '' >> /usr/bin/mesh
1670
-  echo -n '# add wlan0 to the batman-adv virtual interface(so it can ' >> /usr/bin/mesh
1671
-  echo 'communicate with other batman-adv nodes)' >> /usr/bin/mesh
1672
-  echo 'batctl if add wlan0' >> /usr/bin/mesh
1673
-  echo 'ifconfig wlan0 up' >> /usr/bin/mesh
1674
-  echo 'ifconfig bat0 up' >> /usr/bin/mesh
1675
-  echo '' >> /usr/bin/mesh
1676
-  echo -n '# make the bridge linking the batman-adv virtual ' >> /usr/bin/mesh
1677
-  echo 'interface to the ethernet port' >> /usr/bin/mesh
1678
-  echo 'brctl addbr bridge-link' >> /usr/bin/mesh
1679
-  echo 'brctl addif bridge-link bat0' >> /usr/bin/mesh
1680
-  echo '#brctl addif bridge-link eth0' >> /usr/bin/mesh
1681
-  echo '' >> /usr/bin/mesh
1682
-  echo '# get the ip address for the bridge from the dhcp server' >> /usr/bin/mesh
1683
-  echo 'dhclient bridge-link' >> /usr/bin/mesh
1684
-  echo '' >> /usr/bin/mesh
1685
-  echo 'exit 0' >> /usr/bin/mesh
1686
-  chmod +x /usr/bin/mesh
1687
-
1688 1724
   if ! grep -q "Mesh Networking (B.A.T.M.A.N)" /home/$MY_USERNAME/README; then
1689 1725
       echo '' >> /home/$MY_USERNAME/README
1690 1726
       echo '' >> /home/$MY_USERNAME/README
@@ -9813,6 +9849,7 @@ set_your_domain_name
9813 9849
 time_synchronisation
9814 9850
 configure_internet_protocol
9815 9851
 create_git_project
9852
+install_atheros_wifi
9816 9853
 mesh_cjdns
9817 9854
 mesh_cjdns_tools
9818 9855
 mesh_batman_bridge