Single definition of toxic file

This commit is contained in:
Bob Mottram 2016-04-12 15:03:01 +01:00
parent 37ec4cebf8
commit c4ef5b707d
5 changed files with 349 additions and 314 deletions

View File

@ -483,6 +483,7 @@ TOX_NODES=
#)
TOXIC_REPO="https://github.com/Tox/toxic"
TOXIC_COMMIT='4e0e322e32b0d7b5d1692f72876ac7f9ae2e610a'
TOXIC_FILE=/usr/local/bin/toxic
ZERONET_REPO="https://github.com/HelloZeroNet/ZeroNet.git"
ZERONET_COMMIT='675bd462556c541d65e2d95f91f899146a373aad'
@ -6589,7 +6590,7 @@ function install_tox_client {
su -c "echo 'n
/nick $MY_USERNAME
/exit
' | /usr/bin/toxic -d" - $MY_USERNAME
' | $TOXIC_FILE -d" - $MY_USERNAME
echo 'install_tox_client' >> $COMPLETION_FILE
}

View File

@ -60,318 +60,324 @@ TOXID_REPO='https://github.com/bashrc/toxid'
# see https://stribika.github.io/2015/01/04/secure-secure-shell.html
function ssh_remove_small_moduli {
sudo awk '$5 > 2000' /etc/ssh/moduli > /home/$CURR_USER/moduli
sudo mv /home/$CURR_USER/moduli /etc/ssh/moduli
sudo awk '$5 > 2000' /etc/ssh/moduli > /home/$CURR_USER/moduli
sudo mv /home/$CURR_USER/moduli /etc/ssh/moduli
}
function configure_ssh_client {
#sudo sed -i 's/# PasswordAuthentication.*/ PasswordAuthentication no/g' /etc/ssh/ssh_config
#sudo sed -i 's/# ChallengeResponseAuthentication.*/ ChallengeResponseAuthentication no/g' /etc/ssh/ssh_config
sudo sed -i "s/# HostKeyAlgorithms.*/ HostKeyAlgorithms $SSH_HOST_KEY_ALGORITHMS/g" /etc/ssh/ssh_config
sudo sed -i "s/# Ciphers.*/ Ciphers $SSH_CIPHERS/g" /etc/ssh/ssh_config
sudo sed -i "s/# MACs.*/ MACs $SSH_MACS/g" /etc/ssh/ssh_config
if ! grep -q "HostKeyAlgorithms" /etc/ssh/ssh_config; then
sudo cp /etc/ssh/ssh_config ~/ssh_config
sudo chown $CURR_USER:$CURR_USER ~/ssh_config
echo " HostKeyAlgorithms $SSH_HOST_KEY_ALGORITHMS" >> ~/ssh_config
sudo mv ~/ssh_config /etc/ssh/ssh_config
sudo chown root:root /etc/ssh/ssh_config
fi
sudo sed -i "s/Ciphers.*/Ciphers $SSH_CIPHERS/g" /etc/ssh/ssh_config
if ! grep -q "Ciphers " /etc/ssh/ssh_config; then
sudo cp /etc/ssh/ssh_config ~/ssh_config
sudo chown $CURR_USER:$CURR_USER ~/ssh_config
echo " Ciphers $SSH_CIPHERS" >> ~/ssh_config
sudo mv ~/ssh_config /etc/ssh/ssh_config
sudo chown root:root /etc/ssh/ssh_config
fi
sudo sed -i "s/MACs.*/MACs $SSH_MACS/g" /etc/ssh/ssh_config
if ! grep -q "MACs " /etc/ssh/ssh_config; then
sudo cp /etc/ssh/ssh_config ~/ssh_config
sudo chown $CURR_USER:$CURR_USER ~/ssh_config
echo " MACs $SSH_MACS" >> ~/ssh_config
sudo mv ~/ssh_config /etc/ssh/ssh_config
sudo chown root:root /etc/ssh/ssh_config
fi
#sudo sed -i 's/# PasswordAuthentication.*/ PasswordAuthentication no/g' /etc/ssh/ssh_config
#sudo sed -i 's/# ChallengeResponseAuthentication.*/ ChallengeResponseAuthentication no/g' /etc/ssh/ssh_config
sudo sed -i "s/# HostKeyAlgorithms.*/ HostKeyAlgorithms $SSH_HOST_KEY_ALGORITHMS/g" /etc/ssh/ssh_config
sudo sed -i "s/# Ciphers.*/ Ciphers $SSH_CIPHERS/g" /etc/ssh/ssh_config
sudo sed -i "s/# MACs.*/ MACs $SSH_MACS/g" /etc/ssh/ssh_config
if ! grep -q "HostKeyAlgorithms" /etc/ssh/ssh_config; then
sudo cp /etc/ssh/ssh_config ~/ssh_config
sudo chown $CURR_USER:$CURR_USER ~/ssh_config
echo " HostKeyAlgorithms $SSH_HOST_KEY_ALGORITHMS" >> ~/ssh_config
sudo mv ~/ssh_config /etc/ssh/ssh_config
sudo chown root:root /etc/ssh/ssh_config
fi
sudo sed -i "s/Ciphers.*/Ciphers $SSH_CIPHERS/g" /etc/ssh/ssh_config
if ! grep -q "Ciphers " /etc/ssh/ssh_config; then
sudo cp /etc/ssh/ssh_config ~/ssh_config
sudo chown $CURR_USER:$CURR_USER ~/ssh_config
echo " Ciphers $SSH_CIPHERS" >> ~/ssh_config
sudo mv ~/ssh_config /etc/ssh/ssh_config
sudo chown root:root /etc/ssh/ssh_config
fi
sudo sed -i "s/MACs.*/MACs $SSH_MACS/g" /etc/ssh/ssh_config
if ! grep -q "MACs " /etc/ssh/ssh_config; then
sudo cp /etc/ssh/ssh_config ~/ssh_config
sudo chown $CURR_USER:$CURR_USER ~/ssh_config
echo " MACs $SSH_MACS" >> ~/ssh_config
sudo mv ~/ssh_config /etc/ssh/ssh_config
sudo chown root:root /etc/ssh/ssh_config
fi
# Create ssh keys
if [ ! -f /home/$CURR_USER/.ssh/id_ed25519 ]; then
ssh-keygen -t ed25519 -o -a 100
fi
if [ ! -f /home/$CURR_USER/.ssh/id_rsa ]; then
ssh-keygen -t rsa -b 4096 -o -a 100
fi
# Create ssh keys
if [ ! -f /home/$CURR_USER/.ssh/id_ed25519 ]; then
ssh-keygen -t ed25519 -o -a 100
fi
if [ ! -f /home/$CURR_USER/.ssh/id_rsa ]; then
ssh-keygen -t rsa -b 4096 -o -a 100
fi
ssh_remove_small_moduli
ssh_remove_small_moduli
echo ''
echo $'Copy the following into a file called /home/username/.ssh/authorized_keys on the Freedombone server'
echo ''
echo $(cat /home/$CURR_USER/.ssh/id_rsa.pub)
echo $(cat /home/$CURR_USER/.ssh/id_ed25519.pub)
echo ''
echo ''
echo $'Copy the following into a file called /home/username/.ssh/authorized_keys on the Freedombone server'
echo ''
echo $(cat /home/$CURR_USER/.ssh/id_rsa.pub)
echo $(cat /home/$CURR_USER/.ssh/id_ed25519.pub)
echo ''
}
function mesh_batman {
if [ ! -f /tmp/meshtype ]; then
sudo apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
sudo apt-get -y install python-dev libevent-dev ebtables python-pip
sudo apt-get -y install wireless-tools rfkill
sudo apt-get -y install irssi mumble
if [ ! -f /usr/bin/toxic ]; then
sudo apt-get -y install toxic
echo "n
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}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
if [ ! -f /tmp/meshtype ]; then
sudo apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
sudo apt-get -y install python-dev libevent-dev ebtables python-pip
sudo apt-get -y install wireless-tools rfkill
sudo apt-get -y install irssi mumble
if [ ! -f $TOXIC_FILE ]; then
sudo apt-get -y install toxic
echo "n
/nick $USER
/exit
" | /usr/bin/toxic -d
fi
fi
" | $TOXIC_FILE -d
fi
fi
BATMAN_SCRIPT=/tmp/batman
BATMAN_SCRIPT=/tmp/batman
echo '#!/bin/bash' > $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'if [[ $1 == "start" ]]; then' >> $BATMAN_SCRIPT
echo ' # install avahi' >> $BATMAN_SCRIPT
echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd bittornado' >> $BATMAN_SCRIPT
echo ' sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|use-ipv4=.*|use-ipv4=yes|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|hosts:.*|hosts: files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl restart avahi-daemon' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' service avahi-daemon restart' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo '# Mesh definition' >> $BATMAN_SCRIPT
echo "ESSID=$ESSID" >> $BATMAN_SCRIPT
echo "CELLID=$BATMAN_CELLID" >> $BATMAN_SCRIPT
echo "CHANNEL=$WIFI_CHANNEL" >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo '# Ethernet bridge definition (bridged to bat0)' >> $BATMAN_SCRIPT
echo 'BRIDGE=br-mesh' >> $BATMAN_SCRIPT
echo "IFACE=$WIFI_INTERFACE" >> $BATMAN_SCRIPT
echo 'EIFACE=eth0' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT
echo ' if grep -q "wlan1" /proc/net/dev; then' >> $BATMAN_SCRIPT
echo ' IFACE=wlan1' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT
echo ' if grep -q "wlan2" /proc/net/dev; then' >> $BATMAN_SCRIPT
echo ' IFACE=wlan2' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT
echo ' if grep -q "wlan3" /proc/net/dev; then' >> $BATMAN_SCRIPT
echo ' IFACE=wlan3' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'if [ -e /etc/default/batctl ]; then' >> $BATMAN_SCRIPT
echo ' . /etc/default/batctl' >> $BATMAN_SCRIPT
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
echo ' fi' >> $BATMAN_SCRIPT
echo ' echo "info: enabling batman-adv mesh network $ESSID on $IFACE"' >> $BATMAN_SCRIPT
echo '#!/bin/bash' > $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'if [[ $1 == "start" ]]; then' >> $BATMAN_SCRIPT
echo ' # install avahi' >> $BATMAN_SCRIPT
echo ' apt-get -y install avahi-utils avahi-autoipd avahi-daemon avahi-dnsconfd bittornado' >> $BATMAN_SCRIPT
echo ' sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|use-ipv4=.*|use-ipv4=yes|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" /etc/avahi/avahi-daemon.conf' >> $BATMAN_SCRIPT
echo ' sed -i "s|hosts:.*|hosts: files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl restart avahi-daemon' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' service avahi-daemon restart' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo '# Mesh definition' >> $BATMAN_SCRIPT
echo "ESSID=$ESSID" >> $BATMAN_SCRIPT
echo "CELLID=$BATMAN_CELLID" >> $BATMAN_SCRIPT
echo "CHANNEL=$WIFI_CHANNEL" >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo '# Ethernet bridge definition (bridged to bat0)' >> $BATMAN_SCRIPT
echo 'BRIDGE=br-mesh' >> $BATMAN_SCRIPT
echo "IFACE=$WIFI_INTERFACE" >> $BATMAN_SCRIPT
echo 'EIFACE=eth0' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT
echo ' if grep -q "wlan1" /proc/net/dev; then' >> $BATMAN_SCRIPT
echo ' IFACE=wlan1' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT
echo ' if grep -q "wlan2" /proc/net/dev; then' >> $BATMAN_SCRIPT
echo ' IFACE=wlan2' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo 'if [[ $IFACE == "wlan0" ]]; then' >> $BATMAN_SCRIPT
echo ' if grep -q "wlan3" /proc/net/dev; then' >> $BATMAN_SCRIPT
echo ' IFACE=wlan3' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'if [ -e /etc/default/batctl ]; then' >> $BATMAN_SCRIPT
echo ' . /etc/default/batctl' >> $BATMAN_SCRIPT
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
echo ' fi' >> $BATMAN_SCRIPT
echo ' echo "info: enabling batman-adv mesh network $ESSID on $IFACE"' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl stop network-manager' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' service network-manager stop' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' sleep 5' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo " # remove an avahi service which isn't used" >> $BATMAN_SCRIPT
echo ' if [ -f /etc/avahi/services/udisks.service ]; then' >> $BATMAN_SCRIPT
echo ' sudo rm /etc/avahi/services/udisks.service' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' # Might have to re-enable wifi' >> $BATMAN_SCRIPT
echo ' rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE down' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE mtu 1532' >> $BATMAN_SCRIPT
echo ' iwconfig $IFACE enc off' >> $BATMAN_SCRIPT
echo ' iwconfig $IFACE mode ad-hoc essid $ESSID channel $CHANNEL' >> $BATMAN_SCRIPT
echo ' sleep 1' >> $BATMAN_SCRIPT
echo ' iwconfig $IFACE ap $CELLID' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' modprobe batman-adv' >> $BATMAN_SCRIPT
echo ' batctl if add $IFACE' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE up' >> $BATMAN_SCRIPT
echo ' avahi-autoipd --force-bind --daemonize --wait $BRIDGE' >> $BATMAN_SCRIPT
echo ' avahi-autoipd --force-bind --daemonize --wait $IFACE' >> $BATMAN_SCRIPT
echo ' ifconfig bat0 up promisc' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' #Use persistent HWAddr' >> $BATMAN_SCRIPT
echo ' ether_new=$(ifconfig eth0 | grep HWaddr | sed -e "s/.*HWaddr //")' >> $BATMAN_SCRIPT
echo ' if [ ! -f /var/lib/mesh-node/bat0 ]; then' >> $BATMAN_SCRIPT
echo ' mkdir /var/lib/mesh-node' >> $BATMAN_SCRIPT
echo ' echo "${ether_new}" > /var/lib/mesh-node/bat0' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' ether=$(cat /var/lib/mesh-node/bat0)' >> $BATMAN_SCRIPT
echo ' ifconfig bat0 hw ether ${ether}' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' if [ "$EIFACE" ] ; then' >> $BATMAN_SCRIPT
echo ' brctl addbr $BRIDGE' >> $BATMAN_SCRIPT
echo ' brctl addif $BRIDGE bat0' >> $BATMAN_SCRIPT
echo ' brctl addif $BRIDGE $EIFACE' >> $BATMAN_SCRIPT
echo ' ifconfig bat0 0.0.0.0' >> $BATMAN_SCRIPT
echo ' ifconfig $EIFACE 0.0.0.0' >> $BATMAN_SCRIPT
echo ' ifconfig $EIFACE up promisc' >> $BATMAN_SCRIPT
echo ' ifconfig $BRIDGE up' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p tcp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p udp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p tcp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p udp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p tcp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p udp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p udp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p udp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p tcp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p tcp --dport $IPFS_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p udp --dport 1900 -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p tcp --dport 80 -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p udp -m udp -j ACCEPT" >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl restart avahi-daemon' >> $BATMAN_SCRIPT
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
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
echo ' fi' >> $BATMAN_SCRIPT
echo ' if [ "$EIFACE" ]; then' >> $BATMAN_SCRIPT
echo ' brctl delif $BRIDGE bat0' >> $BATMAN_SCRIPT
echo ' brctl delif $BRIDGE $EIFACE' >> $BATMAN_SCRIPT
echo ' ifconfig $BRIDGE down || true' >> $BATMAN_SCRIPT
echo ' brctl delbr $BRIDGE' >> $BATMAN_SCRIPT
echo ' ifconfig $EIFACE down -promisc' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' avahi-autoipd -k $BRIDGE' >> $BATMAN_SCRIPT
echo ' avahi-autoipd -k $IFACE' >> $BATMAN_SCRIPT
echo ' ifconfig bat0 down -promisc' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' batctl if del $IFACE' >> $BATMAN_SCRIPT
echo ' rmmod batman-adv' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE mtu 1500' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE down' >> $BATMAN_SCRIPT
echo ' iwconfig $IFACE mode managed' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p tcp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p udp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p tcp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p udp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p tcp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p udp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p udp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p udp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p tcp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p tcp --dport $IPFS_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p udp --dport 1900 -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p tcp --dport 80 -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p udp -m udp -j ACCEPT" >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl restart network-manager' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' service network-manager restart' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' ' >> $BATMAN_SCRIPT
echo ' # restore tox bootstrap nodes for the internet' >> $BATMAN_SCRIPT
echo ' if [ -f /usr/share/toxic/DHTnodes.internet ]; then' >> $BATMAN_SCRIPT
echo ' mv /usr/share/toxic/DHTnodes.internet /usr/share/toxic/DHTnodes' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' if [ -f /usr/local/share/toxic/DHTnodes.internet ]; then' >> $BATMAN_SCRIPT
echo ' mv /usr/local/share/toxic/DHTnodes.internet /usr/local/share/toxic/DHTnodes' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl stop avahi-daemon' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' service avahi-daemon stop' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' sudo rm -f /tmp/meshtype' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' # kill processes' >> $BATMAN_SCRIPT
echo ' zeronet_proc=$(ps aux | grep zeronet | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT
echo ' if [ "$zeronet_proc" ]; then' >> $BATMAN_SCRIPT
echo ' kill -9 $zeronet_proc 2> /dev/null' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' tracker_proc=$(ps aux | grep bttrack | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT
echo ' if [ "$tracker_proc" ]; then' >> $BATMAN_SCRIPT
echo ' kill -9 $tracker_proc 2> /dev/null' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' if [ ! -f /etc/systemd/system/ipfs.service ]; then' >> $BATMAN_SCRIPT
echo ' ipfs_proc=$(ps aux | grep ipfs | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT
echo ' if [ "$ipfs_proc" ]; then' >> $BATMAN_SCRIPT
echo ' kill -9 $ipfs_proc 2> /dev/null' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '}' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'if ! grep -q "$IFACE" /proc/net/dev; then' >> $BATMAN_SCRIPT
echo ' echo "Interface $IFACE was not found"' >> $BATMAN_SCRIPT
echo ' stop' >> $BATMAN_SCRIPT
echo ' exit 1' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'case "$1" in' >> $BATMAN_SCRIPT
echo ' start|stop)' >> $BATMAN_SCRIPT
echo ' $1' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' restart)' >> $BATMAN_SCRIPT
echo ' stop' >> $BATMAN_SCRIPT
echo ' sleep 10' >> $BATMAN_SCRIPT
echo ' start' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' status)' >> $BATMAN_SCRIPT
echo ' batctl o' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' ping)' >> $BATMAN_SCRIPT
echo ' batctl ping $2' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' ls|list)' >> $BATMAN_SCRIPT
echo ' avahi-browse -atl' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' *)' >> $BATMAN_SCRIPT
echo ' echo "error: invalid parameter $1"' >> $BATMAN_SCRIPT
echo ' echo "usage: $0 {start|stop|restart|status|ping|ls|list}"' >> $BATMAN_SCRIPT
echo ' exit 2' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo 'esac' >> $BATMAN_SCRIPT
echo 'exit 0' >> $BATMAN_SCRIPT
chmod +x $BATMAN_SCRIPT
sudo cp -f $BATMAN_SCRIPT /usr/bin/batman
rm $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl stop network-manager' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' service network-manager stop' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' sleep 5' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo " # remove an avahi service which isn't used" >> $BATMAN_SCRIPT
echo ' if [ -f /etc/avahi/services/udisks.service ]; then' >> $BATMAN_SCRIPT
echo ' sudo rm /etc/avahi/services/udisks.service' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' # Might have to re-enable wifi' >> $BATMAN_SCRIPT
echo ' rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE down' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE mtu 1532' >> $BATMAN_SCRIPT
echo ' iwconfig $IFACE enc off' >> $BATMAN_SCRIPT
echo ' iwconfig $IFACE mode ad-hoc essid $ESSID channel $CHANNEL' >> $BATMAN_SCRIPT
echo ' sleep 1' >> $BATMAN_SCRIPT
echo ' iwconfig $IFACE ap $CELLID' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' modprobe batman-adv' >> $BATMAN_SCRIPT
echo ' batctl if add $IFACE' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE up' >> $BATMAN_SCRIPT
echo ' avahi-autoipd --force-bind --daemonize --wait $BRIDGE' >> $BATMAN_SCRIPT
echo ' avahi-autoipd --force-bind --daemonize --wait $IFACE' >> $BATMAN_SCRIPT
echo ' ifconfig bat0 up promisc' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' #Use persistent HWAddr' >> $BATMAN_SCRIPT
echo ' ether_new=$(ifconfig eth0 | grep HWaddr | sed -e "s/.*HWaddr //")' >> $BATMAN_SCRIPT
echo ' if [ ! -f /var/lib/mesh-node/bat0 ]; then' >> $BATMAN_SCRIPT
echo ' mkdir /var/lib/mesh-node' >> $BATMAN_SCRIPT
echo ' echo "${ether_new}" > /var/lib/mesh-node/bat0' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' ether=$(cat /var/lib/mesh-node/bat0)' >> $BATMAN_SCRIPT
echo ' ifconfig bat0 hw ether ${ether}' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' if [ "$EIFACE" ] ; then' >> $BATMAN_SCRIPT
echo ' brctl addbr $BRIDGE' >> $BATMAN_SCRIPT
echo ' brctl addif $BRIDGE bat0' >> $BATMAN_SCRIPT
echo ' brctl addif $BRIDGE $EIFACE' >> $BATMAN_SCRIPT
echo ' ifconfig bat0 0.0.0.0' >> $BATMAN_SCRIPT
echo ' ifconfig $EIFACE 0.0.0.0' >> $BATMAN_SCRIPT
echo ' ifconfig $EIFACE up promisc' >> $BATMAN_SCRIPT
echo ' ifconfig $BRIDGE up' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p tcp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p udp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p tcp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p udp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p tcp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -A INPUT -p udp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p udp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p udp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p tcp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p tcp --dport $IPFS_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p udp --dport 1900 -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p tcp --dport 80 -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -A INPUT -p udp -m udp -j ACCEPT" >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl restart avahi-daemon' >> $BATMAN_SCRIPT
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
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
echo ' fi' >> $BATMAN_SCRIPT
echo ' if [ "$EIFACE" ]; then' >> $BATMAN_SCRIPT
echo ' brctl delif $BRIDGE bat0' >> $BATMAN_SCRIPT
echo ' brctl delif $BRIDGE $EIFACE' >> $BATMAN_SCRIPT
echo ' ifconfig $BRIDGE down || true' >> $BATMAN_SCRIPT
echo ' brctl delbr $BRIDGE' >> $BATMAN_SCRIPT
echo ' ifconfig $EIFACE down -promisc' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' avahi-autoipd -k $BRIDGE' >> $BATMAN_SCRIPT
echo ' avahi-autoipd -k $IFACE' >> $BATMAN_SCRIPT
echo ' ifconfig bat0 down -promisc' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' batctl if del $IFACE' >> $BATMAN_SCRIPT
echo ' rmmod batman-adv' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE mtu 1500' >> $BATMAN_SCRIPT
echo ' ifconfig $IFACE down' >> $BATMAN_SCRIPT
echo ' iwconfig $IFACE mode managed' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p tcp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p udp --dport 548 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p tcp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p udp --dport 5353 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p tcp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT
echo ' iptables -D INPUT -p udp --dport 5354 -j ACCEPT' >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p tcp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p udp --dport $ZERONET_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p udp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p tcp --dport $TRACKER_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p tcp --dport $IPFS_PORT -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p udp --dport 1900 -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p tcp --dport 80 -j ACCEPT" >> $BATMAN_SCRIPT
echo " iptables -D INPUT -p udp -m udp -j ACCEPT" >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl restart network-manager' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' service network-manager restart' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' ' >> $BATMAN_SCRIPT
echo ' # restore tox bootstrap nodes for the internet' >> $BATMAN_SCRIPT
echo ' if [ -f /usr/share/toxic/DHTnodes.internet ]; then' >> $BATMAN_SCRIPT
echo ' mv /usr/share/toxic/DHTnodes.internet /usr/share/toxic/DHTnodes' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' if [ -f /usr/local/share/toxic/DHTnodes.internet ]; then' >> $BATMAN_SCRIPT
echo ' mv /usr/local/share/toxic/DHTnodes.internet /usr/local/share/toxic/DHTnodes' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' if [ -f /bin/systemctl ]; then' >> $BATMAN_SCRIPT
echo ' systemctl stop avahi-daemon' >> $BATMAN_SCRIPT
echo ' else' >> $BATMAN_SCRIPT
echo ' service avahi-daemon stop' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' sudo rm -f /tmp/meshtype' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo ' # kill processes' >> $BATMAN_SCRIPT
echo ' zeronet_proc=$(ps aux | grep zeronet | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT
echo ' if [ "$zeronet_proc" ]; then' >> $BATMAN_SCRIPT
echo ' kill -9 $zeronet_proc 2> /dev/null' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' tracker_proc=$(ps aux | grep bttrack | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT
echo ' if [ "$tracker_proc" ]; then' >> $BATMAN_SCRIPT
echo ' kill -9 $tracker_proc 2> /dev/null' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' if [ ! -f /etc/systemd/system/ipfs.service ]; then' >> $BATMAN_SCRIPT
echo ' ipfs_proc=$(ps aux | grep ipfs | grep -v grep | awk -F " " "{print $2}" | head -n1)' >> $BATMAN_SCRIPT
echo ' if [ "$ipfs_proc" ]; then' >> $BATMAN_SCRIPT
echo ' kill -9 $ipfs_proc 2> /dev/null' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo ' fi' >> $BATMAN_SCRIPT
echo '}' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'if ! grep -q "$IFACE" /proc/net/dev; then' >> $BATMAN_SCRIPT
echo ' echo "Interface $IFACE was not found"' >> $BATMAN_SCRIPT
echo ' stop' >> $BATMAN_SCRIPT
echo ' exit 1' >> $BATMAN_SCRIPT
echo 'fi' >> $BATMAN_SCRIPT
echo '' >> $BATMAN_SCRIPT
echo 'case "$1" in' >> $BATMAN_SCRIPT
echo ' start|stop)' >> $BATMAN_SCRIPT
echo ' $1' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' restart)' >> $BATMAN_SCRIPT
echo ' stop' >> $BATMAN_SCRIPT
echo ' sleep 10' >> $BATMAN_SCRIPT
echo ' start' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' status)' >> $BATMAN_SCRIPT
echo ' batctl o' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' ping)' >> $BATMAN_SCRIPT
echo ' batctl ping $2' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' ls|list)' >> $BATMAN_SCRIPT
echo ' avahi-browse -atl' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo ' *)' >> $BATMAN_SCRIPT
echo ' echo "error: invalid parameter $1"' >> $BATMAN_SCRIPT
echo ' echo "usage: $0 {start|stop|restart|status|ping|ls|list}"' >> $BATMAN_SCRIPT
echo ' exit 2' >> $BATMAN_SCRIPT
echo ' ;;' >> $BATMAN_SCRIPT
echo 'esac' >> $BATMAN_SCRIPT
echo 'exit 0' >> $BATMAN_SCRIPT
chmod +x $BATMAN_SCRIPT
sudo cp -f $BATMAN_SCRIPT /usr/bin/batman
rm $BATMAN_SCRIPT
}
function show_help {

View File

@ -270,6 +270,12 @@ function configure_zeronet_forum {
}
function configure_tox {
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}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
echo $'Regenerating Tox bootstrap node keys'
systemctl stop tox-bootstrapd.service
if [ -f /var/lib/tox-bootstrapd/keys ]; then
@ -292,7 +298,7 @@ function configure_tox {
su -c "echo 'n
/nick P$PEER_ID
/exit
' | /usr/bin/toxic -d" - $MY_USERNAME
' | $TOXIC_FILE -d" - $MY_USERNAME
fi
}

View File

@ -34,7 +34,11 @@ export TEXTDOMAIN=${PROJECT_NAME}-mesh
export TEXTDOMAINDIR="/usr/share/locale"
MUMBLE_PATH=/usr/bin/mumble
TOXIC_PATH=/usr/bin/toxic
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}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
DHTNODES=/usr/share/toxic/DHTnodes
PEERS_FILE=/tmp/meshpeers.txt
@ -164,7 +168,7 @@ function install_toxid {
function run_tox {
echo $QTOX_INI
if [[ -f $TOXIC_PATH || -f $QTOX_INI ]]; then
if [[ -f $TOXIC_FILE || -f $QTOX_INI ]]; then
if [[ $SERVER_INSTALLATION == "no" ]]; then
# update bootstrap nodes
if [ -f $DHTNODES ]; then
@ -213,9 +217,9 @@ function run_tox {
/nick $USER
/add $PEER_TOX_ID
/exit
" | $TOXIC_PATH -d
" | $TOXIC_FILE -d
# Running twice is a hack to get around buggyness in the client
$TOXIC_PATH -d
$TOXIC_FILE -d
fi
exit 0
else
@ -239,7 +243,7 @@ fi
# alternative toxic paths
if [ -f /usr/local/bin/toxic ]; then
TOXIC_PATH=/usr/local/bin/toxic
TOXIC_FILE=/usr/local/bin/toxic
fi
if [ -f /usr/local/share/toxic/DHTnodes ]; then
DHTNODES=/usr/local/share/toxic/DHTnodes
@ -259,8 +263,8 @@ fi
avahi-browse -atl | awk -F ' ' '{print $4}' | sort -u > $PEERS_FILE
if [ ! -f $PEERS_FILE ]; then
echo $'No peers were found'
exit 0
echo $'No peers were found'
exit 0
fi
ctr=0
@ -269,8 +273,8 @@ while IFS='' read -r line || [[ -n "$line" ]]; do
done < "$PEERS_FILE"
if [ ${ctr} -lt "1" ]; then
echo $'No peers were found'
exit 0
echo $'No peers were found'
exit 0
fi
clear
@ -315,7 +319,7 @@ if [ ! $AVAHI_DOMAIN ]; then
fi
# if only mumble is installed
if [ ! -f $TOXIC_PATH ]; then
if [ ! -f $TOXIC_FILE ]; then
if [ -f $MUMBLE_PATH ]; then
$MUMBLE_PATH &
exit 0

View File

@ -225,15 +225,21 @@ function mesh_avahi {
}
function mesh_babel_client {
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}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
if [ ! -f ${rootdir}/tmp/meshtype ]; then
$CHROOT_PREFIX sudo apt-get -y install babeld
$CHROOT_PREFIX sudo apt-get -y install irssi mumble
if [ ! -f /usr/bin/toxic ]; then
if [ ! -f $TOXIC_FILE ]; then
$CHROOT_PREFIX sudo apt-get -y install toxic
echo "n
/nick $USER
/exit
" | ${rootdir}/usr/bin/toxic -d
" | ${rootdir}$TOXIC_FILE -d
fi
CURR_DIR=$(pwd)
@ -562,6 +568,12 @@ function mesh_tox_node {
}
function mesh_tox_client {
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}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
# obtain commits from the main file
if [ -f /usr/local/bin/freedombone ]; then
TOXIC_COMMIT_MAIN=$(cat /usr/local/bin/freedombone | grep "TOXIC_COMMIT=" | head -n 1 | awk -F "'" '{print $2}')
@ -587,7 +599,7 @@ function mesh_tox_client {
exit 74872
fi
$CHROOT_PREFIX make install
if [ ! -f /usr/local/bin/toxic ]; then
if [ ! -f $TOXIC_FILE ]; then
echo $'Tox client was not installed'
exit 63278
fi
@ -706,17 +718,23 @@ function mesh_zeronet {
}
function mesh_batman_client {
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}')
else
TOXIC_FILE=$(cat /usr/bin/${PROJECT_NAME} | grep "TOXIC_FILE=" | head -n 1 | awk -F '=' '{print $2}')
fi
if [ ! -f ${rootdir}/tmp/meshtype ]; then
$CHROOT_PREFIX sudo apt-get -y install iproute bridge-utils libnetfilter-conntrack3 batctl
$CHROOT_PREFIX sudo apt-get -y install python-dev libevent-dev ebtables python-pip
$CHROOT_PREFIX sudo apt-get -y install wireless-tools rfkill
$CHROOT_PREFIX sudo apt-get -y install irssi mumble
if [ ! -f /usr/bin/toxic ]; then
if [ ! -f $TOXIC_FILE ]; then
$CHROOT_PREFIX sudo apt-get -y install toxic
echo "n
/nick $USER
/exit
" | ${rootdir}/usr/bin/toxic -d
" | ${rootdir}$TOXIC_FILE -d
fi
fi