Browse Source

mesh protocol is bmx6 or 7 with default of 7

Bob Mottram 7 years ago
parent
commit
390c1c6a44

+ 2
- 13
src/freedombone-image-customise View File

@@ -649,18 +649,7 @@ EOF
649 649
 mesh_shutdown_script() {
650 650
     mesh_shutdown_script=$rootdir/usr/bin/meshshutdown
651 651
     echo '#!/bin/bash' > $mesh_shutdown_script
652
-    echo '' >> $mesh_shutdown_script
653
-    echo "if grep -q 'batman-adv' ${MESH_CURRENT_PROTOCOL}; then" >> $mesh_shutdown_script
654
-    echo '    batman stop' >> $mesh_shutdown_script
655
-    echo 'fi' >> $mesh_shutdown_script
656
-    echo '' >> $mesh_shutdown_script
657
-    echo "if grep -q 'bmx6' ${MESH_CURRENT_PROTOCOL}; then" >> $mesh_shutdown_script
658
-    echo '    bmx stop' >> $mesh_shutdown_script
659
-    echo 'fi' >> $mesh_shutdown_script
660
-    echo '' >> $mesh_shutdown_script
661
-    echo "if grep -q 'bmx7' ${MESH_CURRENT_PROTOCOL}; then" >> $mesh_shutdown_script
662
-    echo '    bmxsec stop' >> $mesh_shutdown_script
663
-    echo 'fi' >> $mesh_shutdown_script
652
+    echo 'batman stop' >> $mesh_shutdown_script
664 653
     chroot "$rootdir" chmod +x /usr/bin/meshshutdown
665 654
 
666 655
     echo '[Unit]' > $rootdir/etc/systemd/system/meshshutdown.service
@@ -848,7 +837,7 @@ initialise_mesh() {
848 837
     chroot "$rootdir" apt-get -yq install traceroute
849 838
 
850 839
     # set the default protocol to be used
851
-    echo 'batman-adv' > $rootdir$MESH_DEFAULT_PROTOCOL
840
+    echo 'bmx7' > $rootdir$MESH_DEFAULT_PROTOCOL
852 841
 
853 842
     sed -i 's|#net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf
854 843
     sed -i 's|net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf

+ 18
- 8
src/freedombone-mesh-batman View File

@@ -54,11 +54,17 @@ function status {
54 54
 }
55 55
 
56 56
 function stop {
57
+    if [ ! -f $MESH_CURRENT_PROTOCOL ]; then
58
+        return
59
+    fi
60
+
57 61
     if [ -z "$IFACE" ]; then
58 62
         echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
59 63
         return
60 64
     fi
61 65
 
66
+    systemctl stop bmx6
67
+    systemctl stop bmx7
62 68
     systemctl stop dnsmasq
63 69
     systemctl disable dnsmasq
64 70
 
@@ -154,8 +160,7 @@ function start {
154 160
     fi
155 161
     echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"
156 162
 
157
-    mesh_protocol_stop
158
-
163
+    stop
159 164
     systemctl stop network-manager
160 165
     sleep 5
161 166
 
@@ -188,9 +193,8 @@ function start {
188 193
     modprobe batman-adv
189 194
 
190 195
     # avahi on ipv4
191
-    sed -i 's|use-ipv4=.*|use-ipv4=yes|g' /etc/avahi/avahi-daemon.conf
192
-    sed -i 's|use-ipv6=.*|use-ipv6=no|g' /etc/avahi/avahi-daemon.conf
193
-    systemctl restart avahi-daemon
196
+    sed -i 's|use-ipv4=.*|use-ipv4=no|g' /etc/avahi/avahi-daemon.conf
197
+    sed -i 's|use-ipv6=.*|use-ipv6=yes|g' /etc/avahi/avahi-daemon.conf
194 198
 
195 199
     add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
196 200
 
@@ -221,8 +225,6 @@ function start {
221 225
 
222 226
     enable_mesh_firewall
223 227
 
224
-    systemctl restart avahi-daemon
225
-
226 228
     enable_mesh_scuttlebot
227 229
     enable_mesh_tor
228 230
 
@@ -230,9 +232,17 @@ function start {
230 232
 
231 233
     systemctl restart nginx
232 234
 
235
+    if [[ "$MESH_DEFAULT_PROTOCOL" == 'bmx6' ]]; then
236
+        systemctl restart bmx6
237
+    else
238
+        systemctl restart bmx7
239
+    fi
240
+
241
+    systemctl restart avahi-daemon
242
+
233 243
     verify
234 244
 
235
-    echo "batman-adv" > $MESH_CURRENT_PROTOCOL
245
+    echo "$MESH_DEFAULT_PROTOCOL" > $MESH_CURRENT_PROTOCOL
236 246
 }
237 247
 
238 248
 function monitor {

+ 0
- 2
src/freedombone-mesh-bmx6 View File

@@ -137,8 +137,6 @@ function start {
137 137
     fi
138 138
     echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE"
139 139
 
140
-    mesh_protocol_stop
141
-
142 140
     systemctl stop network-manager
143 141
     sleep 5
144 142
 

+ 0
- 2
src/freedombone-mesh-bmx7 View File

@@ -135,8 +135,6 @@ function start {
135 135
     fi
136 136
     echo "info: enabling BMX7 mesh network $WIFI_SSID on $IFACE"
137 137
 
138
-    mesh_protocol_stop
139
-
140 138
     systemctl stop network-manager
141 139
     sleep 5
142 140
 

+ 2
- 27
src/freedombone-mesh-reset View File

@@ -31,28 +31,11 @@ PROJECT_NAME='freedombone'
31 31
 export TEXTDOMAIN=${PROJECT_NAME}-mesh-reset
32 32
 export TEXTDOMAINDIR="/usr/share/locale"
33 33
 
34
-MESH_CURRENT_PROTOCOL=/root/.mesh_protocol
35 34
 MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
36 35
 
37 36
 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
38 37
 
39
-    curr_protocol='batman-adv'
40
-    if grep -q "bmx6" $MESH_CURRENT_PROTOCOL; then
41
-        curr_protocol='bmx6'
42
-    fi
43
-    if grep -q "bmx7" $MESH_CURRENT_PROTOCOL; then
44
-        curr_protocol='bmx7'
45
-    fi
46
-
47
-    if [[ "$curr_protocol" == 'batman-adv' ]]; then
48
-        sudo batman stop
49
-    fi
50
-    if [[ "$curr_protocol" == 'bmx6' ]]; then
51
-        sudo bmx stop
52
-    fi
53
-    if [[ "$curr_protocol" == 'bmx7' ]]; then
54
-        sudo bmxsec stop
55
-    fi
38
+    sudo batman stop
56 39
 
57 40
     sudo pkill qtox
58 41
     sudo pkill firefox
@@ -62,15 +45,7 @@ if ! zenity --question --title=$'New Identity' --text=$"Do you want to reset you
62 45
     sudo rm -f $MESH_INSTALL_COMPLETED
63 46
     sudo ${PROJECT_NAME}-image-mesh $USER new
64 47
 
65
-    if [[ "$curr_protocol" == 'batman-adv' ]]; then
66
-        sudo batman start
67
-    fi
68
-    if [[ "$curr_protocol" == 'bmx6' ]]; then
69
-        sudo bmx start
70
-    fi
71
-    if [[ "$curr_protocol" == 'bmx7' ]]; then
72
-        sudo bmxsec start
73
-    fi
48
+    sudo batman start
74 49
 
75 50
     if [ -f $HOME/mesh-desktop.sh ]; then
76 51
         $HOME/mesh-desktop.sh

+ 2
- 22
src/freedombone-utils-mesh View File

@@ -32,33 +32,13 @@
32 32
 MESH_CURRENT_PROTOCOL=/root/.mesh_protocol
33 33
 MESH_DEFAULT_PROTOCOL=/root/.mesh_protocol_default
34 34
 
35
-function mesh_protocol_stop {
36
-    if [ ! -f $MESH_CURRENT_PROTOCOL ]; then
37
-        return
38
-    fi
39
-
40
-    if grep -q "bmx6" $MESH_CURRENT_PROTOCOL; then
41
-        bmx stop
42
-    fi
43
-
44
-    if grep -q "bmx7" $MESH_CURRENT_PROTOCOL; then
45
-        bmxsec stop
46
-    fi
47
-
48
-    if grep -q "batman-adv" $MESH_CURRENT_PROTOCOL; then
49
-        batman stop
50
-    fi
51
-
52
-    rm $MESH_CURRENT_PROTOCOL
53
-}
54
-
55 35
 function mesh_protocol_init {
56 36
     if [[ $1 == "start" ]]; then
57 37
         # install avahi
58 38
         sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
59 39
         sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
60
-        sed -i "s|use-ipv4=.*|use-ipv4=yes|g" /etc/avahi/avahi-daemon.conf
61
-        sed -i "s|use-ipv6=.*|use-ipv6=no|g" /etc/avahi/avahi-daemon.conf
40
+        sed -i "s|use-ipv4=.*|use-ipv4=no|g" /etc/avahi/avahi-daemon.conf
41
+        sed -i "s|use-ipv6=.*|use-ipv6=yes|g" /etc/avahi/avahi-daemon.conf
62 42
         sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" /etc/avahi/avahi-daemon.conf
63 43
         sed -i "s|hosts:.*|hosts:          files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf
64 44
     fi