Script to easily discover and connect to mesh peers

This commit is contained in:
Bob Mottram 2015-08-22 11:27:56 +01:00
parent ceab0f65e1
commit 99af758a29
5 changed files with 92 additions and 1 deletions

View File

@ -31,6 +31,8 @@ install:
install -m 755 src/${APP}-addxmpp ${DESTDIR}${PREFIX}/bin
install -m 755 src/${APP}-rmxmpp ${DESTDIR}${PREFIX}/bin
install -m 755 src/${APP}-xmpp-pass ${DESTDIR}${PREFIX}/bin
install -m 755 src/${APP}-mesh ${DESTDIR}${PREFIX}/bin
install -m 755 src/${APP}-mesh ${DESTDIR}${PREFIX}/bin/mesh
mkdir -m 755 -p ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-keydrive.1.gz ${DESTDIR}${PREFIX}/share/man/man1
@ -53,6 +55,7 @@ install:
install -m 644 man/${APP}-addxmpp.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-rmxmpp.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-xmpp-pass.1.gz ${DESTDIR}${PREFIX}/share/man/man1
install -m 644 man/${APP}-mesh.1.gz ${DESTDIR}${PREFIX}/share/man/man1
uninstall:
rm -f ${PREFIX}/share/man/man1/${APP}.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-keydrive.1.gz
@ -75,6 +78,7 @@ uninstall:
rm -f ${PREFIX}/share/man/man1/${APP}-addxmpp.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-rmxmpp.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-xmpp-pass.1.gz
rm -f ${PREFIX}/share/man/man1/${APP}-mesh.1.gz
rm -rf ${PREFIX}/share/${APP}
rm -f ${PREFIX}/bin/${APP}
rm -f ${PREFIX}/bin/${APP}-keydrive
@ -96,6 +100,8 @@ uninstall:
rm -f ${PREFIX}/bin/${APP}-addxmpp
rm -f ${PREFIX}/bin/${APP}-rmxmpp
rm -f ${PREFIX}/bin/${APP}-xmpp-pass
rm -f ${PREFIX}/bin/${APP}-mesh
rm -f ${PREFIX}/bin/mesh
clean:
rm -f \#* \.#* debian/*.substvars debian/*.log
rm -fr deb.* debian/${APP}

View File

@ -19,3 +19,4 @@ man/freedombone-unignore.1.gz
man/freedombone-addxmpp.1.gz
man/freedombone-rmxmpp.1.gz
man/freedombone-xmpp-pass.1.gz
man/freedombone-mesh.1.gz

BIN
man/freedombone-mesh.1.gz Normal file

Binary file not shown.

View File

@ -8232,7 +8232,7 @@ function install_tox_node {
}
function install_tox_client {
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" || $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" ]]; then
return
fi
if grep -Fxq "install_tox_client" $COMPLETION_FILE; then

84
src/freedombone-mesh Executable file
View File

@ -0,0 +1,84 @@
#!/bin/bash
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# A script to easily locate mesh peers and start communicating
# License
# =======
#
# Copyright (C) 2015 Bob Mottram <bob@robotics.uk.to>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
IRC_PORT=6697
PEERS_FILE=/tmp/meshpeers.txt
avahi-browse -at | awk -F ' ' '{print $4}' > $PEERS_FILE
if [ ! -f $PEERS_FILE ]; then
echo 'No peers were found'
exit 0
fi
ctr=0
while IFS='' read -r line || [[ -n "$line" ]]; do
ctr=$((ctr + 1))
done < "$PEERS_FILE"
if [ ${ctr} -lt "2" ]; then
echo 'No peers were found'
exit 0
fi
echo 'Choose a peer to connect to:'
idx=1
while IFS='' read -r line || [[ -n "$line" ]]; do
echo " $idx. $line"
idx=$((idx + 1))
done < "$PEERS_FILE"
peer_index=0
read peer_index
# get the avahi domain name
AVAHI_DOMAIN=
idx=1
while IFS='' read -r line || [[ -n "$line" ]]; do
if [ ${idx} -eq "$peer_index" ]; then
AVAHI_DOMAIN=${line}.local
fi
idx=$((idx + 1))
done < "$PEERS_FILE"
if [ ! $AVAHI_DOMAIN ]; then
echo 'No domain name'
exit 2
fi
# Connect to IRC
if [ ! -f /usr/bin/irssi ]; then
if [ ! -f /usr/local/bin/irssi ]; then
echo 'You need irssi installed on your system'
exit 3
fi
fi
irssi -c $AVAHI_DOMAIN -p $IRC_PORT -n $USER
exit 0