Преглед на файлове

mesh protocol is bmx6 or 7 with default of 7

Bob Mottram преди 7 години
родител
ревизия
390c1c6a44
променени са 6 файла, в които са добавени 24 реда и са изтрити 74 реда
  1. 2
    13
      src/freedombone-image-customise
  2. 18
    8
      src/freedombone-mesh-batman
  3. 0
    2
      src/freedombone-mesh-bmx6
  4. 0
    2
      src/freedombone-mesh-bmx7
  5. 2
    27
      src/freedombone-mesh-reset
  6. 2
    22
      src/freedombone-utils-mesh

+ 2
- 13
src/freedombone-image-customise Целия файл

649
 mesh_shutdown_script() {
649
 mesh_shutdown_script() {
650
     mesh_shutdown_script=$rootdir/usr/bin/meshshutdown
650
     mesh_shutdown_script=$rootdir/usr/bin/meshshutdown
651
     echo '#!/bin/bash' > $mesh_shutdown_script
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
     chroot "$rootdir" chmod +x /usr/bin/meshshutdown
653
     chroot "$rootdir" chmod +x /usr/bin/meshshutdown
665
 
654
 
666
     echo '[Unit]' > $rootdir/etc/systemd/system/meshshutdown.service
655
     echo '[Unit]' > $rootdir/etc/systemd/system/meshshutdown.service
848
     chroot "$rootdir" apt-get -yq install traceroute
837
     chroot "$rootdir" apt-get -yq install traceroute
849
 
838
 
850
     # set the default protocol to be used
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
     sed -i 's|#net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf
842
     sed -i 's|#net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf
854
     sed -i 's|net.ipv6.conf.all.forwarding.*|net.ipv6.conf.all.forwarding=1|g' $rootdir/etc/sysctl.conf
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 Целия файл

54
 }
54
 }
55
 
55
 
56
 function stop {
56
 function stop {
57
+    if [ ! -f $MESH_CURRENT_PROTOCOL ]; then
58
+        return
59
+    fi
60
+
57
     if [ -z "$IFACE" ]; then
61
     if [ -z "$IFACE" ]; then
58
         echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
62
         echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
59
         return
63
         return
60
     fi
64
     fi
61
 
65
 
66
+    systemctl stop bmx6
67
+    systemctl stop bmx7
62
     systemctl stop dnsmasq
68
     systemctl stop dnsmasq
63
     systemctl disable dnsmasq
69
     systemctl disable dnsmasq
64
 
70
 
154
     fi
160
     fi
155
     echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"
161
     echo "info: enabling batman-adv mesh network $WIFI_SSID on $IFACE"
156
 
162
 
157
-    mesh_protocol_stop
158
-
163
+    stop
159
     systemctl stop network-manager
164
     systemctl stop network-manager
160
     sleep 5
165
     sleep 5
161
 
166
 
188
     modprobe batman-adv
193
     modprobe batman-adv
189
 
194
 
190
     # avahi on ipv4
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
     add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
199
     add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
196
 
200
 
221
 
225
 
222
     enable_mesh_firewall
226
     enable_mesh_firewall
223
 
227
 
224
-    systemctl restart avahi-daemon
225
-
226
     enable_mesh_scuttlebot
228
     enable_mesh_scuttlebot
227
     enable_mesh_tor
229
     enable_mesh_tor
228
 
230
 
230
 
232
 
231
     systemctl restart nginx
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
     verify
243
     verify
234
 
244
 
235
-    echo "batman-adv" > $MESH_CURRENT_PROTOCOL
245
+    echo "$MESH_DEFAULT_PROTOCOL" > $MESH_CURRENT_PROTOCOL
236
 }
246
 }
237
 
247
 
238
 function monitor {
248
 function monitor {

+ 0
- 2
src/freedombone-mesh-bmx6 Целия файл

137
     fi
137
     fi
138
     echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE"
138
     echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE"
139
 
139
 
140
-    mesh_protocol_stop
141
-
142
     systemctl stop network-manager
140
     systemctl stop network-manager
143
     sleep 5
141
     sleep 5
144
 
142
 

+ 0
- 2
src/freedombone-mesh-bmx7 Целия файл

135
     fi
135
     fi
136
     echo "info: enabling BMX7 mesh network $WIFI_SSID on $IFACE"
136
     echo "info: enabling BMX7 mesh network $WIFI_SSID on $IFACE"
137
 
137
 
138
-    mesh_protocol_stop
139
-
140
     systemctl stop network-manager
138
     systemctl stop network-manager
141
     sleep 5
139
     sleep 5
142
 
140
 

+ 2
- 27
src/freedombone-mesh-reset Целия файл

31
 export TEXTDOMAIN=${PROJECT_NAME}-mesh-reset
31
 export TEXTDOMAIN=${PROJECT_NAME}-mesh-reset
32
 export TEXTDOMAINDIR="/usr/share/locale"
32
 export TEXTDOMAINDIR="/usr/share/locale"
33
 
33
 
34
-MESH_CURRENT_PROTOCOL=/root/.mesh_protocol
35
 MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
34
 MESH_INSTALL_COMPLETED=/root/.mesh_setup_completed
36
 
35
 
37
 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
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
     sudo pkill qtox
40
     sudo pkill qtox
58
     sudo pkill firefox
41
     sudo pkill firefox
62
     sudo rm -f $MESH_INSTALL_COMPLETED
45
     sudo rm -f $MESH_INSTALL_COMPLETED
63
     sudo ${PROJECT_NAME}-image-mesh $USER new
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
     if [ -f $HOME/mesh-desktop.sh ]; then
50
     if [ -f $HOME/mesh-desktop.sh ]; then
76
         $HOME/mesh-desktop.sh
51
         $HOME/mesh-desktop.sh

+ 2
- 22
src/freedombone-utils-mesh Целия файл

32
 MESH_CURRENT_PROTOCOL=/root/.mesh_protocol
32
 MESH_CURRENT_PROTOCOL=/root/.mesh_protocol
33
 MESH_DEFAULT_PROTOCOL=/root/.mesh_protocol_default
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
 function mesh_protocol_init {
35
 function mesh_protocol_init {
56
     if [[ $1 == "start" ]]; then
36
     if [[ $1 == "start" ]]; then
57
         # install avahi
37
         # install avahi
58
         sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
38
         sed -i "s|#host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
59
         sed -i "s|host-name=.*|host-name=$(hostname)|g" /etc/avahi/avahi-daemon.conf
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
         sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" /etc/avahi/avahi-daemon.conf
42
         sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" /etc/avahi/avahi-daemon.conf
63
         sed -i "s|hosts:.*|hosts:          files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf
43
         sed -i "s|hosts:.*|hosts:          files mdns4_minimal dns mdns4 mdns|g" /etc/nsswitch.conf
64
     fi
44
     fi