From 70578c774991c4fc3f8e6705907acf9511c9f163 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 21 Jul 2016 21:05:41 +0100 Subject: [PATCH] Batman client not needed --- src/freedombone-client | 2 - src/freedombone-mesh-install | 262 ----------------------------------- 2 files changed, 264 deletions(-) diff --git a/src/freedombone-client b/src/freedombone-client index 55787cd7..9b323d1c 100755 --- a/src/freedombone-client +++ b/src/freedombone-client @@ -196,8 +196,6 @@ if [[ $MESH_CLIENT_INSTALL == $'yes' || $MESH_CLIENT_INSTALL == $'y' || $MESH_CL sudo ${PROJECT_NAME}-mesh-install -f toxic ${PROJECT_NAME}-mesh-install -f qtox sudo ${PROJECT_NAME}-mesh-install -f zeronet - - ${PROJECT_NAME}-mesh-install -f batman_client fi echo $'Configuration complete' exit 0 diff --git a/src/freedombone-mesh-install b/src/freedombone-mesh-install index f63c7bec..4aea4183 100755 --- a/src/freedombone-mesh-install +++ b/src/freedombone-mesh-install @@ -445,265 +445,6 @@ function mesh_tox_client_toxic_from_repo { echo "Toxic Installed." } -function install_batman_client { - TOXIC_FILE=$(cat /usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-tox | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}') - - if [ ! -f ${rootdir}/tmp/meshtype ]; then - $CHROOT_PREFIX sudo apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl - $CHROOT_PREFIX sudo apt-get -y install python-dev libevent-dev ebtables python-pip - $CHROOT_PREFIX sudo apt-get -y install wireless-tools rfkill - if [ ! -f $TOXIC_FILE ]; then - $CHROOT_PREFIX sudo apt-get -y install toxic - fi - fi - - BATMAN_SCRIPT=${rootdir}/tmp/batman - - echo '#!/bin/bash' > $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo 'if [[ $1 == "start" ]]; then' >> $BATMAN_SCRIPT - echo ' # install avahi' >> $BATMAN_SCRIPT - echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd bittornado' >> $BATMAN_SCRIPT - echo ' sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT - echo ' sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT - echo ' sed -i "s|use-ipv4=.*|use-ipv4=yes|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT - echo ' sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT - echo ' sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT - echo ' sed -i "s|hosts:.*|hosts: files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf' >> $BATMAN_SCRIPT - echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT - echo ' systemctl restart avahi-daemon' >> $BATMAN_SCRIPT - echo ' else' >> $BATMAN_SCRIPT - echo ' service avahi-daemon restart' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo 'fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo '# Mesh definition' >> $BATMAN_SCRIPT - echo "WIFI_SSID=$WIFI_SSID" >> $BATMAN_SCRIPT - echo "CELLID=$BATMAN_CELLID" >> $BATMAN_SCRIPT - echo "CHANNEL=$WIFI_CHANNEL" >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo '# Ethernet bridge definition (bridged to bat0)' >> $BATMAN_SCRIPT - echo 'BRIDGE=br-mesh' >> $BATMAN_SCRIPT - echo "IFACE=$WIFI_INTERFACE" >> $BATMAN_SCRIPT - echo 'EIFACE=eth0' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT - echo ' if grep -q "wlan1" /proc/net/dev; then' >> $BATMAN_SCRIPT - echo ' IFACE=wlan1' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo 'fi' >> $BATMAN_SCRIPT - echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT - echo ' if grep -q "wlan2" /proc/net/dev; then' >> $BATMAN_SCRIPT - echo ' IFACE=wlan2' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo 'fi' >> $BATMAN_SCRIPT - echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT - echo ' if grep -q "wlan3" /proc/net/dev; then' >> $BATMAN_SCRIPT - echo ' IFACE=wlan3' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo 'fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo 'if [ -e /etc/default/batctl ]; then' >> $BATMAN_SCRIPT - echo ' . /etc/default/batctl' >> $BATMAN_SCRIPT - echo 'fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo 'start() {' >> $BATMAN_SCRIPT - echo ' if [ -f /tmp/meshtype ] ; then' >> $BATMAN_SCRIPT - echo ' echo "Mesh already running"' >> $BATMAN_SCRIPT - echo ' return' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' if [ -z "$IFACE" ] ; then' >> $BATMAN_SCRIPT - echo ' echo "error: unable to find wifi interface, not enabling batman-adv mesh"' >> $BATMAN_SCRIPT - echo ' return' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"' >> $BATMAN_SCRIPT - - echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT - echo ' systemctl stop network-manager' >> $BATMAN_SCRIPT - echo ' else' >> $BATMAN_SCRIPT - echo ' service network-manager stop' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' sleep 5' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo " # remove an avahi service which isn't used" >> $BATMAN_SCRIPT - echo ' if [ -f /etc/avahi/services/udisks.service ]; then' >> $BATMAN_SCRIPT - echo ' sudo rm /etc/avahi/services/udisks.service' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' # Might have to re-enable wifi' >> $BATMAN_SCRIPT - echo ' rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' ifconfig $IFACE down' >> $BATMAN_SCRIPT - echo ' ifconfig $IFACE mtu 1532' >> $BATMAN_SCRIPT - echo ' iwconfig $IFACE enc off' >> $BATMAN_SCRIPT - echo ' iwconfig $IFACE mode ad-hoc essid $WIFI_SSID channel $CHANNEL' >> $BATMAN_SCRIPT - echo ' sleep 1' >> $BATMAN_SCRIPT - echo ' iwconfig $IFACE ap $CELLID' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' modprobe batman-adv' >> $BATMAN_SCRIPT - echo ' batctl if add $IFACE' >> $BATMAN_SCRIPT - echo ' ifconfig $IFACE up' >> $BATMAN_SCRIPT - echo ' avahi-autoipd --force-bind --daemonize --wait $BRIDGE' >> $BATMAN_SCRIPT - echo ' avahi-autoipd --force-bind --daemonize --wait $IFACE' >> $BATMAN_SCRIPT - echo ' ifconfig bat0 up promisc' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' #Use persistent HWAddr' >> $BATMAN_SCRIPT - echo ' ether_new=$(ifconfig eth0 | grep HWaddr | sed -e "s/.*HWaddr //")' >> $BATMAN_SCRIPT - echo ' if [ ! -f /var/lib/mesh-node/bat0 ]; then' >> $BATMAN_SCRIPT - echo ' mkdir /var/lib/mesh-node' >> $BATMAN_SCRIPT - echo ' echo "${ether_new}" > /var/lib/mesh-node/bat0' >> $BATMAN_SCRIPT - echo ' else' >> $BATMAN_SCRIPT - echo ' ether=$(cat /var/lib/mesh-node/bat0)' >> $BATMAN_SCRIPT - echo ' ifconfig bat0 hw ether ${ether}' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' if [ "$EIFACE" ] ; then' >> $BATMAN_SCRIPT - echo ' brctl addbr $BRIDGE' >> $BATMAN_SCRIPT - echo ' brctl addif $BRIDGE bat0' >> $BATMAN_SCRIPT - echo ' brctl addif $BRIDGE $EIFACE' >> $BATMAN_SCRIPT - echo ' ifconfig bat0 0.0.0.0' >> $BATMAN_SCRIPT - echo ' ifconfig $EIFACE 0.0.0.0' >> $BATMAN_SCRIPT - echo ' ifconfig $EIFACE up promisc' >> $BATMAN_SCRIPT - echo ' ifconfig $BRIDGE up' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' iptables -A INPUT -p tcp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -A INPUT -p udp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -A INPUT -p tcp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -A INPUT -p udp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -A INPUT -p tcp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -A INPUT -p udp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT - echo " iptables -A INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -A INPUT -p udp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -A INPUT -p udp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -A INPUT -p tcp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -A INPUT -p tcp --dport $IPFS_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -A INPUT -p udp --dport 1900 -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -A INPUT -p tcp --dport 80 -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -A INPUT -p udp -m udp -j ACCEPT" >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT - echo ' systemctl restart avahi-daemon' >> $BATMAN_SCRIPT - echo ' else' >> $BATMAN_SCRIPT - echo ' service avahi-daemon restart' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' echo "batman" > /tmp/meshtype' >> $BATMAN_SCRIPT - echo '}' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo 'stop() {' >> $BATMAN_SCRIPT - echo ' if [ -z "$IFACE" ]; then' >> $BATMAN_SCRIPT - echo ' echo "error: unable to find wifi interface, not enabling batman-adv mesh"' >> $BATMAN_SCRIPT - echo ' return' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' if [ "$EIFACE" ]; then' >> $BATMAN_SCRIPT - echo ' brctl delif $BRIDGE bat0' >> $BATMAN_SCRIPT - echo ' brctl delif $BRIDGE $EIFACE' >> $BATMAN_SCRIPT - echo ' ifconfig $BRIDGE down || true' >> $BATMAN_SCRIPT - echo ' brctl delbr $BRIDGE' >> $BATMAN_SCRIPT - echo ' ifconfig $EIFACE down -promisc' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' avahi-autoipd -k $BRIDGE' >> $BATMAN_SCRIPT - echo ' avahi-autoipd -k $IFACE' >> $BATMAN_SCRIPT - echo ' ifconfig bat0 down -promisc' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' batctl if del $IFACE' >> $BATMAN_SCRIPT - echo ' rmmod batman-adv' >> $BATMAN_SCRIPT - echo ' ifconfig $IFACE mtu 1500' >> $BATMAN_SCRIPT - echo ' ifconfig $IFACE down' >> $BATMAN_SCRIPT - echo ' iwconfig $IFACE mode managed' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' iptables -D INPUT -p tcp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -D INPUT -p udp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -D INPUT -p tcp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -D INPUT -p udp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -D INPUT -p tcp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT - echo ' iptables -D INPUT -p udp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT - echo " iptables -D INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -D INPUT -p udp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -D INPUT -p udp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -D INPUT -p tcp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -D INPUT -p tcp --dport $IPFS_PORT -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -D INPUT -p udp --dport 1900 -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -D INPUT -p tcp --dport 80 -j ACCEPT" >> $BATMAN_SCRIPT - echo " iptables -D INPUT -p udp -m udp -j ACCEPT" >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT - echo ' systemctl restart network-manager' >> $BATMAN_SCRIPT - echo ' else' >> $BATMAN_SCRIPT - echo ' service network-manager restart' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' ' >> $BATMAN_SCRIPT - echo ' # restore tox bootstrap nodes for the internet' >> $BATMAN_SCRIPT - echo ' if [ -f /usr/share/toxic/DHTnodes.internet ]; then' >> $BATMAN_SCRIPT - echo ' mv /usr/share/toxic/DHTnodes.internet /usr/share/toxic/DHTnodes' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' if [ -f /usr/local/share/toxic/DHTnodes.internet ]; then' >> $BATMAN_SCRIPT - echo ' mv /usr/local/share/toxic/DHTnodes.internet /usr/local/share/toxic/DHTnodes' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT - echo ' systemctl stop avahi-daemon' >> $BATMAN_SCRIPT - echo ' else' >> $BATMAN_SCRIPT - echo ' service avahi-daemon stop' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' sudo rm -f /tmp/meshtype' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo ' # kill processes' >> $BATMAN_SCRIPT - echo ' zeronet_proc=$(ps aux | grep zeronet | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT - echo ' if [ "$zeronet_proc" ]; then' >> $BATMAN_SCRIPT - echo ' kill -9 $zeronet_proc 2> /dev/null' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' tracker_proc=$(ps aux | grep bttrack | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT - echo ' if [ "$tracker_proc" ]; then' >> $BATMAN_SCRIPT - echo ' kill -9 $tracker_proc 2> /dev/null' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' if [ ! -f /etc/systemd/system/ipfs.service ]; then' >> $BATMAN_SCRIPT - echo ' ipfs_proc=$(ps aux | grep ipfs | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT - echo ' if [ "$ipfs_proc" ]; then' >> $BATMAN_SCRIPT - echo ' kill -9 $ipfs_proc 2> /dev/null' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo ' fi' >> $BATMAN_SCRIPT - echo '}' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo 'if ! grep -q "$IFACE" /proc/net/dev; then' >> $BATMAN_SCRIPT - echo ' echo "Interface $IFACE was not found"' >> $BATMAN_SCRIPT - echo ' stop' >> $BATMAN_SCRIPT - echo ' exit 1' >> $BATMAN_SCRIPT - echo 'fi' >> $BATMAN_SCRIPT - echo '' >> $BATMAN_SCRIPT - echo 'case "$1" in' >> $BATMAN_SCRIPT - echo ' start|stop)' >> $BATMAN_SCRIPT - echo ' $1' >> $BATMAN_SCRIPT - echo ' ;;' >> $BATMAN_SCRIPT - echo ' restart)' >> $BATMAN_SCRIPT - echo ' stop' >> $BATMAN_SCRIPT - echo ' sleep 10' >> $BATMAN_SCRIPT - echo ' start' >> $BATMAN_SCRIPT - echo ' ;;' >> $BATMAN_SCRIPT - echo ' status)' >> $BATMAN_SCRIPT - echo ' batctl o' >> $BATMAN_SCRIPT - echo ' ;;' >> $BATMAN_SCRIPT - echo ' ping)' >> $BATMAN_SCRIPT - echo ' batctl ping $2' >> $BATMAN_SCRIPT - echo ' ;;' >> $BATMAN_SCRIPT - echo ' ls|list)' >> $BATMAN_SCRIPT - echo ' avahi-browse -atl' >> $BATMAN_SCRIPT - echo ' ;;' >> $BATMAN_SCRIPT - echo ' *)' >> $BATMAN_SCRIPT - echo ' echo "error: invalid parameter $1"' >> $BATMAN_SCRIPT - echo ' echo "usage: $0 {start|stop|restart|status|ping|ls|list}"' >> $BATMAN_SCRIPT - echo ' exit 2' >> $BATMAN_SCRIPT - echo ' ;;' >> $BATMAN_SCRIPT - echo 'esac' >> $BATMAN_SCRIPT - echo 'exit 0' >> $BATMAN_SCRIPT - chmod +x $BATMAN_SCRIPT - sudo cp -f $BATMAN_SCRIPT /usr/bin/batman - rm $BATMAN_SCRIPT -} - - while [[ $# > 1 ]] do key="$1" @@ -764,9 +505,6 @@ if [[ $FN == 'batman' ]]; then install_batman_remove fi fi -if [[ $FN == 'batman_client' ]]; then - install_batman_client -fi if [[ $FN == 'qtox' ]]; then mesh_tox_client_qtox fi