I’m writing bash script that configure network access for my Linux devices.
The script has to be used by not Linux skilled people that has no administrative rights on the device.
I wrote the ethernet interfaces configuration part and it’s ok. Now I need write Wifi configuration part.
The end of the game is to write configuration inside a
netplan configuration yaml file.
Here the expected workflow of the script:
- manage interactive menu system retrieving Hi-level Wifi parameter (SSID, password, authentication mode, dhcp or manual configuration…)
- Check the Connectivity to the selected Access point
- Save data to netplan configuration yaml file
- Apply changes
1, 3 and 4 are ok… also retrieving the list of the available access point is ok.
What I cannot achieve is the point
2 (Check the Connectivity to the selected Access point). I would like to have an use experience like the next
WIFI configuration parameters: SSID: My Network PSK: password Actions: - e: Edit - t: Test connectivity - s: Save - q: Quit Select Action: t ....wait while testing connectivity Test result: OK Press a key to continue...
I tried with
iwconfig but it’s not working with WPA so it does not apply to the most cases.
wpa_supplicant and I can do the test but not in the way I’m thinking… It’s a foreground test that can be stopped only with
ctrl-C and is hard to read for dummies (my final user taget).
I would like to
- launch the Wifi connection in background
- test in background if the connection to Access Point is ok or not
- close the Wifi connection in back ground (the final goal is to configure netplan)
- Return an OK/Fail response to calling script
Of course it is possible to run
wpa_supplicant connection in
bg but: how to check connectivity and stop it always in
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.