Mesh script can also run on a 'server' (i.e. a dedicated peer)

This commit is contained in:
Bob Mottram 2015-08-27 20:54:06 +01:00
parent 7b0ef394c8
commit b7c8141ae5
1 changed files with 28 additions and 10 deletions

View File

@ -40,6 +40,12 @@ TOX_PORT=33445
TOXCORE_REPO='git://github.com/irungentoo/toxcore.git'
TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
# client or server installations sounds odd for a mesh, but this
# indicates whether this is a dedicated mesh peer ("yes") or
# a 'client' such as a laptop or desktop machine with
# the freedombone-client script installed
SERVER_INSTALLATION="no"
function install_toxcore {
if [ -f /etc/tox-bootstrapd.conf ]; then
return
@ -207,8 +213,14 @@ function run_tox {
fi
}
if [ ! -f /usr/bin/batman ]; then
freedombone-client
if [ -f /var/lib/batman ]; then
SERVER_INSTALLATION="yes"
fi
if [[ $SERVER_INSTALLATION == "no" ]]; then
if [ ! -f /usr/bin/batman ]; then
freedombone-client
fi
fi
# alternative toxic paths
@ -219,12 +231,14 @@ if [ -f /usr/local/share/toxic/DHTnodes ]; then
DHTNODES=/usr/local/share/toxic/DHTnodes
fi
if [ ! -f /tmp/meshtype ]; then
install_toxcore
install_toxid
sudo batman start
if [ ! "$?" = "0" ]; then
exit 2
if [[ $SERVER_INSTALLATION == "no" ]]; then
if [ ! -f /tmp/meshtype ]; then
install_toxcore
install_toxid
sudo batman start
if [ ! "$?" = "0" ]; then
exit 2
fi
fi
fi
@ -294,7 +308,9 @@ if [ ! -f $IRSSI_PATH ]; then
exit 0
fi
echo 'You need irssi/mumble/toxic installed on your system'
sudo batman stop
if [[ $SERVER_INSTALLATION == "no" ]]; then
sudo batman stop
fi
exit 4
fi
fi
@ -307,7 +323,9 @@ if [ ! -f $MUMBLE_PATH ]; then
exit 0
fi
echo 'You need irssi/mumble/toxic installed on your system'
sudo batman stop
if [[ $SERVER_INSTALLATION == "no" ]]; then
sudo batman stop
fi
exit 4
fi
fi