Start the mesh if necessary
This commit is contained in:
parent
99af758a29
commit
bf8aeb54b2
|
@ -114,6 +114,10 @@ function mesh_babel {
|
|||
echo 'fi' >> $babel_script
|
||||
echo '' >> $babel_script
|
||||
echo 'if [[ $1 == "start" ]]; then' >> $babel_script
|
||||
echo ' if [ -f /tmp/meshtype ] ; then' >> $babel_script
|
||||
echo ' echo "Mesh already running"' >> $babel_script
|
||||
echo ' return' >> $babel_script
|
||||
echo ' fi' >> $batman_script
|
||||
echo ' # install avahi' >> $babel_script
|
||||
echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd' >> $babel_script
|
||||
echo ' sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $babel_script
|
||||
|
@ -129,6 +133,7 @@ function mesh_babel {
|
|||
echo ' systemctl restart avahi-daemon' >> $babel_script
|
||||
echo ' else' >> $babel_script
|
||||
echo ' service avahi-daemon restart' >> $babel_script
|
||||
echo ' echo "babel" > /tmp/meshtype' >> $babel_script
|
||||
echo ' fi' >> $babel_script
|
||||
echo 'fi' >> $babel_script
|
||||
echo '' >> $babel_script
|
||||
|
@ -242,6 +247,10 @@ function mesh_batman {
|
|||
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
|
||||
|
@ -309,6 +318,7 @@ function mesh_batman {
|
|||
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
|
||||
|
@ -346,6 +356,7 @@ function mesh_batman {
|
|||
echo ' else' >> $batman_script
|
||||
echo ' service network-manager restart' >> $batman_script
|
||||
echo ' fi' >> $batman_script
|
||||
echo ' rm -f /tmp/meshtype' >> $batman_script
|
||||
echo '}' >> $batman_script
|
||||
echo '' >> $batman_script
|
||||
echo 'if ! grep -q "$IFACE" /proc/net/dev; then' >> $batman_script
|
||||
|
|
|
@ -30,6 +30,18 @@
|
|||
|
||||
IRC_PORT=6697
|
||||
PEERS_FILE=/tmp/meshpeers.txt
|
||||
|
||||
if [ ! -f /usr/bin/batman ]; then
|
||||
echo 'Mesh networking is not configured on your system'
|
||||
echo 'Run freedombone-client to install the necessary packages'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f /tmp/meshtype ]; then
|
||||
sudo batman start
|
||||
clear
|
||||
fi
|
||||
|
||||
avahi-browse -at | awk -F ' ' '{print $4}' > $PEERS_FILE
|
||||
|
||||
if [ ! -f $PEERS_FILE ]; then
|
||||
|
@ -76,9 +88,13 @@ fi
|
|||
if [ ! -f /usr/bin/irssi ]; then
|
||||
if [ ! -f /usr/local/bin/irssi ]; then
|
||||
echo 'You need irssi installed on your system'
|
||||
sudo batman stop
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
|
||||
MESH_RUNNING=$(pgrep ngircd > /dev/null && echo Running)' >> /usr/bin/$WATCHDOG_SCRIPT_NAME
|
||||
|
||||
irssi -c $AVAHI_DOMAIN -p $IRC_PORT -n $USER
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue