I'm trying to use network_get_device
in an init script, but during boot, it returns empty string for the interface I specified in /etc/config/network. Since it works fine after boot, I guess it's probably because during boot, it's still too early and the interface hasn't been fully created yet. I wonder if there is an elegant solution to wait for it without simply retrying the function in a loop for example?
I tried ubus wait_for
as suggested by @hnyman, but in my test, it was still empty even if network.interface.<name>
appeared in ubus. In my case network_get_device
only returns something more than 10 seconds after wait_for
returns.
Any help is much appreciated.