瀏覽代碼

Configurable wifi interface

Bob Mottram 8 年之前
父節點
當前提交
904d8d60af
共有 2 個檔案被更改,包括 13 行新增13 行删除
  1. 1
    1
      src/freedombone-app-dokuwiki
  2. 12
    12
      src/freedombone-wifi

+ 1
- 1
src/freedombone-app-dokuwiki 查看文件

558
         echo '' >> /home/$MY_USERNAME/README
558
         echo '' >> /home/$MY_USERNAME/README
559
         echo '' >> /home/$MY_USERNAME/README
559
         echo '' >> /home/$MY_USERNAME/README
560
         echo $'Dokuwiki' >> /home/$MY_USERNAME/README
560
         echo $'Dokuwiki' >> /home/$MY_USERNAME/README
561
-        echo '====' >> /home/$MY_USERNAME/README
561
+        echo  '========' >> /home/$MY_USERNAME/README
562
         echo $"Dokuwiki onion domain: ${DOKUWIKI_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
562
         echo $"Dokuwiki onion domain: ${DOKUWIKI_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
563
         echo $"Dokuwiki username: $MY_USERNAME" >> /home/$MY_USERNAME/README
563
         echo $"Dokuwiki username: $MY_USERNAME" >> /home/$MY_USERNAME/README
564
         echo $"Dokuwiki password: $DOKUWIKI_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
564
         echo $"Dokuwiki password: $DOKUWIKI_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README

+ 12
- 12
src/freedombone-wifi 查看文件

71
     fi
71
     fi
72
 
72
 
73
     systemctl restart network-manager
73
     systemctl restart network-manager
74
-    ifdown wlan0
74
+    ifdown $WIFI_INTERFACE
75
 }
75
 }
76
 
76
 
77
 function hotspot_on {
77
 function hotspot_on {
138
     echo "    bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces
138
     echo "    bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces
139
 
139
 
140
     systemctl restart network-manager
140
     systemctl restart network-manager
141
-    ifup wlan0
141
+    ifup $WIFI_INTERFACE
142
     systemctl restart hostapd
142
     systemctl restart hostapd
143
 }
143
 }
144
 
144
 
159
     echo 'allow-hotplug eth0' >> /etc/network/interfaces
159
     echo 'allow-hotplug eth0' >> /etc/network/interfaces
160
     echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
160
     echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
161
     echo '' >> /etc/network/interfaces
161
     echo '' >> /etc/network/interfaces
162
-    echo 'allow-hotplug wlan0' >> /etc/network/interfaces
163
-    echo 'iface wlan0 inet manual' >> /etc/network/interfaces
162
+    echo "allow-hotplug ${WIFI_INTERFACE}" >> /etc/network/interfaces
163
+    echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces
164
     echo "  wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces
164
     echo "  wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces
165
     echo '' >> /etc/network/interfaces
165
     echo '' >> /etc/network/interfaces
166
     echo 'iface default inet dhcp' >> /etc/network/interfaces
166
     echo 'iface default inet dhcp' >> /etc/network/interfaces
168
     wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG
168
     wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG
169
 
169
 
170
     systemctl restart network-manager
170
     systemctl restart network-manager
171
-    ifup wlan0
171
+    ifup ${WIFI_INTERFACE}
172
 }
172
 }
173
 
173
 
174
 function wifi_none {
174
 function wifi_none {
187
     echo 'allow-hotplug eth0' >> /etc/network/interfaces
187
     echo 'allow-hotplug eth0' >> /etc/network/interfaces
188
     echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
188
     echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
189
     echo '' >> /etc/network/interfaces
189
     echo '' >> /etc/network/interfaces
190
-    echo 'allow-hotplug wlan0' >> /etc/network/interfaces
191
-    echo 'iface wlan0 inet manual' >> /etc/network/interfaces
190
+    echo "allow-hotplug ${WIFI_INTERFACE}" >> /etc/network/interfaces
191
+    echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces
192
     echo "  wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces
192
     echo "  wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces
193
     echo '' >> /etc/network/interfaces
193
     echo '' >> /etc/network/interfaces
194
     echo 'iface default inet dhcp' >> /etc/network/interfaces
194
     echo 'iface default inet dhcp' >> /etc/network/interfaces
199
     echo '}' >> $WIFI_CONFIG
199
     echo '}' >> $WIFI_CONFIG
200
 
200
 
201
     systemctl restart network-manager
201
     systemctl restart network-manager
202
-    ifup wlan0
202
+    ifup ${WIFI_INTERFACE}
203
 }
203
 }
204
 
204
 
205
 function networks_from_file {
205
 function networks_from_file {
220
     echo 'allow-hotplug eth0' >> /etc/network/interfaces
220
     echo 'allow-hotplug eth0' >> /etc/network/interfaces
221
     echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
221
     echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
222
     echo '' >> /etc/network/interfaces
222
     echo '' >> /etc/network/interfaces
223
-    echo 'allow-hotplug wlan0' >> /etc/network/interfaces
224
-    echo 'iface wlan0 inet manual' >> /etc/network/interfaces
223
+    echo "allow-hotplug ${WIFI_INTERFACE}" >> /etc/network/interfaces
224
+    echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces
225
     echo "  wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces
225
     echo "  wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces
226
     echo '' >> /etc/network/interfaces
226
     echo '' >> /etc/network/interfaces
227
     echo 'iface default inet dhcp' >> /etc/network/interfaces
227
     echo 'iface default inet dhcp' >> /etc/network/interfaces
263
     done < $WIFI_NETWORKS_FILE
263
     done < $WIFI_NETWORKS_FILE
264
 
264
 
265
     systemctl restart network-manager
265
     systemctl restart network-manager
266
-    ifup wlan0
266
+    ifup ${WIFI_INTERFACE}
267
 }
267
 }
268
 
268
 
269
 function create_networks_interactive {
269
 function create_networks_interactive {
348
         echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
348
         echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
349
         echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
349
         echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
350
         systemctl restart network-manager
350
         systemctl restart network-manager
351
-        ifdown wlan0
351
+        ifdown ${WIFI_INTERFACE}
352
     else
352
     else
353
         networks_from_file
353
         networks_from_file
354
     fi
354
     fi