ソースを参照

Merge branch 'stretch' of https://github.com/bashrc/freedombone

Bob Mottram 7 年 前
コミット
fcff148f07

+ 34
- 4
src/freedombone-app-scuttlebot ファイルの表示

@@ -373,19 +373,49 @@ function mesh_install_dat {
373 373
 #!/bin/bash
374 374
 npm install --arch=$NPM_ARCH -g dat
375 375
 npm install --arch=$NPM_ARCH -g @garbados/dat-boi
376
-npm install --arch=$NPM_ARCH -g add-to-systemd
377
-add-to-systemd dat-boi --user "$(whoami)" "$(which dat-boi)"
378 376
 EOF
379 377
     chroot "$rootdir" /bin/chmod +x /usr/bin/install_dat
380 378
     chroot "$rootdir" /usr/bin/install_dat
381 379
     rm "$rootdir/usr/bin/install_dat"
380
+
381
+    { echo '[Unit]';
382
+      echo 'Description=DAT-boi';
383
+      echo 'After=syslog.target';
384
+      echo 'After=network.target';
385
+      echo '';
386
+      echo '[Service]';
387
+      echo 'Type=simple';
388
+      echo 'User=root';
389
+      echo 'Group=root';
390
+      echo 'ExecStart=/usr/local/bin/dat-boi';
391
+      echo 'Restart=always';
392
+      echo '';
393
+      echo '[Install]';
394
+      echo 'WantedBy=multi-user.target'; } > "$rootdir/etc/systemd/system/dat-boi.service"
395
+    chmod +x "$rootdir/etc/systemd/system/dat-boi.service"
396
+    chroot "$rootdir" systemctl enable dat-boi
382 397
 }
383 398
 
