checkout if commit defined
This commit is contained in:
parent
ce846f4fb8
commit
07d7a1a45a
|
@ -37,9 +37,9 @@ CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
|
||||||
|
|
||||||
MUMBLE_PATH=/usr/bin/mumble
|
MUMBLE_PATH=/usr/bin/mumble
|
||||||
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
if [ -f /usr/local/bin/${PROJECT_NAME} ]; then
|
||||||
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
|
TOXIC_FILE=$(cat /usr/local/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
|
||||||
else
|
else
|
||||||
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
|
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
DHTNODES=/usr/share/toxic/DHTnodes
|
DHTNODES=/usr/share/toxic/DHTnodes
|
||||||
|
|
||||||
|
@ -50,13 +50,13 @@ TOXCORE_REPO='git://github.com/irungentoo/toxcore.git'
|
||||||
TOXCORE_COMMIT=
|
TOXCORE_COMMIT=
|
||||||
# obtain tox values from main install
|
# obtain tox values from main install
|
||||||
if grep -q "TOX_PORT=" $CONFIG_FILE; then
|
if grep -q "TOX_PORT=" $CONFIG_FILE; then
|
||||||
TOX_PORT=$(cat $CONFIG_FILE | grep "TOX_PORT=" | nead -n 1 | awk -F '=' '{print $2}')
|
TOX_PORT=$(cat $CONFIG_FILE | grep "TOX_PORT=" | nead -n 1 | awk -F '=' '{print $2}')
|
||||||
fi
|
fi
|
||||||
if grep -q "TOXCORE_REPO=" $CONFIG_FILE; then
|
if grep -q "TOXCORE_REPO=" $CONFIG_FILE; then
|
||||||
TOXCORE_REPO=$(cat $CONFIG_FILE | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}')
|
TOXCORE_REPO=$(cat $CONFIG_FILE | grep "TOXCORE_REPO=" | head -n 1 | awk -F '"' '{print $2}')
|
||||||
fi
|
fi
|
||||||
if grep -q "TOXCORE_COMMIT=" $CONFIG_FILE; then
|
if grep -q "TOXCORE_COMMIT=" $CONFIG_FILE; then
|
||||||
TOXCORE_COMMIT=$(cat $CONFIG_FILE | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
TOXCORE_COMMIT=$(cat $CONFIG_FILE | grep "TOXCORE_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
|
||||||
fi
|
fi
|
||||||
TOXID_REPO='https://github.com/bashrc/toxid'
|
TOXID_REPO='https://github.com/bashrc/toxid'
|
||||||
TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
|
TOX_BOOTSTRAP_ID_FILE=/var/lib/tox-bootstrapd/pubkey.txt
|
||||||
|
@ -69,226 +69,228 @@ QTOX_INI="/home/$USER/.config/tox/qtox.ini"
|
||||||
SERVER_INSTALLATION="no"
|
SERVER_INSTALLATION="no"
|
||||||
|
|
||||||
function install_toxcore {
|
function install_toxcore {
|
||||||
if [ -f /etc/tox-bootstrapd.conf ]; then
|
if [ -f /etc/tox-bootstrapd.conf ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo apt-get -y install build-essential libtool autotools-dev
|
sudo apt-get -y install build-essential libtool autotools-dev
|
||||||
sudo apt-get -y install automake checkinstall check git yasm
|
sudo apt-get -y install automake checkinstall check git yasm
|
||||||
sudo apt-get -y install libsodium13 libsodium-dev libcap2-bin
|
sudo apt-get -y install libsodium13 libsodium-dev libcap2-bin
|
||||||
sudo apt-get -y install libconfig9 libconfig-dev
|
sudo apt-get -y install libconfig9 libconfig-dev
|
||||||
|
|
||||||
if [ ! -d ~/develop ]; then
|
if [ ! -d ~/develop ]; then
|
||||||
mkdir ~/develop
|
mkdir ~/develop
|
||||||
fi
|
fi
|
||||||
cd ~/develop
|
cd ~/develop
|
||||||
git clone $TOXCORE_REPO ~/develop/toxcore
|
git clone $TOXCORE_REPO ~/develop/toxcore
|
||||||
cd ~/develop/toxcore
|
cd ~/develop/toxcore
|
||||||
git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT
|
if [ $TOXCORE_COMMIT ]; then
|
||||||
autoreconf -i
|
git checkout $TOXCORE_COMMIT -b $TOXCORE_COMMIT
|
||||||
./configure --enable-daemon
|
fi
|
||||||
if [ ! "$?" = "0" ]; then
|
autoreconf -i
|
||||||
exit 78467
|
./configure --enable-daemon
|
||||||
fi
|
if [ ! "$?" = "0" ]; then
|
||||||
make
|
exit 78467
|
||||||
if [ ! "$?" = "0" ]; then
|
fi
|
||||||
exit 84562
|
make
|
||||||
fi
|
if [ ! "$?" = "0" ]; then
|
||||||
sudo make install
|
exit 84562
|
||||||
sudo cp /usr/local/lib/libtoxcore* /usr/lib/
|
fi
|
||||||
|
sudo make install
|
||||||
|
sudo cp /usr/local/lib/libtoxcore* /usr/lib/
|
||||||
|
|
||||||
if [ ! -f /usr/local/bin/tox-bootstrapd ]; then
|
if [ ! -f /usr/local/bin/tox-bootstrapd ]; then
|
||||||
echo $"File not found /usr/local/bin/tox-bootstrapd"
|
echo $"File not found /usr/local/bin/tox-bootstrapd"
|
||||||
exit 73862
|
exit 73862
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
|
sudo useradd --home-dir /var/lib/tox-bootstrapd --create-home --system --shell /sbin/nologin --comment "Account to run Tox's DHT bootstrap daemon" --user-group tox-bootstrapd
|
||||||
sudo chmod 700 /var/lib/tox-bootstrapd
|
sudo chmod 700 /var/lib/tox-bootstrapd
|
||||||
if [ ! -f ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf ]; then
|
if [ ! -f ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf ]; then
|
||||||
echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf"
|
echo $"File not found $INSTALL_DIR/toxcore/other/bootstrap_daemon/tox-bootstrapd.conf"
|
||||||
exit 476835
|
exit 476835
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create configuration file
|
# create configuration file
|
||||||
echo "port = $TOX_PORT" > /tmp/tox-bootstrapd.conf
|
echo "port = $TOX_PORT" > /tmp/tox-bootstrapd.conf
|
||||||
echo 'keys_file_path = "/var/lib/tox-bootstrapd/keys"' >> /tmp/tox-bootstrapd.conf
|
echo 'keys_file_path = "/var/lib/tox-bootstrapd/keys"' >> /tmp/tox-bootstrapd.conf
|
||||||
echo 'pid_file_path = "/var/run/tox-bootstrapd/tox-bootstrapd.pid"' >> /tmp/tox-bootstrapd.conf
|
echo 'pid_file_path = "/var/run/tox-bootstrapd/tox-bootstrapd.pid"' >> /tmp/tox-bootstrapd.conf
|
||||||
echo 'enable_ipv6 = true' >> /tmp/tox-bootstrapd.conf
|
echo 'enable_ipv6 = true' >> /tmp/tox-bootstrapd.conf
|
||||||
echo 'enable_ipv4_fallback = true' >> /tmp/tox-bootstrapd.conf
|
echo 'enable_ipv4_fallback = true' >> /tmp/tox-bootstrapd.conf
|
||||||
echo 'enable_lan_discovery = true' >> /tmp/tox-bootstrapd.conf
|
echo 'enable_lan_discovery = true' >> /tmp/tox-bootstrapd.conf
|
||||||
echo 'enable_tcp_relay = true' >> /tmp/tox-bootstrapd.conf
|
echo 'enable_tcp_relay = true' >> /tmp/tox-bootstrapd.conf
|
||||||
echo "tcp_relay_ports = [443, 3389, $TOX_PORT]" >> /tmp/tox-bootstrapd.conf
|
echo "tcp_relay_ports = [443, 3389, $TOX_PORT]" >> /tmp/tox-bootstrapd.conf
|
||||||
echo 'enable_motd = true' >> /tmp/tox-bootstrapd.conf
|
echo 'enable_motd = true' >> /tmp/tox-bootstrapd.conf
|
||||||
echo 'motd = "tox-bootstrapd"' >> /tmp/tox-bootstrapd.conf
|
echo 'motd = "tox-bootstrapd"' >> /tmp/tox-bootstrapd.conf
|
||||||
sudo cp /tmp/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
|
sudo cp /tmp/tox-bootstrapd.conf /etc/tox-bootstrapd.conf
|
||||||
rm /tmp/tox-bootstrapd.conf
|
rm /tmp/tox-bootstrapd.conf
|
||||||
|
|
||||||
if [ -f /bin/systemctl ]; then
|
if [ -f /bin/systemctl ]; then
|
||||||
if [ ! -f ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service ]; then
|
if [ ! -f ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service ]; then
|
||||||
echo $"File not found ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service"
|
echo $"File not found ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service"
|
||||||
exit 7359
|
exit 7359
|
||||||
fi
|
fi
|
||||||
sudo cp ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service /etc/systemd/system/
|
sudo cp ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.service /etc/systemd/system/
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable tox-bootstrapd.service
|
sudo systemctl enable tox-bootstrapd.service
|
||||||
sudo systemctl start tox-bootstrapd.service
|
sudo systemctl start tox-bootstrapd.service
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
sudo systemctl status tox-bootstrapd.service
|
sudo systemctl status tox-bootstrapd.service
|
||||||
exit 5846
|
exit 5846
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo systemctl restart tox-bootstrapd.service
|
sudo systemctl restart tox-bootstrapd.service
|
||||||
else
|
else
|
||||||
sudo cp ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.sh /etc/init.d/tox-bootstrapd
|
sudo cp ~/develop/toxcore/other/bootstrap_daemon/tox-bootstrapd.sh /etc/init.d/tox-bootstrapd
|
||||||
sudo chmod 755 /etc/init.d/tox-bootstrapd
|
sudo chmod 755 /etc/init.d/tox-bootstrapd
|
||||||
sudo update-rc.d tox-bootstrapd defaults
|
sudo update-rc.d tox-bootstrapd defaults
|
||||||
sudo service tox-bootstrapd start
|
sudo service tox-bootstrapd start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
|
TOX_PUBLIC_KEY=$(cat /var/log/syslog | grep tox | grep "Public Key" | awk -F ' ' '{print $8}' | tail -1)
|
||||||
if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
|
if [ ${#TOX_PUBLIC_KEY} -lt 30 ]; then
|
||||||
echo $'Could not obtain the tox node public key'
|
echo $'Could not obtain the tox node public key'
|
||||||
exit 6529
|
exit 6529
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# save the public key for later reference
|
# save the public key for later reference
|
||||||
echo "$TOX_PUBLIC_KEY" > /tmp/boostrapid
|
echo "$TOX_PUBLIC_KEY" > /tmp/boostrapid
|
||||||
sudo mv /tmp/boostrapid $TOX_BOOTSTRAP_ID_FILE
|
sudo mv /tmp/boostrapid $TOX_BOOTSTRAP_ID_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_toxid {
|
function install_toxid {
|
||||||
if [ -f /usr/local/bin/toxid ]; then
|
if [ -f /usr/local/bin/toxid ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
cd ~/develop
|
cd ~/develop
|
||||||
git clone $TOXID_REPO ~/develop/toxid
|
git clone $TOXID_REPO ~/develop/toxid
|
||||||
cd ~/develop/toxid
|
cd ~/develop/toxid
|
||||||
make
|
make
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
if [ ! -f /usr/local/bin/toxid ]; then
|
if [ ! -f /usr/local/bin/toxid ]; then
|
||||||
echo $"Couldn't install toxid"
|
echo $"Couldn't install toxid"
|
||||||
exit 6389
|
exit 6389
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -Fxq "toxavahi" /etc/crontab; then
|
if ! grep -Fxq "toxavahi" /etc/crontab; then
|
||||||
cp /etc/crontab /tmp/crontab
|
cp /etc/crontab /tmp/crontab
|
||||||
echo "* * * * * root toxavahi > /dev/null" >> /tmp/crontab
|
echo "* * * * * root toxavahi > /dev/null" >> /tmp/crontab
|
||||||
sudo cp /tmp/crontab /etc/crontab
|
sudo cp /tmp/crontab /etc/crontab
|
||||||
rm /tmp/crontab
|
rm /tmp/crontab
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_tox {
|
function run_tox {
|
||||||
echo $QTOX_INI
|
echo $QTOX_INI
|
||||||
if [[ -f $TOXIC_FILE || -f $QTOX_INI ]]; then
|
if [[ -f $TOXIC_FILE || -f $QTOX_INI ]]; then
|
||||||
if [[ $SERVER_INSTALLATION == "no" ]]; then
|
if [[ $SERVER_INSTALLATION == "no" ]]; then
|
||||||
# update bootstrap nodes
|
# update bootstrap nodes
|
||||||
if [ -f $DHTNODES ]; then
|
if [ -f $DHTNODES ]; then
|
||||||
if [ ! -f $DHTNODES.internet ]; then
|
if [ ! -f $DHTNODES.internet ]; then
|
||||||
sudo cp $DHTNODES $DHTNODES.internet
|
sudo cp $DHTNODES $DHTNODES.internet
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
lstox -f dht > /tmp/dht
|
lstox -f dht > /tmp/dht
|
||||||
sudo cp /tmp/dht $DHTNODES
|
sudo cp /tmp/dht $DHTNODES
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get a list of peers
|
# get a list of peers
|
||||||
PEER_TOX_ID_LIST=$(lstox | grep $AVAHI_DOMAIN | sort -u)
|
PEER_TOX_ID_LIST=$(lstox | grep $AVAHI_DOMAIN | sort -u)
|
||||||
if [ ! "$PEER_TOX_ID_LIST" ]; then
|
if [ ! "$PEER_TOX_ID_LIST" ]; then
|
||||||
echo $'No peers found'
|
echo $'No peers found'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
PEER_TOX_ID_LIST_COUNT=$(echo "$PEER_TOX_ID_LIST" | wc -l)
|
PEER_TOX_ID_LIST_COUNT=$(echo "$PEER_TOX_ID_LIST" | wc -l)
|
||||||
PEER_TOX_ID=''
|
PEER_TOX_ID=''
|
||||||
if [ $PEER_TOX_ID_LIST_COUNT -lt "2" ]; then
|
if [ $PEER_TOX_ID_LIST_COUNT -lt "2" ]; then
|
||||||
# single peer
|
# single peer
|
||||||
PEER_TOX_ID=$(echo "$PEER_TOX_ID_LIST" | awk -F ' ' '{print $3}')
|
PEER_TOX_ID=$(echo "$PEER_TOX_ID_LIST" | awk -F ' ' '{print $3}')
|
||||||
else
|
else
|
||||||
# choose a user from a list
|
# choose a user from a list
|
||||||
echo ''
|
echo ''
|
||||||
echo $"Select a user on $AVAHI_DOMAIN:"
|
echo $"Select a user on $AVAHI_DOMAIN:"
|
||||||
ctr=0
|
ctr=0
|
||||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||||
toxusername=$(echo $line | awk -F ' ' '{print $2}')
|
toxusername=$(echo $line | awk -F ' ' '{print $2}')
|
||||||
echo " $ctr. $toxusername"
|
echo " $ctr. $toxusername"
|
||||||
ctr=$((ctr + 1))
|
ctr=$((ctr + 1))
|
||||||
done < "$PEER_TOX_ID_LIST"
|
done < "$PEER_TOX_ID_LIST"
|
||||||
read user_index
|
read user_index
|
||||||
PEER_TOX_ID=$(echo "$PEER_TOX_ID_LIST" | tail -n+${user_index} | head -n1 | awk -F ' ' '{print $3}')
|
PEER_TOX_ID=$(echo "$PEER_TOX_ID_LIST" | tail -n+${user_index} | head -n1 | awk -F ' ' '{print $3}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if this is a valid ID
|
# if this is a valid ID
|
||||||
if [ ${#PEER_TOX_ID} -gt 30 ]; then
|
if [ ${#PEER_TOX_ID} -gt 30 ]; then
|
||||||
# start client and make a friend request
|
# start client and make a friend request
|
||||||
if [ -f $QTOX_INI ]; then
|
if [ -f $QTOX_INI ]; then
|
||||||
echo $'Launch qTox'
|
echo $'Launch qTox'
|
||||||
qtox &
|
qtox &
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "n
|
echo "n
|
||||||
/nick $USER
|
/nick $USER
|
||||||
/add $PEER_TOX_ID
|
/add $PEER_TOX_ID
|
||||||
/exit
|
/exit
|
||||||
" | $TOXIC_FILE -d
|
" | $TOXIC_FILE -d
|
||||||
# Running twice is a hack to get around buggyness in the client
|
# Running twice is a hack to get around buggyness in the client
|
||||||
$TOXIC_FILE -d
|
$TOXIC_FILE -d
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
# ID was invalid
|
# ID was invalid
|
||||||
echo $PEER_TOX_ID
|
echo $PEER_TOX_ID
|
||||||
echo $"Tox ID for $AVAHI_DOMAIN was not found"
|
echo $"Tox ID for $AVAHI_DOMAIN was not found"
|
||||||
exit 6
|
exit 6
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -f /var/lib/batman ]; then
|
if [ -f /var/lib/batman ]; then
|
||||||
SERVER_INSTALLATION="yes"
|
SERVER_INSTALLATION="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SERVER_INSTALLATION == "no" ]]; then
|
if [[ $SERVER_INSTALLATION == "no" ]]; then
|
||||||
if [ ! -f /usr/bin/batman ]; then
|
if [ ! -f /usr/bin/batman ]; then
|
||||||
${PROJECT_NAME}-client
|
${PROJECT_NAME}-client
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# alternative toxic paths
|
# alternative toxic paths
|
||||||
if [ -f /usr/local/bin/toxic ]; then
|
if [ -f /usr/local/bin/toxic ]; then
|
||||||
TOXIC_FILE=/usr/local/bin/toxic
|
TOXIC_FILE=/usr/local/bin/toxic
|
||||||
fi
|
fi
|
||||||
if [ -f /usr/local/share/toxic/DHTnodes ]; then
|
if [ -f /usr/local/share/toxic/DHTnodes ]; then
|
||||||
DHTNODES=/usr/local/share/toxic/DHTnodes
|
DHTNODES=/usr/local/share/toxic/DHTnodes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SERVER_INSTALLATION == "no" ]]; then
|
if [[ $SERVER_INSTALLATION == "no" ]]; then
|
||||||
if [ ! -f /tmp/meshtype ]; then
|
if [ ! -f /tmp/meshtype ]; then
|
||||||
install_toxcore
|
install_toxcore
|
||||||
install_toxid
|
install_toxid
|
||||||
sudo batman start
|
sudo batman start
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
avahi-browse -atl | awk -F ' ' '{print $4}' | sort -u > $PEERS_FILE
|
avahi-browse -atl | awk -F ' ' '{print $4}' | sort -u > $PEERS_FILE
|
||||||
|
|
||||||
if [ ! -f $PEERS_FILE ]; then
|
if [ ! -f $PEERS_FILE ]; then
|
||||||
echo $'No peers were found'
|
echo $'No peers were found'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ctr=0
|
ctr=0
|
||||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||||
ctr=$((ctr + 1))
|
ctr=$((ctr + 1))
|
||||||
done < "$PEERS_FILE"
|
done < "$PEERS_FILE"
|
||||||
|
|
||||||
if [ ${ctr} -lt "1" ]; then
|
if [ ${ctr} -lt "1" ]; then
|
||||||
echo $'No peers were found'
|
echo $'No peers were found'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
@ -303,8 +305,8 @@ echo ''
|
||||||
echo $'Please choose a peer to connect to:'
|
echo $'Please choose a peer to connect to:'
|
||||||
idx=1
|
idx=1
|
||||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||||
echo " $idx. $line"
|
echo " $idx. $line"
|
||||||
idx=$((idx + 1))
|
idx=$((idx + 1))
|
||||||
done < "$PEERS_FILE"
|
done < "$PEERS_FILE"
|
||||||
|
|
||||||
peer_index=0
|
peer_index=0
|
||||||
|
@ -312,42 +314,42 @@ read peer_index
|
||||||
|
|
||||||
# if no selection made
|
# if no selection made
|
||||||
if [ ! $peer_index ]; then
|
if [ ! $peer_index ]; then
|
||||||
echo $'Nothing was selected'
|
echo $'Nothing was selected'
|
||||||
echo ''
|
echo ''
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get the avahi domain name
|
# get the avahi domain name
|
||||||
AVAHI_DOMAIN=
|
AVAHI_DOMAIN=
|
||||||
idx=1
|
idx=1
|
||||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||||
if [ ${idx} -eq "$peer_index" ]; then
|
if [ ${idx} -eq "$peer_index" ]; then
|
||||||
AVAHI_DOMAIN=${line}.local
|
AVAHI_DOMAIN=${line}.local
|
||||||
fi
|
fi
|
||||||
idx=$((idx + 1))
|
idx=$((idx + 1))
|
||||||
done < "$PEERS_FILE"
|
done < "$PEERS_FILE"
|
||||||
|
|
||||||
if [ ! $AVAHI_DOMAIN ]; then
|
if [ ! $AVAHI_DOMAIN ]; then
|
||||||
echo $'No domain name'
|
echo $'No domain name'
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if only mumble is installed
|
# if only mumble is installed
|
||||||
if [ ! -f $TOXIC_FILE ]; then
|
if [ ! -f $TOXIC_FILE ]; then
|
||||||
if [ -f $MUMBLE_PATH ]; then
|
if [ -f $MUMBLE_PATH ]; then
|
||||||
$MUMBLE_PATH &
|
$MUMBLE_PATH &
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo $'You need mumble/toxic/qTox installed on your system'
|
echo $'You need mumble/toxic/qTox installed on your system'
|
||||||
if [[ $SERVER_INSTALLATION == "no" ]]; then
|
if [[ $SERVER_INSTALLATION == "no" ]]; then
|
||||||
sudo batman stop
|
sudo batman stop
|
||||||
fi
|
fi
|
||||||
exit 4
|
exit 4
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if only tox is installed
|
# if only tox is installed
|
||||||
if [ ! -f $MUMBLE_PATH ]; then
|
if [ ! -f $MUMBLE_PATH ]; then
|
||||||
run_tox
|
run_tox
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ''
|
echo ''
|
||||||
|
@ -360,32 +362,32 @@ read peer_index
|
||||||
|
|
||||||
# if no selection made
|
# if no selection made
|
||||||
if [ ! $peer_index ]; then
|
if [ ! $peer_index ]; then
|
||||||
echo $'Nothing was selected'
|
echo $'Nothing was selected'
|
||||||
echo ''
|
echo ''
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $peer_index == 1 ]]; then
|
if [[ $peer_index == 1 ]]; then
|
||||||
if [ -f $MUMBLE_PATH ]; then
|
if [ -f $MUMBLE_PATH ]; then
|
||||||
echo ''
|
echo ''
|
||||||
echo $'To setup for the first time click "Add New", then set:'
|
echo $'To setup for the first time click "Add New", then set:'
|
||||||
echo $" Label: $AVAHI_DOMAIN"
|
echo $" Label: $AVAHI_DOMAIN"
|
||||||
echo $" Address: $AVAHI_DOMAIN"
|
echo $" Address: $AVAHI_DOMAIN"
|
||||||
echo $' Port: 64738'
|
echo $' Port: 64738'
|
||||||
echo $" Username: $USER"
|
echo $" Username: $USER"
|
||||||
echo ''
|
echo ''
|
||||||
echo $'Press Enter to continue.'
|
echo $'Press Enter to continue.'
|
||||||
echo ''
|
echo ''
|
||||||
read peer_index
|
read peer_index
|
||||||
$MUMBLE_PATH &
|
$MUMBLE_PATH &
|
||||||
else
|
else
|
||||||
echo $'Mumble may not be installed on this system'
|
echo $'Mumble may not be installed on this system'
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $peer_index == 2 ]]; then
|
if [[ $peer_index == 2 ]]; then
|
||||||
run_tox
|
run_tox
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue