Add babel script to client

This commit is contained in:
Bob Mottram 2015-07-30 21:22:37 +01:00
parent e3b56db91a
commit 80c175b036
2 changed files with 47 additions and 5 deletions

View File

@ -1676,7 +1676,7 @@ function mesh_babel {
echo 'IFACE=wlan0' >> $babel_script echo 'IFACE=wlan0' >> $babel_script
echo 'IFACE_EXISTS=$(grep "$IFACE" /proc/net/dev)' >> $babel_script echo 'IFACE_EXISTS=$(grep "$IFACE" /proc/net/dev)' >> $babel_script
echo '' >> $babel_script echo '' >> $babel_script
echo 'if [ ! $IFACE_EXISTS ]; then' >> $babel_script echo 'if [[ ! $IFACE_EXISTS || $1 == "stop" ]]; then' >> $babel_script
echo ' echo "Interface $IFACE was not found"' >> $babel_script echo ' echo "Interface $IFACE was not found"' >> $babel_script
echo ' ifconfig $IFACE down' >> $babel_script echo ' ifconfig $IFACE down' >> $babel_script
echo ' systemctl restart networking' >> $babel_script echo ' systemctl restart networking' >> $babel_script
@ -8120,7 +8120,7 @@ function install_irc_server {
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
DEFAULTDOMAIN="${DEFAULT_DOMAIN_NAME}.local" DEFAULTDOMAIN="${DEFAULT_DOMAIN_NAME}.local"
fi fi
echo '**************************************************' > /etc/ngircd/motd echo '**************************************************' > /etc/ngircd/motd
echo '* F R E E D O M B O N E I R C *' >> /etc/ngircd/motd echo '* F R E E D O M B O N E I R C *' >> /etc/ngircd/motd
echo '* *' >> /etc/ngircd/motd echo '* *' >> /etc/ngircd/motd

View File

@ -85,10 +85,51 @@ function configure_ssh_client {
echo '' echo ''
} }
function mesh_babel {
sudo apt-get -y install babeld
babel_script=/tmp/babel
echo '#!/bin/sh' > $babel_script
echo 'IFACE=wlan0' >> $babel_script
echo 'IFACE_EXISTS=$(grep "$IFACE" /proc/net/dev)' >> $babel_script
echo '' >> $babel_script
echo 'if [[ ! $IFACE_EXISTS || $1 == "stop" ]]; then' >> $babel_script
echo ' echo "Interface $IFACE was not found"' >> $babel_script
echo ' ifconfig $IFACE down' >> $babel_script
echo ' pkill babeld' >> $babel_script
echo ' if [ -f /etc/init.d/networking ]; then' >> $babel_script
echo ' service networking restart' >> $babel_script
echo ' else' >> $babel_script
echo ' systemctl restart networking' >> $babel_script
echo ' fi' >> $babel_script
echo ' exit 1' >> $babel_script
echo 'fi' >> $babel_script
echo '' >> $babel_script
echo 'if [ -f /etc/init.d/networking ]; then' >> $babel_script
echo ' service networking stop' >> $babel_script
echo 'else' >> $babel_script
echo ' systemctl stop networking' >> $babel_script
echo 'fi' >> $babel_script
echo 'ifconfig $IFACE down' >> $babel_script
echo -n 'iwconfig $IFACE mode ad-hoc channel ' >> $babel_script
echo "$WIFI_CHANNEL essid \"$ESSID\"" >> $babel_script
echo 'ifconfig $IFACE up' >> $babel_script
echo 'avahi-autoipd $IFACE' >> $babel_script
echo -n 'ifconfig $IFACE:avahi ' >> $babel_script
echo -n "$LOCAL_NETWORK_STATIC_IP_ADDRESS netmask " >> $babel_script
echo '255.255.255.0 broadcast 192.168.13.255' >> $babel_script
echo -n 'babeld -D $IFACE:avahi -p ' >> $babel_script
echo "$BABEL_PORT -d 5 wlan0" >> $babel_script
echo 'exit 0' >> $babel_script
chmod +x $babel_script
sudo mv $babel_script /usr/bin/babel
}
function mesh_batman { function mesh_batman {
apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl sudo apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
apt-get -y install python-dev libevent-dev ebtables python-pip sudo apt-get -y install python-dev libevent-dev ebtables python-pip
apt-get -y install wireless-tools rfkill sudo apt-get -y install wireless-tools rfkill
batman_script=/tmp/batman batman_script=/tmp/batman
@ -223,6 +264,7 @@ done
echo 'Configuring client' echo 'Configuring client'
configure_ssh_client configure_ssh_client
mesh_batman mesh_batman
mesh_babel
echo 'Configuration complete' echo 'Configuration complete'
if [[ $BRIDGE_BATMAN_IPV6 ]]; then if [[ $BRIDGE_BATMAN_IPV6 ]]; then
echo '' echo ''