Considerations:
iw scan, match against our dietpi.txt list, then update /etc/network/interfaces with the required info. Finally connect.dietpi-configI'll be very happy when this is made available :) Please? :)
must have feature ;)
here are nice snippets for scanning: http://stackoverflow.com/questions/17809912/parsing-iw-wlan0-scan-output
Wouldn't even need scanning, just failover. Connect first, if fail, connect second, etc. Though scanning would perform better, it's just an optimization.
Note to self:
There should be some kind of file like dietpi.txt that will be used during boot to connect to any of the WiFis configured in that specific file. Not only during initial setup of the RasPi.
@Fourdee
Multiple entries in wpa_supplicant.conf are possible.
wpa_supplicant will automatically select the best network based on the order of network blocks in the configuration file, network security level (WPA/WPA2 is preferred), and signal strength.
👍
We could allow adding AUTO_SETUP_NET_WIFI2_SSID (WIFI3, ...) and related other entries to dietpi.txt and add all of them to wpa_supplicant.conf. However this strictly needs DHCP client to be used for WiFi interface, since we cannot configure different interfaces (within /etc/network/interfaces) to use the same wpa_supplicant.conf but different networks inside (all of the arrays have the same name).
But, hmm we could configure different interfaces to use different wpa_supplicant${i}.conf files actually 🤔, if this works with just one WiFi adapter? I am just not sure what happens if two SSIDs are available at the same time. Two interfaces trying to configure the same adapter? ...
Maybe going with a single interface for now is simpler/cleaner:
dietpi.txt with ascending variable numbers.network={ entries to wpa_supplicant.conf.wpa_supplicant will automatically select the best network based on the order of network blocks in the configuration file, network security level (WPA/WPA2 is preferred), and signal strength.": https://linux.die.net/man/5/wpa_supplicant.confTo not allow messing up with dietpi-config, we need to change the WiFi adapter menu:
As the overall entries are quite much and can be added/removed, perhaps it's better to allow additional SSIDs just within a separate dietpi-wifi.txt e.g.? This way we can also easier recognize if there are actually additional ones configures or not and show adapter config menu + DHCP force accordingly.
Notes:
wpa_supplicant.conf deals with priority and ordering-- Prefers to connect to a secured (WPA/WEP) SSID, regardless of lower signal strength against open SSID.
-- 🈯️ Aside from that, connects to the SSID with the greatest strength, regardless of its order in wpa_supplicant.conf
Note to self:
Optional (Wifi): section:
Automated works, however, dietpi-config afterwards results in:

Hotspot required entries:
# Wifi
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0
#gateway 192.168.0.1
wireless-power off
#dns-nameservers 8.8.8.8 8.8.4.4
# IP tables
up iptables-restore < /etc/iptables.ipv4.nat
🈯️ All testing passed https://github.com/Fourdee/DietPi/issues/368#issuecomment-421574150
The only thing I cannot achieve, due to lack of available hardware for setting up a test network, is:
dietpi-configCompleted.
Most helpful comment
@Fourdee
Multiple entries in wpa_supplicant.conf are possible.
👍
We could allow adding
AUTO_SETUP_NET_WIFI2_SSID(WIFI3, ...) and related other entries todietpi.txtand add all of them towpa_supplicant.conf. However this strictly needs DHCP client to be used for WiFi interface, since we cannot configure different interfaces (within /etc/network/interfaces) to use the samewpa_supplicant.confbut different networks inside (all of the arrays have the same name).But, hmm we could configure different interfaces to use different
wpa_supplicant${i}.conffiles actually 🤔, if this works with just one WiFi adapter? I am just not sure what happens if two SSIDs are available at the same time. Two interfaces trying to configure the same adapter? ...Maybe going with a single interface for now is simpler/cleaner:
dietpi.txtwith ascending variable numbers.network={entries towpa_supplicant.conf.wpa_supplicant will automatically select the best network based on the order of network blocks in the configuration file, network security level (WPA/WPA2 is preferred), and signal strength.": https://linux.die.net/man/5/wpa_supplicant.confTo not allow messing up with
dietpi-config, we need to change the WiFi adapter menu:As the overall entries are quite much and can be added/removed, perhaps it's better to allow additional SSIDs just within a separate
dietpi-wifi.txte.g.? This way we can also easier recognize if there are actually additional ones configures or not and show adapter config menu + DHCP force accordingly.