mesh protocol is bmx6 or 7 with default of 7
This commit is contained in:
parent
0cc405b215
commit
390c1c6a44
|
@ -649,18 +649,7 @@ EOF
|
||||||
mesh_shutdown_script() {
|
mesh_shutdown_script() {
|
||||||
mesh_shutdown_script=$rootdir/usr/bin/meshshutdown
|
mesh_shutdown_script=$rootdir/usr/bin/meshshutdown
|
||||||
echo '#!/bin/bash' > $mesh_shutdown_script
|
echo '#!/bin/bash' > $mesh_shutdown_script
|
||||||
echo '' >> $mesh_shutdown_script
|
echo 'batman stop' >> $mesh_shutdown_script
|
||||||
echo "if grep -q 'batman-adv' ${MESH_CURRENT_PROTOCOL}; then" >> $mesh_shutdown_script
|
|
||||||
echo ' batman stop' >> $mesh_shutdown_script
|
|
||||||
echo 'fi' >> $mesh_shutdown_script
|
|
||||||
echo '' >> $mesh_shutdown_script
|
|
||||||
echo "if grep -q 'bmx6' ${MESH_CURRENT_PROTOCOL}; then" >> $mesh_shutdown_script
|
|
||||||
echo ' bmx stop' >> $mesh_shutdown_script
|
|
||||||
echo 'fi' >> $mesh_shutdown_script
|
|
||||||
echo '' >> $mesh_shutdown_script
|
|
||||||
echo "if grep -q 'bmx7' ${MESH_CURRENT_PROTOCOL}; then" >> $mesh_shutdown_script
|
|
||||||
echo ' bmxsec stop' >> $mesh_shutdown_script
|
|
||||||
echo 'fi' >> $mesh_shutdown_script
|
|
||||||
chroot "$rootdir" chmod +x /usr/bin/meshshutdown
|
chroot "$rootdir" chmod +x /usr/bin/meshshutdown
|
||||||
|
|
||||||
echo '[Unit]' > $rootdir/etc/systemd/system/meshshutdown.service
|
echo '[Unit]' > $rootdir/etc/systemd/system/meshshutdown.service
|
||||||
|
@ -848,7 +837,7 @@ initialise_mesh() {
|
||||||
chroot "$rootdir" apt-get -yq install traceroute
|
chroot "$rootdir" apt-get -yq install traceroute
|
||||||
|
|
||||||
# set the default protocol to be used
|
# set the default protocol to be used
|
||||||
echo 'batman-adv' > $rootdir$MESH_DEFAULT_PROTOCOL
|
echo 'bmx7' > $rootdir$MESH_DEFAULT_PROTOCOL
|
||||||
|
|
||||||
sed -i 's|#net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf
|
sed -i 's|#net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf
|
||||||
sed -i 's|net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf
|
sed -i 's|net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf
|
||||||
|
|
|
@ -54,11 +54,17 @@ function status {
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop {
|
function stop {
|
||||||
|
if [ ! -f $MESH_CURRENT_PROTOCOL ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$IFACE" ]; then
|
if [ -z "$IFACE" ]; then
|
||||||
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
systemctl stop bmx6
|
||||||
|
systemctl stop bmx7
|
||||||
systemctl stop dnsmasq
|
systemctl stop dnsmasq
|
||||||
systemctl disable dnsmasq
|
systemctl disable dnsmasq
|
||||||
|
|
||||||
|
@ -154,8 +160,7 @@ function start {
|
||||||
fi
|
fi
|
||||||
echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"
|
echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"
|
||||||
|
|
||||||
mesh_protocol_stop
|
stop
|
||||||
|
|
||||||
systemctl stop network-manager
|
systemctl stop network-manager
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
@ -188,9 +193,8 @@ function start {
|
||||||
modprobe batman-adv
|
modprobe batman-adv
|
||||||
|
|
||||||
# avahi on ipv4
|
# avahi on ipv4
|
||||||
sed -i 's|use-ipv4=.*|use-ipv4=yes|g' /etc/avahi/avahi-daemon.conf
|
sed -i 's|use-ipv4=.*|use-ipv4=no|g' /etc/avahi/avahi-daemon.conf
|
||||||
sed -i 's|use-ipv6=.*|use-ipv6=no|g' /etc/avahi/avahi-daemon.conf
|
sed -i 's|use-ipv6=.*|use-ipv6=yes|g' /etc/avahi/avahi-daemon.conf
|
||||||
systemctl restart avahi-daemon
|
|
||||||
|
|
||||||
add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
|
add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
|
||||||
|
|
||||||
|
@ -221,8 +225,6 @@ function start {
|
||||||
|
|
||||||
enable_mesh_firewall
|
enable_mesh_firewall
|
||||||
|
|
||||||
systemctl restart avahi-daemon
|
|
||||||
|
|
||||||
enable_mesh_scuttlebot
|
enable_mesh_scuttlebot
|
||||||
enable_mesh_tor
|
enable_mesh_tor
|
||||||
|
|
||||||
|
@ -230,9 +232,17 @@ function start {
|
||||||
|
|
||||||
systemctl restart nginx
|
systemctl restart nginx
|
||||||
|
|
||||||
|
if [[ "$MESH_DEFAULT_PROTOCOL" == 'bmx6' ]]; then
|
||||||
|
systemctl restart bmx6
|
||||||
|
else
|
||||||
|
systemctl restart bmx7
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl restart avahi-daemon
|
||||||
|
|
||||||
verify
|
verify
|
||||||
|
|
||||||
echo "batman-adv" > $MESH_CURRENT_PROTOCOL
|
echo "$MESH_DEFAULT_PROTOCOL" > $MESH_CURRENT_PROTOCOL
|
||||||
}
|
}
|
||||||
|
|
||||||
function monitor {
|
function monitor {
|
||||||
|
|
|
@ -137,8 +137,6 @@ function start {
|
||||||
fi
|
fi
|
||||||
echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE"
|
echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE"
|
||||||
|
|
||||||
mesh_protocol_stop
|
|
||||||
|
|
||||||
systemctl stop network-manager
|
systemctl stop network-manager
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
|
|
@ -135,8 +135,6 @@ function start {
|
||||||
fi
|
fi
|
||||||
echo "info: enabling BMX7 mesh network $WIFI_SSID on $IFACE"
|
echo "info: enabling BMX7 mesh network $WIFI_SSID on $IFACE"
|
||||||
|
|
||||||
mesh_protocol_stop
|
|
||||||
|
|
||||||
systemctl stop network-manager
|
systemctl stop network-manager
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
|
|
@ -31,28 +31,11 @@ PROJECT_NAME='freedombone'
|
||||||
export TEXTDOMAIN=${PROJECT_NAME}-mesh-reset
|
export TEXTDOMAIN=${PROJECT_NAME}-mesh-reset
|
||||||
export TEXTDOMAINDIR="/usr/share/locale"
|
export TEXTDOMAINDIR="/usr/share/locale"
|
||||||
|
|
||||||
MESH_CURRENT_PROTOCOL=/root/.mesh_protocol
|
|
||||||
MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
|
MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
|
||||||
|
|
||||||
if ! zenity --question --title=$'New Identity' --text=$"Do you want to reset your identity? This will reset ALL data for this peer, and you will not be able to recover it." --ok-label=No --cancel-label=Yes --width=300; then
|
if ! zenity --question --title=$'New Identity' --text=$"Do you want to reset your identity? This will reset ALL data for this peer, and you will not be able to recover it." --ok-label=No --cancel-label=Yes --width=300; then
|
||||||
|
|
||||||
curr_protocol='batman-adv'
|
sudo batman stop
|
||||||
if grep -q "bmx6" $MESH_CURRENT_PROTOCOL; then
|
|
||||||
curr_protocol='bmx6'
|
|
||||||
fi
|
|
||||||
if grep -q "bmx7" $MESH_CURRENT_PROTOCOL; then
|
|
||||||
curr_protocol='bmx7'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$curr_protocol" == 'batman-adv' ]]; then
|
|
||||||
sudo batman stop
|
|
||||||
fi
|
|
||||||
if [[ "$curr_protocol" == 'bmx6' ]]; then
|
|
||||||
sudo bmx stop
|
|
||||||
fi
|
|
||||||
if [[ "$curr_protocol" == 'bmx7' ]]; then
|
|
||||||
sudo bmxsec stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo pkill qtox
|
sudo pkill qtox
|
||||||
sudo pkill firefox
|
sudo pkill firefox
|
||||||
|
@ -62,15 +45,7 @@ if ! zenity --question --title=$'New Identity' --text=$"Do you want to reset you
|
||||||
sudo rm -f $MESH_INSTALL_COMPLETED
|
sudo rm -f $MESH_INSTALL_COMPLETED
|
||||||
sudo ${PROJECT_NAME}-image-mesh $USER new
|
sudo ${PROJECT_NAME}-image-mesh $USER new
|
||||||
|
|
||||||
if [[ "$curr_protocol" == 'batman-adv' ]]; then
|
sudo batman start
|
||||||
sudo batman start
|
|
||||||
fi
|
|
||||||
if [[ "$curr_protocol" == 'bmx6' ]]; then
|
|
||||||
sudo bmx start
|
|
||||||
fi
|
|
||||||
if [[ "$curr_protocol" == 'bmx7' ]]; then
|
|
||||||
sudo bmxsec start
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f $HOME/mesh-desktop.sh ]; then
|
if [ -f $HOME/mesh-desktop.sh ]; then
|
||||||
$HOME/mesh-desktop.sh
|
$HOME/mesh-desktop.sh
|
||||||
|
|
|
@ -32,33 +32,13 @@
|
||||||
MESH_CURRENT_PROTOCOL=/root/.mesh_protocol
|
MESH_CURRENT_PROTOCOL=/root/.mesh_protocol
|
||||||
MESH_DEFAULT_PROTOCOL=/root/.mesh_protocol_default
|
MESH_DEFAULT_PROTOCOL=/root/.mesh_protocol_default
|
||||||
|
|
||||||
function mesh_protocol_stop {
|
|
||||||
if [ ! -f $MESH_CURRENT_PROTOCOL ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep -q "bmx6" $MESH_CURRENT_PROTOCOL; then
|
|
||||||
bmx stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep -q "bmx7" $MESH_CURRENT_PROTOCOL; then
|
|
||||||
bmxsec stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep -q "batman-adv" $MESH_CURRENT_PROTOCOL; then
|
|
||||||
batman stop
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm $MESH_CURRENT_PROTOCOL
|
|
||||||
}
|
|
||||||
|
|
||||||
function mesh_protocol_init {
|
function mesh_protocol_init {
|
||||||
if [[ $1 == "start" ]]; then
|
if [[ $1 == "start" ]]; then
|
||||||
# install avahi
|
# install avahi
|
||||||
sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
|
sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
|
||||||
sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
|
sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
|
||||||
sed -i "s|use-ipv4=.*|use-ipv4=yes|g" /etc/avahi/avahi-daemon.conf
|
sed -i "s|use-ipv4=.*|use-ipv4=no|g" /etc/avahi/avahi-daemon.conf
|
||||||
sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf
|
sed -i "s|use-ipv6=.*|use-ipv6=yes|g" /etc/avahi/avahi-daemon.conf
|
||||||
sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" /etc/avahi/avahi-daemon.conf
|
sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" /etc/avahi/avahi-daemon.conf
|
||||||
sed -i "s|hosts:.*|hosts: files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf
|
sed -i "s|hosts:.*|hosts: files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue