|
@@ -319,11 +319,14 @@ WIFI_PASSWORD=
|
319
|
319
|
WIFI_INTERFACE="wlan0"
|
320
|
320
|
|
321
|
321
|
# Whether to always force there to exist a wifi password
|
322
|
|
-WIFI_FORCE_PASSWORD="no"
|
|
322
|
+WIFI_FORCE_PASSWORD="yes"
|
323
|
323
|
|
324
|
324
|
# Channel number for wifi hotspot
|
325
|
325
|
WIFI_HOTSPOT_CHANNEL=7
|
326
|
326
|
|
|
327
|
+# Mode such as "g" or "n"
|
|
328
|
+WIFI_HOTSPOT_MODE="g"
|
|
329
|
+
|
327
|
330
|
# message if something fails to install
|
328
|
331
|
CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
|
329
|
332
|
|
|
@@ -409,6 +412,9 @@ function read_configuration {
|
409
|
412
|
if grep -q "WIFI_INTERFACE" $CONFIGURATION_FILE; then
|
410
|
413
|
WIFI_INTERFACE=$(grep "WIFI_INTERFACE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
411
|
414
|
fi
|
|
415
|
+ if grep -q "WIFI_HOTSPOT_MODE" $CONFIGURATION_FILE; then
|
|
416
|
+ WIFI_HOTSPOT_MODE=$(grep "WIFI_HOTSPOT_MODE" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
|
417
|
+ fi
|
412
|
418
|
if grep -q "WIFI_HOTSPOT_CHANNEL" $CONFIGURATION_FILE; then
|
413
|
419
|
WIFI_HOTSPOT_CHANNEL=$(grep "WIFI_HOTSPOT_CHANNEL" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
|
414
|
420
|
fi
|
|
@@ -7192,31 +7198,20 @@ function enable_wifi_hotspot {
|
7192
|
7198
|
echo '' >> /etc/hostapd/hostapd.conf
|
7193
|
7199
|
echo "hw_mode=$WIFI_HOTSPOT_MODE" >> /etc/hostapd/hostapd.conf
|
7194
|
7200
|
echo '' >> /etc/hostapd/hostapd.conf
|
7195
|
|
- echo '# # Static WPA2 key configuration' >> /etc/hostapd/hostapd.conf
|
7196
|
|
- echo '# #1=wpa1, 2=wpa2, 3=both' >> /etc/hostapd/hostapd.conf
|
7197
|
|
- echo 'wpa=2' >> /etc/hostapd/hostapd.conf
|
7198
|
|
- echo '' >> /etc/hostapd/hostapd.conf
|
7199
|
|
- echo "wpa_passphrase=$WIFI_PASSWORD" >> /etc/hostapd/hostapd.conf
|
7200
|
|
- echo '' >> /etc/hostapd/hostapd.conf
|
7201
|
|
- echo '## Key management algorithms ##' >> /etc/hostapd/hostapd.conf
|
7202
|
7201
|
if [ ! $WIFI_PASSWORD ]; then
|
|
7202
|
+ echo 'auth_algs=0' >> /etc/hostapd/hostapd.conf
|
7203
|
7203
|
echo 'wpa_key_mgmt=WPA-NONE' >> /etc/hostapd/hostapd.conf
|
7204
|
7204
|
else
|
|
7205
|
+ echo '' >> /etc/hostapd/hostapd.conf
|
|
7206
|
+ echo '# # Static WPA2 key configuration' >> /etc/hostapd/hostapd.conf
|
|
7207
|
+ echo '# #1=wpa1, 2=wpa2, 3=both' >> /etc/hostapd/hostapd.conf
|
|
7208
|
+ echo 'wpa=2' >> /etc/hostapd/hostapd.conf
|
|
7209
|
+ echo '' >> /etc/hostapd/hostapd.conf
|
|
7210
|
+ echo "wpa_passphrase=$WIFI_PASSWORD" >> /etc/hostapd/hostapd.conf
|
7205
|
7211
|
echo 'wpa_key_mgmt=WPA-PSK' >> /etc/hostapd/hostapd.conf
|
7206
|
|
- fi
|
7207
|
|
- echo '#' >> /etc/hostapd/hostapd.conf
|
7208
|
|
- echo '## Set cipher suites (encryption algorithms) ##' >> /etc/hostapd/hostapd.conf
|
7209
|
|
- echo '## TKIP = Temporal Key Integrity Protocol' >> /etc/hostapd/hostapd.conf
|
7210
|
|
- echo '## CCMP = AES in Counter mode with CBC-MAC' >> /etc/hostapd/hostapd.conf
|
7211
|
|
- if [ ! $WIFI_PASSWORD ]; then
|
7212
|
|
- echo 'wpa_pairwise=NONE' >> /etc/hostapd/hostapd.conf
|
7213
|
|
- else
|
7214
|
7212
|
echo 'wpa_pairwise=TKIP' >> /etc/hostapd/hostapd.conf
|
|
7213
|
+ echo 'auth_algs=1' >> /etc/hostapd/hostapd.conf
|
7215
|
7214
|
fi
|
7216
|
|
- echo '#rsn_pairwise=CCMP' >> /etc/hostapd/hostapd.conf
|
7217
|
|
- echo '#' >> /etc/hostapd/hostapd.conf
|
7218
|
|
- echo '## Shared Key Authentication ##' >> /etc/hostapd/hostapd.conf
|
7219
|
|
- echo 'auth_algs=1' >> /etc/hostapd/hostapd.conf
|
7220
|
7215
|
echo '## Accept all MAC address ###' >> /etc/hostapd/hostapd.conf
|
7221
|
7216
|
echo 'macaddr_acl=0' >> /etc/hostapd/hostapd.conf
|
7222
|
7217
|
echo '#enables/disables broadcasting the ssid' >> /etc/hostapd/hostapd.conf
|
|
@@ -7225,11 +7220,7 @@ function enable_wifi_hotspot {
|
7225
|
7220
|
echo 'eapol_key_index_workaround=0' >> /etc/hostapd/hostapd.conf
|
7226
|
7221
|
|
7227
|
7222
|
service hostapd restart
|
7228
|
|
- if [ ! "$?" = "0" ]; then
|
7229
|
|
- echo 'Unable to restart hostapd'
|
7230
|
|
- systemctl status hostapd.service
|
7231
|
|
- exit 854
|
7232
|
|
- fi
|
|
7223
|
+ systemctl daemon-reload
|
7233
|
7224
|
|
7234
|
7225
|
if ! grep -q "subnet 192.168.4.0 netmask 255.255.255.0" /etc/dhcp/dhcpd.conf; then
|
7235
|
7226
|
echo '' >> /etc/dhcp/dhcpd.conf
|
|
@@ -7241,11 +7232,6 @@ function enable_wifi_hotspot {
|
7241
|
7232
|
sed -i "s/INTERFACES=.*/INTERFACES='$WIFI_INTERFACE'/g" /etc/default/isc-dhcp-server
|
7242
|
7233
|
|
7243
|
7234
|
service isc-dhcp-server restart
|
7244
|
|
- if [ ! "$?" = "0" ]; then
|
7245
|
|
- echo 'Unable to restart isc-dhcp-server'
|
7246
|
|
- systemctl status isc-dhcp-server.service
|
7247
|
|
- exit 856
|
7248
|
|
- fi
|
7249
|
7235
|
|
7250
|
7236
|
# Add details to the README file
|
7251
|
7237
|
if ! grep -q "Wifi Hotspot" /home/$MY_USERNAME/README; then
|