384 399
 function install_dat {
385 400
     npm install -g dat
386 401
     npm install -g @garbados/dat-boi
387
-    npm install -g add-to-systemd
388
-    add-to-systemd dat-boi --user "$(whoami)" "$(which dat-boi)"
402
+
403
+    { echo '[Unit]';
404
+      echo 'Description=DAT-boi';
405
+      echo 'After=syslog.target';
406
+      echo 'After=network.target';
407
+      echo '';
408
+      echo '[Service]';
409
+      echo 'Type=simple';
410
+      echo 'User=root';
411
+      echo 'Group=root';
412
+      echo 'ExecStart=/usr/local/bin/dat-boi';
413
+      echo 'Restart=always';
414
+      echo '';
415
+      echo '[Install]';
416
+      echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/dat-boi.service
417
+    chmod +x /etc/systemd/system/dat-boi.service
418
+    systemctl enable dat-boi
389 419
 }
390 420
 
391 421
 function mesh_install_scuttlebot {

+ 21
- 9
src/freedombone-image-customise ファイルの表示

@@ -143,11 +143,11 @@ BMX7_COMMIT='0a82c7c10fef44b259b35e77ab33632aa132d219'
143 143
 
144 144
 PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
145 145
 
146
-function configure_backports {
146
+configure_backports() {
147 147
     echo "deb http://${DEBIAN_REPO}/debian/ ${DEBIAN_VERSION}-backports main" >> "$rootdir/etc/apt/sources.list"
148 148
 }
149 149
 
150
-function configure_contrib_repo {
150
+configure_contrib_repo() {
151 151
     if ! grep -q "contrib" "$rootdir/etc/apt/sources.list"; then
152 152
         chroot "$rootdir" /bin/sed -i "s| main| main contrib|g" /etc/apt/sources.list
153 153
     fi
@@ -973,6 +973,18 @@ initialise_mesh() {
973 973
         MESH_STARTUP_PARAMS="${MY_USERNAME} amnesic"
974 974
     fi
975 975
 
976
+    # command to switch to wired mesh
977
+    { echo '#!/bin/bash';
978
+      echo 'echo -n "eth" > /root/.mesh_interface_type';
979
+      echo 'systemctl reboot -i'; } > "$rootdir/usr/bin/wired"
980
+    chmod +x "$rootdir/usr/bin/wired"
981
+
982
+    # command to switch to wireless mesh
983
+    { echo '#!/bin/bash';
984
+      echo 'echo -n "wlan" > /root/.mesh_interface_type';
985
+      echo 'systemctl reboot -i'; } > "$rootdir/usr/bin/wireless"
986
+    chmod +x "$rootdir/usr/bin/wireless"
987
+
976 988
     { echo '[Unit]';
977 989
       echo 'Description=Initial mesh router configuration';
978 990
       echo 'After=syslog.target';
@@ -995,7 +1007,7 @@ initialise_mesh() {
995 1007
 
996 1008
 # User interface for USB drive installs ######################################
997 1009
 
998
-function mesh_client_startup_applications {
1010
+mesh_client_startup_applications() {
999 1011
     if [ ! -d "$rootdir/home/$MY_USERNAME/Desktop" ]; then
1000 1012
         mkdir -p "$rootdir/home/$MY_USERNAME/Desktop"
1001 1013
     fi
@@ -1074,7 +1086,7 @@ function mesh_client_startup_applications {
1074 1086
     chmod +x "$START_DESKTOP2"
1075 1087
 }
1076 1088
 
1077
-function mesh_desktop_icons {
1089
+mesh_desktop_icons() {
1078 1090
     if [ ! -d "$rootdir/home/$MY_USERNAME/Desktop" ]; then
1079 1091
         mkdir -p "$rootdir/home/$MY_USERNAME/Desktop"
1080 1092
     fi
@@ -1092,7 +1104,7 @@ function mesh_desktop_icons {
1092 1104
     chroot "$rootdir" /bin/chown -R "$MY_USERNAME":"$MY_USERNAME" "/home/$MY_USERNAME/Desktop"
1093 1105
 }
1094 1106
 
1095
-function configure_user_interface {
1107
+configure_user_interface() {
1096 1108
     if [[ "$VARIANT" != "meshclient" && "$VARIANT" != "meshusb" && "$VARIANT" != "usb" ]]; then
1097 1109
         return
1098 1110
     fi
@@ -1630,7 +1642,7 @@ EOF
1630 1642
 # setup_utils
1631 1643
 ##############################################################################
1632 1644
 
1633
-function image_install_inadyn {
1645
+image_install_inadyn() {
1634 1646
     if [ "$INSTALLING_MESH" ]; then
1635 1647
         return
1636 1648
     fi
@@ -1693,7 +1705,7 @@ function image_install_inadyn {
1693 1705
     echo "inadyn commit:$INADYN_COMMIT" >> "$rootdir/root/freedombone-completed.txt"
1694 1706
 }
1695 1707
 
1696
-function image_setup_utils {
1708
+image_setup_utils() {
1697 1709
     if [ "$INSTALLING_MESH" ]; then
1698 1710
         return
1699 1711
     fi
@@ -1881,12 +1893,12 @@ function image_setup_utils {
1881 1893
     #sed -i 's|btrfs subvol=@|btrfs defaults,subvol=@,compress=lzo,ssd|g' $rootdir/etc/fstab
1882 1894
 }
1883 1895
 
1884
-function image_install_nodejs {
1896
+image_install_nodejs() {
1885 1897
     mesh_install_nodejs
1886 1898
     #echo 'install_nodejs' >> ${rootdir}/root/${PROJECT_NAME}-completed.txt
1887 1899
 }
1888 1900
 
1889
-function image_preinstall_repos {
1901
+image_preinstall_repos() {
1890 1902
     if [[ "$VARIANT" == "mesh"* ]]; then
1891 1903
         return
1892 1904
     fi

+ 2
- 2
src/freedombone-image-make ファイルの表示

@@ -193,7 +193,7 @@ fi
193 193
 echo $'Changing values within customised customisation script'
194 194
 cp "$PROJECT_INSTALL_DIR/${PROJECT_NAME}-image-customise" "$TEMP_CUSTOMISE3"
195 195
 if [ "$MYUSERNAME" ]; then
196
-    sed -i "s|MY_USERNAME=.*|MY_USERNAME=${MYUSERNAME}|g" "$TEMP_CUSTOMISE3"
196
+    sed -i "0,/MY_USERNAME=.*/s//MY_USERNAME=${MYUSERNAME}/" "$TEMP_CUSTOMISE3"
197 197
 fi
198 198
 if [ "$MYPASSWORD" ]; then
199 199
     sed -i "s|MY_PASSWORD=.*|MY_PASSWORD=${MYPASSWORD}|g" "$TEMP_CUSTOMISE3"
@@ -211,7 +211,7 @@ sed -i "s|CONFIG_FILENAME=.*|CONFIG_FILENAME=${CONFIG_FILENAME}|g" "$TEMP_CUSTOM
211 211
 sed -i "s|SSH_PUBKEY=.*|SSH_PUBKEY=${SSH_PUBKEY}|g" "$TEMP_CUSTOMISE3"
212 212
 sed -i "s|GENERIC_IMAGE=.*|GENERIC_IMAGE=${GENERIC_IMAGE}|g" "$TEMP_CUSTOMISE3"
213 213
 sed -i "s|MINIMAL_INSTALL=.*|MINIMAL_INSTALL=\"${MINIMAL_INSTALL}\"|g" "$TEMP_CUSTOMISE3"
214
-sed -i "s|SSH_PORT=.*|SSH_PORT=\"${SSH_PORT}\"|g" "$TEMP_CUSTOMISE3"
214
+sed -i "0,/SSH_PORT=.*/s//SSH_PORT=\"${SSH_PORT}\"/" "$TEMP_CUSTOMISE3"
215 215
 sed -i "s|ONION_ONLY=.*|ONION_ONLY=\"${ONION_ONLY}\"|g" "$TEMP_CUSTOMISE3"
216 216
 sed -i "s|PROJECT_REPO=.*|PROJECT_REPO=\"${PROJECT_REPO}\"|g" "$TEMP_CUSTOMISE3"
217 217
 sed -i "s|DEBIAN_INSTALL_ONLY=.*|DEBIAN_INSTALL_ONLY=\"${DEBIAN_INSTALL_ONLY}\"|g" "$TEMP_CUSTOMISE3"

+ 84
- 49
src/freedombone-mesh-batman ファイルの表示

@@ -8,7 +8,7 @@
8 8
 #
9 9
 #                    Freedom in the Cloud
10 10
 #
11
-# Used to enable or disable batman mesh protocol on wlanX
11
+# Used to enable or disable batman mesh protocol on a given interface
12 12
 #
13 13
 # License
14 14
 # =======
@@ -34,22 +34,12 @@ COMPLETION_FILE="/root/${PROJECT_NAME}-completed.txt"
34 34
 # hotspot passphrase must be 5 characters or longer
35 35
 HOTSPOT_PASSPHRASE="${PROJECT_NAME}"
36 36
 
37
+# The type of interface which the mesh will run on
38
+MESH_INTERFACE_TYPE='wlan'
39
+
37 40
 source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi
38 41
 source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh
39 42
 
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
-if [ -e /etc/default/batctl ]; then
49
-    # shellcheck disable=SC1091
50
-    . /etc/default/batctl
51
-fi
52
-
53 43
 function status {
54 44
     batctl o
55 45
 
@@ -84,15 +74,17 @@ function stop {
84 74
 
85 75
     # shellcheck disable=SC2153
86 76
     if [ "$EIFACE" ]; then
87
-        brctl delif "$BRIDGE" bat0
88
-        ifconfig "$BRIDGE" down || true
89
-        ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier")
90
-        if [[ "$ethernet_connected" != "0" ]]; then
91
-            systemctl stop hostapd
92
-            brctl delif "$BRIDGE" "$EIFACE"
93
-            ifconfig "$EIFACE" down -promisc
77
+        if [[ "$EIFACE" != "$IFACE" ]] ; then
78
+            brctl delif "$BRIDGE" bat0
79
+            ifconfig "$BRIDGE" down || true
80
+            ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier")
81
+            if [[ "$ethernet_connected" != "0" ]]; then
82
+                systemctl stop hostapd
83
+                brctl delif "$BRIDGE" "$EIFACE"
84
+                ifconfig "$EIFACE" down -promisc
85
+            fi
86
+            brctl delbr "$BRIDGE"
94 87
         fi
95
-        brctl delbr "$BRIDGE"
96 88
     fi
97 89
 
98 90
     ifconfig bat0 down -promisc
@@ -100,7 +92,9 @@ function stop {
100 92
     batctl if del "$IFACE"
101 93
     ifconfig "$IFACE" mtu 1500
102 94
     ifconfig "$IFACE" down
103
-    iwconfig "$IFACE" mode managed
95
+    if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
96
+        iwconfig "$IFACE" mode managed
97
+    fi
104 98
 
105 99
     if [ "$IFACE_SECONDARY" ]; then
106 100
         systemctl stop hostapd
@@ -108,7 +102,9 @@ function stop {
108 102
         batctl if del "$IFACE_SECONDARY"
109 103
         ifconfig "$IFACE_SECONDARY" mtu 1500
110 104
         ifconfig "$IFACE_SECONDARY" down
111
-        iwconfig "$IFACE_SECONDARY" mode managed
105
+        if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
106
+            iwconfig "$IFACE_SECONDARY" mode managed
107
+        fi
112 108
     fi
113 109
 
114 110
     rmmod batman-adv
@@ -159,8 +155,10 @@ function add_wifi_interface {
159 155
     fi
160 156
     ifconfig "$ifname" hw ether "$peermac"
161 157
     echo $"$ifname assigned MAC address $peermac"
162
-    iwconfig "$ifname" enc off
163
-    iwconfig "$ifname" mode "$ifmode" essid "$ifssid" channel "$ifchannel"
158
+    if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
159
+        iwconfig "$ifname" enc off
160
+        iwconfig "$ifname" mode "$ifmode" essid "$ifssid" channel "$ifchannel"
161
+    fi
164 162
 
165 163
     batctl if add "$ifname"
166 164
     ifconfig "$ifname" up
@@ -168,7 +166,7 @@ function add_wifi_interface {
168 166
 
169 167
 # shellcheck disable=SC2120
170 168
 function start {
171
-    update_wifi_adaptors
169
+    update_wifi_adaptors "${MESH_INTERFACE_TYPE}"
172 170
 
173 171
     if [ -z "$IFACE" ] ; then
174 172
         echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
@@ -194,13 +192,15 @@ function start {
194 192
     rfkill unblock "$(rfkill list|awk -F: "/phy/ {print $1}")" || true
195 193
 
196 194
     secondary_wifi_available=
197
-    if [ "$IFACE_SECONDARY" ]; then
198
-        if [[ "$IFACE" != "$IFACE_SECONDARY" ]]; then
199
-            if [ -d /etc/hostapd ]; then
200
-                if [ ${#HOTSPOT_PASSPHRASE} -gt 4 ]; then
201
-                    secondary_wifi_available=1
202
-                else
203
-                    echo $'Hotspot passphrase is too short'
195
+    if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
196
+        if [ "$IFACE_SECONDARY" ]; then
197
+            if [[ "$IFACE" != "$IFACE_SECONDARY" ]]; then
198
+                if [ -d /etc/hostapd ]; then
199
+                    if [ ${#HOTSPOT_PASSPHRASE} -gt 4 ]; then
200
+                        secondary_wifi_available=1
201
+                    else
202
+                        echo $'Hotspot passphrase is too short'
203
+                    fi
204 204
                 fi
205 205
             fi
206 206
         fi
@@ -229,21 +229,23 @@ function start {
229 229
     ifconfig bat0 0.0.0.0
230 230
     ethernet_connected='0'
231 231
     if [ "$EIFACE" ] ; then
232
-        ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier")
233
-        if [[ "$ethernet_connected" != "0" ]]; then
234
-            echo $'Trying ethernet bridge to the internet'
235
-            brctl addif "$BRIDGE" "$EIFACE"
236
-            ifconfig "$EIFACE" 0.0.0.0
237
-            ifconfig "$EIFACE" up promisc
238
-            echo $'End of ethernet bridge'
239
-
240
-            sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx6.service
241
-            sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx7.service
242
-            sed -i "s|ExecStart=.*|ExecStart=/usr/local/sbin/olsrd2_static ${IFACE} ${EIFACE}|g" /etc/systemd/system/olsr2.service
243
-            sed -i "s|ExecStart=.*|ExecStart=/usr/local/bin/babeld ${IFACE} ${EIFACE}|g" /etc/systemd/system/babel.service
244
-            systemctl daemon-reload
245
-        else
246
-            echo $"$EIFACE is not connected"
232
+        if [[ "$EIFACE" != "$IFACE" ]] ; then
233
+            ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier")
234
+            if [[ "$ethernet_connected" != "0" ]]; then
235
+                echo $'Trying ethernet bridge to the internet'
236
+                brctl addif "$BRIDGE" "$EIFACE"
237
+                ifconfig "$EIFACE" 0.0.0.0
238
+                ifconfig "$EIFACE" up promisc
239
+                echo $'End of internet bridge'
240
+
241
+                sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx6 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx6.service
242
+                sed -i "s|ExecStart=.*|ExecStart=/usr/sbin/bmx7 dev=${IFACE} dev=${EIFACE}|g" /etc/systemd/system/bmx7.service
243
+                sed -i "s|ExecStart=.*|ExecStart=/usr/local/sbin/olsrd2_static ${IFACE} ${EIFACE}|g" /etc/systemd/system/olsr2.service
244
+                sed -i "s|ExecStart=.*|ExecStart=/usr/local/bin/babeld ${IFACE} ${EIFACE}|g" /etc/systemd/system/babel.service
245
+                systemctl daemon-reload
246
+            else
247
+                echo $"$EIFACE is not connected"
248
+            fi
247 249
         fi
248 250
     fi
249 251
     ifconfig "$BRIDGE" up
@@ -302,6 +304,9 @@ function start {
302 304
 }
303 305
 
304 306
 function monitor {
307
+    if [[ "$MESH_INTERFACE_TYPE" != 'wlan'* ]]; then
308
+        return
309
+    fi
305 310
     if [ -z "$IFACE" ] ; then
306 311
         echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
307 312
         exit 723657
@@ -357,6 +362,36 @@ function monitor {
357 362
     start
358 363
 }
359 364
 
365
+# optionally a file can contain the mesh interface type
366
+mesh_interface_type_file=/root/.mesh_interface_type
367
+if [ -f "$mesh_interface_type_file" ]; then
368
+    MESH_INTERFACE_TYPE=$(head -n 1 < "$mesh_interface_type_file")
369
+    if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
370
+        MESH_INTERFACE_TYPE='wlan'
371
+    fi
372
+    if [[ "$MESH_INTERFACE_TYPE" == 'eth'* ]]; then
373
+        MESH_INTERFACE_TYPE='eth'
374
+    fi
375
+fi
376
+
377
+mesh_protocol_init
378
+
379
+if [[ "$MESH_INTERFACE_TYPE" == 'eth'* ]]; then
380
+    MESH_INTERFACE_TYPE='eth'
381
+fi
382
+
383
+update_wifi_adaptors "${MESH_INTERFACE_TYPE}"
384
+
385
+if [ ! "$IFACE" ]; then
386
+    echo $'No wlan adaptor'
387
+    exit 0
388
+fi
389
+
390
+if [ -e /etc/default/batctl ]; then
391
+    # shellcheck disable=SC1091
392
+    . /etc/default/batctl
393
+fi
394
+
360 395
 if ! grep -q "$IFACE" /proc/net/dev; then
361 396
     echo "Interface \$IFACE was not found"
362 397
     stop

+ 4
- 4
src/freedombone-utils-avahi ファイルの表示

@@ -65,10 +65,10 @@ function mesh_avahi {
65 65
     sed -i "s|#host-name=.*|host-name=P$PEER_ID|g" "$rootdir/etc/avahi/avahi-daemon.conf"
66 66
     sed -i "s|use-ipv4=.*|use-ipv4=no|g" "$rootdir/etc/avahi/avahi-daemon.conf"
67 67
     sed -i "s|use-ipv6=.*|use-ipv6=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
68
-    sed -i "s|#allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
69
-    sed -i "s|allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
70
-    sed -i "s|#deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
71
-    sed -i "s|deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
68
+    #sed -i "s|#allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
69
+    #sed -i "s|allow-interfaces=.*|allow-interfaces=wlan0, wlan1, wlan2, wlan3, wlan4, wlan5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
70
+    #sed -i "s|#deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
71
+    #sed -i "s|deny-interfaces=.*|deny-interfaces=eth0, eth1, eth2, eth3, eth4, eth5|g" "$rootdir/etc/avahi/avahi-daemon.conf"
72 72
     sed -i "s|#disallow-other-stacks=.*|disallow-other-stacks=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
73 73
     sed -i "s|disallow-other-stacks=.*|disallow-other-stacks=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"
74 74
     sed -i "s|#publish_addresses=.*|publish_addresses=yes|g" "$rootdir/etc/avahi/avahi-daemon.conf"

+ 6
- 4
src/freedombone-utils-mesh ファイルの表示

@@ -99,11 +99,13 @@ function mesh_protocol_init {
99 99
     IFACE=
100 100
     IFACE_SECONDARY=
101 101
     EIFACE=eth0
102
-    WLAN_ADAPTORS=$(count_wlan)
102
+    if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
103
+        WLAN_ADAPTORS=$(count_wlan)
103 104
 
104
-    if [ "$WLAN_ADAPTORS" -eq 0 ]; then
105
-        echo $'No wlan adaptors found'
106
-        exit 0
105
+        if [ "$WLAN_ADAPTORS" -eq 0 ]; then
106
+            echo $'No wlan adaptors found'
107
+            exit 0
108
+        fi
107 109
     fi
108 110
 }
109 111
 

+ 10
- 5
src/freedombone-utils-wifi ファイルの表示

@@ -100,7 +100,7 @@ function setup_wifi_atheros {
100 100
     fi
101 101
     dpkg -i "$atheros_drivers_file"
102 102
     reset_usb_devices
103
-    update_wifi_adaptors
103
+    update_wifi_adaptors 'wlan'
104 104
     if [ "$IFACE" ]; then
105 105
         wpa_action "${IFACE}" stop
106 106
         wpa_cli -i "${IFACE}" terminate
@@ -198,19 +198,24 @@ function install_atheros_wifi {
198 198
 }
199 199
 
200 200
 function update_wifi_adaptors {
201
+    interface_type="$1"
201 202
     IFACE=
202 203
     IFACE_SECONDARY=
203 204
 
205
+    if [ ! "$interface_type" ]; then
206
+        interface_type='wlan'
207
+    fi
208
+
204 209
     for i in $(seq 10 -1 0); do
205
-        ifdown --force "wlan${i}" 2> /dev/null
210
+        ifdown --force "${interface_type}${i}" 2> /dev/null
206 211
     done
207 212
 
208 213
     for i in $(seq 10 -1 0); do
209
-        if grep -q "wlan${i}" /proc/net/dev; then
214
+        if grep -q "${interface_type}${i}" /proc/net/dev; then
210 215
             if [ ! $IFACE ]; then
211 216
                 IFACE="wlan${i}"
212 217
             else
213
-                IFACE_SECONDARY="wlan${i}"
218
+                IFACE_SECONDARY="${interface_type}${i}"
214 219
                 return
215 220
             fi
216 221
         fi
@@ -479,7 +484,7 @@ function wifi_networks_file_header {
479 484
 
480 485
 function create_networks_interactive {
481 486
     remove_config_param "WIFI_INTERFACE"
482
-    update_wifi_adaptors
487
+    update_wifi_adaptors 'wlan'
483 488
     if [ ! "$IFACE" ]; then
484 489
         # Don't try to configure wifi if there are no adaptors
485 490
         return

+ 1
- 1
src/freedombone-wifi ファイルの表示

@@ -150,7 +150,7 @@ if [ ! ${wifi_interface_specified} ]; then
150 150
     else
151 151
         sleep "${WAIT_SEC}"
152 152
     fi
153
-    update_wifi_adaptors
153
+    update_wifi_adaptors 'wlan'
154 154
     if [ ! $IFACE ]; then
155 155
         echo $'No wifi adaptors were found'
156 156
         exit 872356