Bob Mottram 7 年之前
父節點
當前提交
e581c487ea
共有 4 個檔案被更改,包括 30 行新增662 行删除
  1. 0
    4
      Makefile
  2. 0
    315
      src/freedombone-mesh-bmx6
  3. 0
    313
      src/freedombone-mesh-bmx7
  4. 30
    30
      src/freedombone-mesh-install

+ 0
- 4
Makefile 查看文件

@@ -28,8 +28,6 @@ install:
28 28
 	cp img/avatars/* ${DESTDIR}/usr/share/${APP}/avatars
29 29
 	cp src/* ${DESTDIR}${PREFIX}/bin
30 30
 	cp src/${APP}-mesh-batman ${DESTDIR}${PREFIX}/bin/batman
31
-	cp src/${APP}-mesh-bmx6 ${DESTDIR}${PREFIX}/bin/bmx
32
-	cp src/${APP}-mesh-bmx7 ${DESTDIR}${PREFIX}/bin/bmxsec
33 31
 	cp src/${APP}-backup-local ${DESTDIR}${PREFIX}/bin/backup
34 32
 	cp src/${APP}-backup-local ${DESTDIR}${PREFIX}/bin/backup2friends
35 33
 	cp src/${APP}-restore-local ${DESTDIR}${PREFIX}/bin/restore
@@ -62,8 +60,6 @@ uninstall:
62 60
 	rm -f ${PREFIX}/bin/restore
63 61
 	rm -f ${PREFIX}/bin/restorefromfriend
64 62
 	rm -f ${PREFIX}/bin/batman
65
-	rm -f ${PREFIX}/bin/bmx
66
-	rm -f ${PREFIX}/bin/bmxsec
67 63
 	rm -rf /etc/${APP}
68 64
 	rm -f ${PREFIX}/bin/control
69 65
 	rm -f ${PREFIX}/bin/controluser

+ 0
- 315
src/freedombone-mesh-bmx6 查看文件

@@ -1,315 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-# Used to enable or disable BMX6 mesh protocol on wlanX
12
-#
13
-# License
14
-# =======
15
-#
16
-# Copyright (C) 2018 Bob Mottram <bob@freedombone.net>
17
-#
18
-# This program is free software: you can redistribute it and/or modify
19
-# it under the terms of the GNU Affero General Public License as published by
20
-# the Free Software Foundation, either version 3 of the License, or
21
-# (at your option) any later version.
22
-#
23
-# This program is distributed in the hope that it will be useful,
24
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
25
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
-# GNU Affero General Public License for more details.
27
-#
28
-# You should have received a copy of the GNU Affero General Public License
29
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
-
31
-PROJECT_NAME='freedombone'
32
-COMPLETION_FILE=/root/${PROJECT_NAME}-completed.txt
33
-
34
-# hotspot passphrase must be 5 characters or longer
35
-HOTSPOT_PASSPHRASE="${PROJECT_NAME}"
36
-
37
-source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi
38
-source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh
39
-
40
-mesh_protocol_init
41
-
42
-update_wifi_adaptors
43
-
44
-if [ ! $IFACE ]; then
45
-    echo $'No wlan adaptor'
46
-    exit 0
47
-fi
48
-
49
-function status {
50
-    bmx6 -cd8
51
-}
52
-
53
-function stop {
54
-    if [ -z "$IFACE" ]; then
55
-        echo 'error: unable to find wifi interface, not enabling BMX6 mesh'
56
-        return
57
-    fi
58
-
59
-    systemctl stop dnsmasq
60
-    systemctl disable dnsmasq
61
-    systemctl stop bmx6
62
-    systemctl disable bmx6
63
-
64
-    if [ "$EIFACE" ]; then
65
-        ethernet_connected=$(cat /sys/class/net/$EIFACE/carrier)
66
-        if [[ "$ethernet_connected" != "0" ]]; then
67
-            systemctl stop hostapd
68
-            ifconfig $EIFACE down -promisc
69
-        fi
70
-    fi
71
-
72
-    ifconfig $IFACE down -promisc
73
-
74
-    ifconfig $IFACE mtu 1500
75
-    ifconfig $IFACE down
76
-    iwconfig $IFACE mode managed
77
-
78
-    if [ $IFACE_SECONDARY ]; then
79
-        systemctl stop hostapd
80
-        systemctl disable hostapd
81
-        ifconfig $IFACE_SECONDARY mtu 1500
82
-        ifconfig $IFACE_SECONDARY down
83
-        iwconfig $IFACE_SECONDARY mode managed
84
-    fi
85
-
86
-    disable_mesh_firewall
87
-
88
-    systemctl restart network-manager
89
-
90
-    if [ -f $MESH_CURRENT_PROTOCOL ]; then
91
-        rm $MESH_CURRENT_PROTOCOL
92
-    fi
93
-}
94
-
95
-function verify {
96
-    # TODO
97
-    echo -n ''
98
-}
99
-
100
-function add_wifi_interface {
101
-    ifname=$1
102
-    ifssid=$WIFI_SSID
103
-    if [ $2 ]; then
104
-        ifssid=$2
105
-    fi
106
-    ifmode=ad-hoc
107
-    if [ $3 ]; then
108
-        ifmode=$3
109
-    fi
110
-    ifchannel=$CHANNEL
111
-    if [ $4 ]; then
112
-        ifchannel=$4
113
-    fi
114
-
115
-    ifconfig $ifname down
116
-    ifconfig $ifname mtu 1500
117
-    peermac=$(assign_peer_address)
118
-    if [ ! $peermac ]; then
119
-        echo $"Unable to obtain MAC address for $peermac on $ifname"
120
-        return
121
-    fi
122
-    ifconfig $ifname hw ether $peermac
123
-    echo $"$ifname assigned MAC address $peermac"
124
-    iwconfig $ifname enc off
125
-    iwconfig $ifname mode $ifmode essid $ifssid channel $ifchannel
126
-    #iwconfig wlan0 mode ad-hoc ap 02:ca:ff:ee:ba:be channel 11 essid my-mesh-network
127
-
128
-    ifconfig $ifname up
129
-}
130
-
131
-function start {
132
-    update_wifi_adaptors
133
-
134
-    if [ -z "$IFACE" ] ; then
135
-        echo 'error: unable to find wifi interface, not enabling BMX6 mesh'
136
-        exit 723657
137
-    fi
138
-    echo "info: enabling BMX6 mesh network $WIFI_SSID on $IFACE"
139
-
140
-    systemctl stop network-manager
141
-    sleep 5
142
-
143
-    systemctl stop dnsmasq
144
-    systemctl disable dnsmasq
145
-
146
-    # remove an avahi service which isn't used
147
-    if [ -f /etc/avahi/services/udisks.service ]; then
148
-        sudo rm /etc/avahi/services/udisks.service
149
-    fi
150
-
151
-    global_rate_limit
152
-
153
-    # Might have to re-enable wifi
154
-    rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true
155
-
156
-    secondary_wifi_available=
157
-    if [ $IFACE_SECONDARY ]; then
158
-        if [[ $IFACE != $IFACE_SECONDARY ]]; then
159
-            if [ -d /etc/hostapd ]; then
160
-                if [ ${#HOTSPOT_PASSPHRASE} -gt 4 ]; then
161
-                    secondary_wifi_available=1
162
-                else
163
-                    echo $'Hotspot passphrase is too short'
164
-                fi
165
-            fi
166
-        fi
167
-    fi
168
-
169
-    add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
170
-    ifconfig $IFACE up promisc
171
-
172
-    if [ ! $secondary_wifi_available ]; then
173
-        sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE}|g" /etc/systemd/system/bmx6.service
174
-    else
175
-        sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx6.service
176
-    fi
177
-
178
-    # avahi on ipv6
179
-    sed -i 's|use-ipv4=.*|use-ipv4=no|g' /etc/avahi/avahi-daemon.conf
180
-    sed -i 's|use-ipv6=.*|use-ipv6=yes|g' /etc/avahi/avahi-daemon.conf
181
-    sed -i 's|#disallow-other-stacks=.*|disallow-other-stacks=no|g' /etc/avahi/avahi-daemon.conf
182
-    sed -i 's|disallow-other-stacks=.*|disallow-other-stacks=no|g' /etc/avahi/avahi-daemon.conf
183
-    sed -i 's|#publish-a-on-ipv6=.*|publish-a-on-ipv6=yes|g' /etc/avahi/avahi-daemon.conf
184
-    sed -i 's|publish-a-on-ipv6=.*|publish-a-on-ipv6=yes|g' /etc/avahi/avahi-daemon.conf
185
-    systemctl restart avahi-daemon
186
-
187
-    systemctl daemon-reload
188
-    systemctl enable bmx6
189
-
190
-    # NOTE: Don't connect the secondary wifi device. hostapd will handle that by itself
191
-
192
-    ethernet_connected='0'
193
-    if [ "$EIFACE" ] ; then
194
-        ethernet_connected=$(cat /sys/class/net/$EIFACE/carrier)
195
-        if [[ "$ethernet_connected" != "0" ]]; then
196
-            echo $'Trying ethernet bridge to the internet'
197
-            ifconfig $EIFACE up promisc
198
-            echo $'End of ethernet bridge'
199
-        else
200
-            echo $"$EIFACE is not connected"
201
-        fi
202
-    fi
203
-
204
-    enable_mesh_seconary_wifi
205
-
206
-    enable_mesh_firewall
207
-
208
-    systemctl restart avahi-daemon
209
-
210
-    enable_mesh_scuttlebot
211
-    enable_mesh_tor
212
-
213
-
214
-    sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb
215
-
216
-    systemctl restart nginx
217
-    systemctl restart bmx6
218
-
219
-    verify
220
-
221
-    echo "bmx6" > $MESH_CURRENT_PROTOCOL
222
-}
223
-
224
-function monitor {
225
-    if [ -z "$IFACE" ] ; then
226
-        echo 'error: unable to find wifi interface, not enabling BMX6 mesh'
227
-        exit 723657
228
-    fi
229
-
230
-    clear
231
-    echo ''
232
-    echo $'*** Stopping network ***'
233
-    echo ''
234
-
235
-    stop
236
-
237
-    echo "info: monitoring mesh network $WIFI_SSID on $IFACE"
238
-
239
-    systemctl stop network-manager
240
-    sleep 5
241
-
242
-    clear
243
-    echo ''
244
-    echo $'*** Setting firewall rate limit ***'
245
-    echo ''
246
-
247
-    global_rate_limit
248
-
249
-    clear
250
-    echo ''
251
-    echo $'*** Enabling wifi adaptor in monitor mode ***'
252
-    echo ''
253
-
254
-    # Might have to re-enable wifi
255
-    rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true
256
-
257
-    ifconfig $IFACE down
258
-    ifconfig $IFACE mtu 1500
259
-    ifconfig $IFACE hw ether $(assign_peer_address)
260
-    iwconfig $IFACE enc off
261
-    iwconfig $IFACE mode monitor channel $CHANNEL
262
-    sleep 1
263
-    iwconfig $IFACE ap $CELLID
264
-
265
-    ifconfig $IFACE up
266
-
267
-    horst -i $IFACE
268
-
269
-    clear
270
-    echo ''
271
-    echo $'*** Restarting the network daemon. This may take a while. ***'
272
-    echo ''
273
-
274
-    start
275
-}
276
-
277
-if ! grep -q "$IFACE" /proc/net/dev; then
278
-    echo 'Interface $IFACE was not found'
279
-    stop
280
-    exit 1
281
-fi
282
-
283
-case "$1" in
284
-    start|stop|status|monitor)
285
-        $1
286
-        ;;
287
-    restart)
288
-        clear
289
-        echo ''
290
-        echo $'*** Stopping BMX6 mesh network connection ***'
291
-        echo ''
292
-        stop
293
-        sleep 10
294
-        clear
295
-        echo ''
296
-        echo $'*** Starting BMX6 mesh network connection ***'
297
-        echo ''
298
-        start
299
-        ;;
300
-    ping)
301
-        traceroute6 -n -q 1 $2
302
-        ;;
303
-    data)
304
-        bmx6 -lc traffic=$IFACE
305
-        ;;
306
-    ls|list)
307
-        avahi-browse -atl
308
-        ;;
309
-    *)
310
-        echo "error: invalid parameter $1"
311
-        echo 'usage: $0 {start|stop|restart|status|ping|ls|list}'
312
-        exit 2
313
-        ;;
314
-esac
315
-exit 0

+ 0
- 313
src/freedombone-mesh-bmx7 查看文件

@@ -1,313 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-# Used to enable or disable BMX7 mesh protocol on wlanX
12
-#
13
-# License
14
-# =======
15
-#
16
-# Copyright (C) 2018 Bob Mottram <bob@freedombone.net>
17
-#
18
-# This program is free software: you can redistribute it and/or modify
19
-# it under the terms of the GNU Affero General Public License as published by
20
-# the Free Software Foundation, either version 3 of the License, or
21
-# (at your option) any later version.
22
-#
23
-# This program is distributed in the hope that it will be useful,
24
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
25
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
-# GNU Affero General Public License for more details.
27
-#
28
-# You should have received a copy of the GNU Affero General Public License
29
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
-
31
-PROJECT_NAME='freedombone'
32
-COMPLETION_FILE=/root/${PROJECT_NAME}-completed.txt
33
-
34
-# hotspot passphrase must be 5 characters or longer
35
-HOTSPOT_PASSPHRASE="${PROJECT_NAME}"
36
-
37
-source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi
38
-source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh
39
-
40
-mesh_protocol_init
41
-update_wifi_adaptors
42
-
43
-if [ ! $IFACE ]; then
44
-    echo $'No wlan adaptor'
45
-    exit 0
46
-fi
47
-
48
-function status {
49
-    bmx7 -cd8
50
-}
51
-
52
-function stop {
53
-    if [ -z "$IFACE" ]; then
54
-        echo 'error: unable to find wifi interface, not enabling BMX7 mesh'
55
-        return
56
-    fi
57
-
58
-    systemctl stop dnsmasq
59
-    systemctl disable dnsmasq
60
-    systemctl stop bmx7
61
-    systemctl disable bmx7
62
-
63
-    if [ "$EIFACE" ]; then
64
-        ethernet_connected=$(cat /sys/class/net/$EIFACE/carrier)
65
-        if [[ "$ethernet_connected" != "0" ]]; then
66
-            systemctl stop hostapd
67
-            ifconfig $EIFACE down -promisc
68
-        fi
69
-    fi
70
-
71
-    ifconfig $IFACE down -promisc
72
-
73
-    ifconfig $IFACE mtu 1500
74
-    ifconfig $IFACE down
75
-    iwconfig $IFACE mode managed
76
-
77
-    if [ $IFACE_SECONDARY ]; then
78
-        systemctl stop hostapd
79
-        systemctl disable hostapd
80
-        ifconfig $IFACE_SECONDARY mtu 1500
81
-        ifconfig $IFACE_SECONDARY down
82
-        iwconfig $IFACE_SECONDARY mode managed
83
-    fi
84
-
85
-    disable_mesh_firewall
86
-
87
-    systemctl restart network-manager
88
-
89
-    if [ -f $MESH_CURRENT_PROTOCOL ]; then
90
-        rm $MESH_CURRENT_PROTOCOL
91
-    fi
92
-}
93
-
94
-function verify {
95
-    # TODO
96
-    echo -n ''
97
-}
98
-
99
-function add_wifi_interface {
100
-    ifname=$1
101
-    ifssid=$WIFI_SSID
102
-    if [ $2 ]; then
103
-        ifssid=$2
104
-    fi
105
-    ifmode=ad-hoc
106
-    if [ $3 ]; then
107
-        ifmode=$3
108
-    fi
109
-    ifchannel=$CHANNEL
110
-    if [ $4 ]; then
111
-        ifchannel=$4
112
-    fi
113
-
114
-    ifconfig $ifname down
115
-    ifconfig $ifname mtu 1500
116
-    peermac=$(assign_peer_address)
117
-    if [ ! $peermac ]; then
118
-        echo $"Unable to obtain MAC address for $peermac on $ifname"
119
-        return
120
-    fi
121
-    ifconfig $ifname hw ether $peermac
122
-    echo $"$ifname assigned MAC address $peermac"
123
-    iwconfig $ifname enc off
124
-    iwconfig $ifname mode $ifmode essid $ifssid channel $ifchannel
125
-
126
-    ifconfig $ifname up
127
-}
128
-
129
-function start {
130
-    update_wifi_adaptors
131
-
132
-    if [ -z "$IFACE" ] ; then
133
-        echo 'error: unable to find wifi interface, not enabling BMX7 mesh'
134
-        exit 723657
135
-    fi
136
-    echo "info: enabling BMX7 mesh network $WIFI_SSID on $IFACE"
137
-
138
-    systemctl stop network-manager
139
-    sleep 5
140
-
141
-    systemctl stop dnsmasq
142
-    systemctl disable dnsmasq
143
-
144
-    # remove an avahi service which isn't used
145
-    if [ -f /etc/avahi/services/udisks.service ]; then
146
-        sudo rm /etc/avahi/services/udisks.service
147
-    fi
148
-
149
-    global_rate_limit
150
-
151
-    # Might have to re-enable wifi
152
-    rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true
153
-
154
-    secondary_wifi_available=
155
-    if [ $IFACE_SECONDARY ]; then
156
-        if [[ $IFACE != $IFACE_SECONDARY ]]; then
157
-            if [ -d /etc/hostapd ]; then
158
-                if [ ${#HOTSPOT_PASSPHRASE} -gt 4 ]; then
159
-                    secondary_wifi_available=1
160
-                else
161
-                    echo $'Hotspot passphrase is too short'
162
-                fi
163
-            fi
164
-        fi
165
-    fi
166
-
167
-    add_wifi_interface $IFACE $WIFI_SSID ad-hoc $CHANNEL
168
-    ifconfig $IFACE up promisc
169
-
170
-    if [ ! $secondary_wifi_available ]; then
171
-        sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE}|g" /etc/systemd/system/bmx7.service
172
-    else
173
-        sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx7.service
174
-    fi
175
-
176
-    # avahi on ipv6
177
-    sed -i 's|use-ipv4=.*|use-ipv4=no|g' /etc/avahi/avahi-daemon.conf
178
-    sed -i 's|use-ipv6=.*|use-ipv6=yes|g' /etc/avahi/avahi-daemon.conf
179
-    sed -i 's|#disallow-other-stacks=.*|disallow-other-stacks=no|g' /etc/avahi/avahi-daemon.conf
180
-    sed -i 's|disallow-other-stacks=.*|disallow-other-stacks=no|g' /etc/avahi/avahi-daemon.conf
181
-    sed -i 's|#publish-a-on-ipv6=.*|publish-a-on-ipv6=yes|g' /etc/avahi/avahi-daemon.conf
182
-    sed -i 's|publish-a-on-ipv6=.*|publish-a-on-ipv6=yes|g' /etc/avahi/avahi-daemon.conf
183
-    systemctl restart avahi-daemon
184
-
185
-    systemctl daemon-reload
186
-    systemctl enable bmx7
187
-
188
-    # NOTE: Don't connect the secondary wifi device. hostapd will handle that by itself
189
-
190
-    ethernet_connected='0'
191
-    if [ "$EIFACE" ] ; then
192
-        ethernet_connected=$(cat /sys/class/net/$EIFACE/carrier)
193
-        if [[ "$ethernet_connected" != "0" ]]; then
194
-            echo $'Trying ethernet bridge to the internet'
195
-            ifconfig $EIFACE up promisc
196
-            echo $'End of ethernet bridge'
197
-        else
198
-            echo $"$EIFACE is not connected"
199
-        fi
200
-    fi
201
-
202
-    enable_mesh_seconary_wifi
203
-
204
-    enable_mesh_firewall
205
-
206
-    systemctl restart avahi-daemon
207
-
208
-    enable_mesh_scuttlebot
209
-    enable_mesh_tor
210
-
211
-
212
-    sed -i "s|server_name .*|server_name ${HOSTNAME}.local;|g" /etc/nginx/sites-available/git_ssb
213
-
214
-    systemctl restart nginx
215
-    systemctl restart bmx7
216
-
217
-    verify
218
-
219
-    echo "bmx7" > $MESH_CURRENT_PROTOCOL
220
-}
221
-
222
-function monitor {
223
-    if [ -z "$IFACE" ] ; then
224
-        echo 'error: unable to find wifi interface, not enabling BMX7 mesh'
225
-        exit 723657
226
-    fi
227
-
228
-    clear
229
-    echo ''
230
-    echo $'*** Stopping network ***'
231
-    echo ''
232
-
233
-    stop
234
-
235
-    echo "info: monitoring mesh network $WIFI_SSID on $IFACE"
236
-
237
-    systemctl stop network-manager
238
-    sleep 5
239
-
240
-    clear
241
-    echo ''
242
-    echo $'*** Setting firewall rate limit ***'
243
-    echo ''
244
-
245
-    global_rate_limit
246
-
247
-    clear
248
-    echo ''
249
-    echo $'*** Enabling wifi adaptor in monitor mode ***'
250
-    echo ''
251
-
252
-    # Might have to re-enable wifi
253
-    rfkill unblock $(rfkill list|awk -F: "/phy/ {print $1}") || true
254
-
255
-    ifconfig $IFACE down
256
-    ifconfig $IFACE mtu 1500
257
-    ifconfig $IFACE hw ether $(assign_peer_address)
258
-    iwconfig $IFACE enc off
259
-    iwconfig $IFACE mode monitor channel $CHANNEL
260
-    sleep 1
261
-    iwconfig $IFACE ap $CELLID
262
-
263
-    ifconfig $IFACE up
264
-
265
-    horst -i $IFACE
266
-
267
-    clear
268
-    echo ''
269
-    echo $'*** Restarting the network daemon. This may take a while. ***'
270
-    echo ''
271
-
272
-    start
273
-}
274
-
275
-if ! grep -q "$IFACE" /proc/net/dev; then
276
-    echo 'Interface $IFACE was not found'
277
-    stop
278
-    exit 1
279
-fi
280
-
281
-case "$1" in
282
-    start|stop|status|monitor)
283
-        $1
284
-        ;;
285
-    restart)
286
-        clear
287
-        echo ''
288
-        echo $'*** Stopping BMX7 mesh network connection ***'
289
-        echo ''
290
-        stop
291
-        sleep 10
292
-        clear
293
-        echo ''
294
-        echo $'*** Starting BMX7 mesh network connection ***'
295
-        echo ''
296
-        start
297
-        ;;
298
-    ping)
299
-        traceroute6 -n -q 1 $2
300
-        ;;
301
-    data)
302
-        bmx7 -lc traffic=$IFACE
303
-        ;;
304
-    ls|list)
305
-        avahi-browse -atl
306
-        ;;
307
-    *)
308
-        echo "error: invalid parameter $1"
309
-        echo 'usage: $0 {start|stop|restart|status|ping|ls|list}'
310
-        exit 2
311
-        ;;
312
-esac
313
-exit 0

+ 30
- 30
src/freedombone-mesh-install 查看文件

@@ -99,12 +99,12 @@ function mesh_avahi {
99 99
     sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" $rootdir/etc/avahi/avahi-daemon.conf
100 100
 
101 101
     if [ ! -d $rootdir/etc/avahi/services ]; then
102
-    mkdir -p $rootdir/etc/avahi/services
102
+        mkdir -p $rootdir/etc/avahi/services
103 103
     fi
104 104
 
105 105
     # remove an avahi service which isn't used
106 106
     if [ -f $rootdir/etc/avahi/services/udisks.service ]; then
107
-    rm $rootdir/etc/avahi/services/udisks.service
107
+        rm $rootdir/etc/avahi/services/udisks.service
108 108
     fi
109 109
 
110 110
     # Add an ssh service
@@ -143,15 +143,15 @@ function install_batman {
143 143
     $CHROOT_PREFIX apt-get -yq install wireless-tools rfkill
144 144
 
145 145
     if ! grep -q "batman_adv" $rootdir/etc/modules; then
146
-    echo 'batman_adv' >> $rootdir/etc/modules
146
+        echo 'batman_adv' >> $rootdir/etc/modules
147 147
     fi
148 148
 
149 149
     BATMAN_SCRIPT=$rootdir/var/lib/batman
150 150
 
151 151
     if [ -f /usr/local/bin/${PROJECT_NAME}-mesh-batman ]; then
152
-    cp /usr/local/bin/${PROJECT_NAME}-mesh-batman $BATMAN_SCRIPT
152
+        cp /usr/local/bin/${PROJECT_NAME}-mesh-batman $BATMAN_SCRIPT
153 153
     else
154
-    cp /usr/bin/${PROJECT_NAME}-mesh-batman $BATMAN_SCRIPT
154
+        cp /usr/bin/${PROJECT_NAME}-mesh-batman $BATMAN_SCRIPT
155 155
     fi
156 156
 
157 157
     BATMAN_DAEMON=$rootdir/etc/systemd/system/batman.service
@@ -271,29 +271,29 @@ do
271 271
     key="$1"
272 272
 
273 273
     case $key in
274
-    -h|--help)
275
-        show_help
276
-        ;;
277
-    -f|--function)
278
-        shift
279
-        FN="$1"
280
-        ;;
281
-    -r|--rootdir)
282
-        shift
283
-        rootdir="$1"
284
-        CHROOT_PREFIX='chroot "${rootdir}"'
285
-        ;;
286
-    -w|--wifi|--interface)
287
-        shift
288
-        WIFI_INTERFACE="$1"
289
-        ;;
290
-    --remove)
291
-        shift
292
-        REMOVE="$1"
293
-        ;;
294
-    *)
295
-        # unknown option
296
-        ;;
274
+        -h|--help)
275
+            show_help
276
+            ;;
277
+        -f|--function)
278
+            shift
279
+            FN="$1"
280
+            ;;
281
+        -r|--rootdir)
282
+            shift
283
+            rootdir="$1"
284
+            CHROOT_PREFIX='chroot "${rootdir}"'
285
+            ;;
286
+        -w|--wifi|--interface)
287
+            shift
288
+            WIFI_INTERFACE="$1"
289
+            ;;
290
+        --remove)
291
+            shift
292
+            REMOVE="$1"
293
+            ;;
294
+        *)
295
+            # unknown option
296
+            ;;
297 297
 
298 298
     esac
299 299
     shift
@@ -307,9 +307,9 @@ if [[ $FN == 'firewall' ]]; then
307 307
 fi
308 308
 if [[ $FN == 'batman' ]]; then
309 309
     if [[ $REMOVE != 'yes' ]]; then
310
-    install_batman
310
+        install_batman
311 311
     else
312
-    install_batman_remove
312
+        install_batman_remove
313 313
     fi
314 314
 fi
315 315
 if [[ $FN == 'qtox' ]]; then